BookRags.com Literature Guides Literature
Guides
Criticism & Essays Criticism &
Essays
Questions & Answers Questions &
Answers
Lesson Plans Lesson
Plans
My Bibliography Periodic Table U.S. Presidents Shakespeare Sonnet Shake-Up
Research Anything:        
History | Encyclopedias | Films | News | Create a Bibliography | More... Login | Register | Help
Not What You Meant?  There are 64 definitions for Simpson.

Simpson's rule

Print-Friendly
About 3 pages (962 words)

Bookmark and Share Questions on this topic? Just ask!

In numerical analysis, Simpson's rule is a method for numerical integration, the numerical approximation of definite integrals. Specifically, it is the following approximation:

<math> \int_{a}^{b} f(x) \, dx \approx \frac{b-a}{6}\left[f(a) + 4f\left(\frac{a+b}{2}\right)+f(b)\right].</math>

It is named after Thomas Simpson.[1]

Contents

Derivation

Simpson's rule can be derived in various ways.

Quadratic interpolation

One derivation replaces the integrand <math>f(x)</math> by the quadratic polynomial <math>P(x)</math> which takes the same values as <math>f(x)</math> at the end points a and b and the midpoint m = (a+b) / 2. One can use Lagrange polynomial interpolation to find an expression for this polynomial,

<math> P(x) = f(a) \frac{(x-m)(x-b)}{(a-m)(a-b)} + f(m) \frac{(x-a)(x-b)}{(m-a)(m-b)} + f(b) \frac{(x-a)(x-m)}{(b-a)(b-m)}.

</math> An easy (albeit tedious) calculation shows that

<math> \int_{a}^{b} P(x) \, dx =\frac{b-a}{6}\left[f(a) + 4f\left(\frac{a+b}{2}\right)+f(b)\right].</math> [2]

Averaging the midpoint and the trapezium rules

Another derivation constructs Simpson's rule from two simpler approximations: the midpoint rule

<math> M = (b-a) f \left( \frac{a+b}{2} \right) </math>

and the trapezium rule

<math> T = \tfrac12 (b-a) (f(a)+f(b)). </math>

The errors in these approximations are

<math> -\tfrac1{24} (b-a)^3 f(a) + O((b-a)^4) \quad\text{and}\quad \tfrac1{12} (b-a)^3 f(a) + O((b-a)^4), </math>

respectively. It follows that the leading error term vanishes if we take the weighted average

<math> \frac{2M+T}{3}. </math>

This weighted average is exactly Simpson's rule. Using another approximation (for example, the trapezium rule with twice as many points), it is possible to take a suitable weighted average and eliminate another error term. This is Romberg's method.

Undetermined coefficients

The third derivation starts from the ansatz

<math> \int_{a}^{b} f(x) \, dx \approx \alpha f(a) + \beta f\left(\frac{a+b}{2}\right) + \gamma f(b).</math>

The coefficients α, β and γ can be fixed by requiring that this approximation be exact for all quadratic polynomials. This yields Simpson's rule.

Error

The error in approximating an integral by Simpson's rule is

<math> -\frac{(b-a)^5}{2880} f^{(4)}(\xi), </math>

where <math>\xi</math> is some number between <math>a</math> and <math>b</math>.[3] The error is (asymptotically) proportional to <math>(b-a)^5</math>. However, the above derivations suggest an error proportional to <math>(b-a)^4</math>. Simpson's rule gains an extra order because the points at which the integrand are evaluated, are distributed symmetrically in the interval [a, b].

Composite Simpson's rule

If the interval of integration <math>[a, b]</math> is in some sense "small", then Simpson's rule will provide an adequate approximation to the exact integral. By small, what we really mean is that the function being integrated is relatively smooth over the interval <math>[a, b]</math>. For such a function, a smooth quadratic interpolant like the one used in Simpson's rule will give good results. However, it is often the case that the function we are trying to integrate is not smooth over the interval. Typically, this means that either the function is highly oscillatory, or it lacks derivatives at certain points. In these cases, Simpson's rule may give very poor results. One common way of handling this problem is by breaking up the interval <math>[a, b]</math> into a number of small subintervals. Simpson's rule is then applied to each subinterval, with the results being summed to produce an approximation for the integral over the entire interval. This sort of approach is termed the composite Simpson's rule. Suppose that the interval <math>[a, b]</math> is split up in <math>n</math> subintervals, with <math>n</math> an even number. Then, the composite Simpson's rule is given by

<math>\int_a^b f(x) \, dx\approx

\frac{h}{3}\bigg[f(x_0)+2\sum_{j=1}^{n/2-1}f(x_{2j})+ 4\sum_{j=1}^{n/2}f(x_{2j-1})+f(x_n) \bigg],</math> where <math>x_i=a+ih</math> for <math>i=0, 1, ..., n-1, n</math> with <math>h=(b-a)/n</math>; in particular, <math>x_0=a</math> and <math>x_n=b</math>. The above formula can also be written as

<math>\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].</math> The error committed by the composite Simpson's rule is bounded (in absolute value) by

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

where <math>h</math> is the "step length", given by <math>h=(b-a)/n.</math>[4] This formulation splits the interval <math>[a,b]</math> in subintervals of equal length. In practice, it is often advantageous to use subintervals of different lengths, and concentrate the efforts on the places where the integrand is less well-behaved. This leads to the adaptive Simpson's method.

Python implementation of Simpson's rule

Here is an implementation of Simpson's rule in Python. <source lang="python"> def simpson_rule(f, a, b):

 "Approximate the definite integral of f from a to b by Simpson's rule."
 c = (a + b) / 2.0
 h3 = abs(b - a) / 6.0
 return h3 * (f(a) + 4.0*f(c) + f(b))
  1. Calculates integral of sin(x) from 0 to 1

from math import sin print simpson_rule(sin, 0, 1) </source> Integrating sin x from 0 to 1 with this code gives 0.4598622... whereas the true value is 1 − cos 1 = 0.45969769413... .

Notes

  1. ^ Süli and Mayers, §7.2
  2. ^ Atkinson, p. 256; Süli and Mayers, §7.2
  3. ^ Atkinson, equation (5.1.15); Süli and Mayers, Theorem 7.2
  4. ^ Atkinson, pp. 257+258; Süli and Mayers, §7.5

References

Simpson's rule is mentioned in many text books in numerical analysis:

  • Atkinson, Kendall A. (1989). An Introduction to Numerical Analysis, 2nd edition, John Wiley & Sons. ISBN 0-471-50023-2. 
  • Burden, Richard L. and Faires, J. Douglas (2000). Numerical Analysis, 7th edition, Brooks/Cole. ISBN 0-534-38216-9. 
  • Süli, Endre and Mayers, David (2003). An Introduction to Numerical Analysis. Cambridge University Press. ISBN 0-521-81026-4 (hardback), ISBN 0-521-00794-1 (paperback). 

External links


This article incorporates material from Code for Simpson's rule on PlanetMath, which is licensed under the GFDL.

View More Summaries on Simpson's rule
 
Ask any question on Simpson's rule and get it answered FAST!
Answer questions in BookRags Q&A and earn points toward
discounted or even FREE Study Guides and other BookRags products!
Learn more about BookRags Q&A
Copyrights
Simpson's rule from Wíkipedia. ©2006 by Wíkipedia. Licensed under the GNU Free Documentation License. View a list of authors or edit this article.

Article Navigation
Join BookRagslearn moreJoin BookRags




About BookRags | Customer Service | Report an Error | Terms of Use | Privacy Policy