2
$\begingroup$

I have $\int_0^2 \frac{1}{1+x^6} dx$

We vaguely went over this in class today and I understand how to work Simpson's rule but only when I have $n$ already given to me. How can I determine $n$ when it isn't given? Thank you for your time and help.

  • 0
    In exercises, "$n$" will ordinarily be explicitly given to you. In real calculations, one often keeps doubling the number of points until answers stabilize. It turns out the answer for $k$ can be incorporated into the answer for $2k$, so to go from $4$ to $8$ just involves $4$ new function evaluations.2012-12-18

2 Answers 2

6

I'm not clear about your reference to $n$: Perhaps this formula will be of help.

Simpson's Rule (numerical approximation of definite integrals):

$\displaystyle \int_a^b f(x)dx \approx \frac{b-a}{6}\left[f(a) + 4f\left(\frac{a+b}{2}\right) + f(b)\right] $.


For your problem, $f(x) = \dfrac{1}{1 + x^6}, \quad a = 0,\; b = 2$.


If you want the composite Simpson's Rule:

Use

$\int_a^b f(x) \, dx\approx \frac{h}{3}\bigg[f(x_0)+4f(x_1)+2f(x_2)+4f(x_3)+2f(x_4)+\cdots+4f(x_{n-1})+f(x_n)\bigg]$

where $h = \dfrac{b-a}{n}$

Note: Usually -- in an exercise -- "$n$" will be explicitly given to you. In real-life scenarios, keep doubling the number of $x_i$ until your answer stabilizes. It turns out that the computation for $n = 2k$ (with $k$ an integer) can be incorporated into the answer for $n = 2(2k)$, so you don't need to start from scratch when doubling the number of $x_i$.

Choose $n$ sufficiently small to bound the error term.

The error term is given by the following:

$\frac{h^4}{180}(b-a) \max_{\xi\in[a,b]} |f^{(4)}(\xi)|$

  • 0
    So you are using the composite Simpson's rule. Well in that case you should be given an error bound, the step size, or the number of intervals (the $n$ you are asking about). It must be there, part of the question. If not then, just use Simpson's rule as above.2012-12-18
2

Using

$\int_a^b f(x) \, dx\approx \frac{h}{3}\bigg[f(x_0)+4f(x_1)+2f(x_2)+4f(x_3)+2f(x_4)+\cdots+4f(x_{n-1})+f(x_n)\bigg]$

the error term is given by

$\frac{h^4}{180}(b-a) \max_{\xi\in[a,b]} |f^{(4)}(\xi)|$

Choose $h$ so that the error term is sufficiently small.