Simpson's Rule Question with Example

134 Views Asked by At

I'm just learning Simpson's Rule for integral approximation and I have a question. $ \int _a^b\:f\left(x\right)dx\:approx=\frac{\frac{b-a}{n}}{3}\left[\left(1f\left(x0\right)\right)+4f\left(x1\right)+2f\left(x2\right)...\right]$

I'm trying to use Simpson to approximate the area under 1/x a=1 b=2 with an n=10.

Here is what I have so far: $\int _1^2\frac{1}{x}dx\:approx=\frac{1}{30}\left[\frac{1}{\frac{1}{10}\cdot 0}+4\frac{1}{\frac{1}{10}\cdot 1}...\right]$

What's tripping me up is the first f(x0). It clearly evaluates to 10/0, which is undefined. Where is my error?

I appreciate any assistance provided!

1

There are 1 best solutions below

2
On BEST ANSWER

Your error lies, as my comment tries to hint at, in the definition of $x_{i}$.

For Simpson's rule with $n+1$ points we have that $$x_{i}=a+i\frac{b-a}{n} \tag{$i=0,1,\dots,n$}.$$

This gives us in your case

$$x_{i}=1+i\frac{1}{10} \tag{$i=0,1,\dots,9,10$}$$