1

I am having a problem applying composite Simpson's rule for the integral $$I=\int_0^2\dfrac{1}{x+4}dx$$ with $n=4$.

The exact value of the integral is about $0.405$, however, Simpson's is giving $0.8$, and by increasing the number $n$ up to $8$, Simpson's gives $1.6$ !!

The formula I'm using is $$I\approx \frac{1}{3}[f(0)+f(2)+2(f(1))+4(f(0.5)+f(1.5))]$$Can anyone help me figure out the problem ?

Tofi
  • 277

1 Answers1

0

The factor should be $$ \frac{(b-a)}{3n} $$ with $b-a=2$ and $n=4$ you get $1/6$ and not $1/3$. One half of $0.8$ is $0.4$ which is close to the exact value.

You can quickly check the correctness of the factor by using the constant function $f=1$.

Lutz Lehmann
  • 126,666