Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|cite|improve this question
So nice to have you here. People say you are falling apart. But, placing your mug shots side by side, there is a clear improvement over the years. It takes time to learn proper grooming. – Will Jagy Dec 18 '12 at 2:27
@WillJagy Thank you for the motivational talk (: <br> I keep it strong every day for people like you. That and buying all the stuff I want because I can keep me sane. – lindsay lohan Dec 18 '12 at 2:31
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. – André Nicolas Dec 18 '12 at 2:36
up vote 6 down vote accepted

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:


$$\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)|$$

share|cite|improve this answer
sorry, I'm using the formula <br> integral(a, b) f(x)dx = dx/3[f(x_0) + 4f(x_1) + 2f(x_2) + 4f(x_3) + ... + 2f(x_n-2) + 4f(x_n-1) + f(x_n)] <br> where n is even and dx = (b - a)/n – lindsay lohan Dec 18 '12 at 2:28
then x_0 = 0, x_n = 2. You need to select an n (even number of) subintervals between 0 and 2. n depends on the degree of precision you need. – amWhy Dec 18 '12 at 2:33
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. – Fixed Point Dec 18 '12 at 2:35


$$\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.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.