


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
A detailed explanation of simpson's rule, a numerical integration technique that belongs to the family of newton-cotes formulas. The derivation of simpson's rule using interpolation and the order of convergence analysis. The document also includes a matlab code snippet for implementing simpson's rule.
Typology: Lecture notes
1 / 4
This page cannot be seen from the preview
Don't miss anything!



Simpson’s rule is a numerical integration technique the belongs to the family of Newton-Cotes formulas. Observe the following pattern:
c 1 f 1 + c 2 f 2 + c 3 f 3
The coefficients c 1 , c 2 , and c 3 are determined from the conditions that the above stencil inegrates 1. constant, 2. linear, and 3. quadratic functions exactly:
f (x) = 1 : 1 c 1 + 1c 2 + 1c 3 =
0 1 dx^ = 2 f (x) = x : 0 c 1 + 1c 2 + 2c 3 =
0 xdx^ = 2 f (x) = x^2 : 0 c 1 + 1^2 c 2 + 2^2 c 3 =
0 x
(^2) dx = 8 3
We get the following system ⎡ ⎣
c 1 c 2 c 3
8 3
The solution of this system is
⎡ ⎣
c 1 c 2 c 3
8 3
1 (^34) (^31) 3
Therefore, the Simpson stencil is (and don’t forget to multiply by h!)
μ 1 3
fi +
fi+1 +
fi+
h
Here, the idea is to replace the true function with an approximate one (a parabola) and integrate the approximate one exactly. This approach, too, gen- eralizes easily to any order, but it is more cumbersome algebraically. Let us interpolate (i.e. pass a curve through) the values of fi, fi+1, and fi+2. Let the interpolant be a parabola
y (x) = ax^2 + bx + c.
We need to determine a, b, and c — three unknowns. But y (x) needs to pass through three points (xi, fi), (xi+1, fi+1), and (xi+2, fi+2), so we have three equations. To make the algebra simple, let xi = 0, xi+1 = 1, and xi+2 = 2 so the eventual answer will need to be multiplied by h. The three equations read:
a 02 + b0 + c = fi a 12 + b1 + c = fi+ a 22 + b2 + c = fi+
or, in matrix form:
⎡ ⎣
a b c
fi fi+ fi+
The solution is ⎡ ⎣
a b c
fi fi+ fi+
1 2 fi^ −^ fi+1^ +^
1 2 fi+ − 32 fi + 2fi+1 − 12 fi+ fi
Therefore, y (x) is given by
y (x) =
μ 1 2
fi − fi+1 +
fi+
x^2 +
μ −
fi + 2fi+1 −
fi+
x + fi
We observe fourth order convergence. We were aiming for third order, but got an added bonus.