Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Simpson's Rule: Derivation and Order of Convergence, Lecture notes of Algebra

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

2021/2022

Uploaded on 09/27/2022

lilwayne
lilwayne 🇬🇧

4.1

(7)

243 documents

1 / 4

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Simpson’s Rule
January 31, 2006
1 Simpson’s rule
Simpson’s rule is a numerical integration technique the belongs to the family of
Newton-Cotes formulas. Observe the following pattern:
1. The Left End rule integrates constant functions exactly. It converges to
thetruesolutionas1/N . The stencil use fi.
2. The Trapezoid rule integrates linear functions exactly. In converges to
thetruesolutionattherateof1/N 2. The stencil uses fiand fi+1 .
This pattern can extended to any order n.
3. The n-th order Newton-Cotes formula integrates polynomials up to order
nexactly. It converges at least as fast as 1/N n+1 sometimes faster as we
shall see. (So perhaps I should call it the n+1order formula, but let’s stick to
"n-th".) The stencil uses fi,.., fi+n.
Secon order Newton-Cotes formula is called Simpson’s Rule.
Here’s a good way to derive Simpson’s formula. Formally, we should consider
thenodepointsxi,xi+1 =xi+h,andxi+2 =xi+2hand the corresponding
values of the function fi,fi+1,andfi+2. But to simplify the algebra, let us
instead consider x=0,1,2and label the corresponding values of the function
f1,f2,andf3. The stencil looks like this
c1f1+c2f2+c3f3
The coecients c1,c2,andc3are determined from the conditions that the above
stencil inegrates 1. constant, 2. linear, and 3. quadratic functions exactly:
f(x)=1 : 1c1+1c2+1c3=R2
01dx =2
f(x)=x:0c1+1c2+2c3=R2
0xdx =2
f(x)=x2:0c1+1
2c2+2
2c3=R2
0x2dx =8
3
We get the following system
111
012
014
c1
c2
c3
=
2
2
8
3
1
pf3
pf4

Partial preview of the text

Download Simpson's Rule: Derivation and Order of Convergence and more Lecture notes Algebra in PDF only on Docsity!

Simpson’s Rule

January 31, 2006

1 Simpson’s rule

Simpson’s rule is a numerical integration technique the belongs to the family of Newton-Cotes formulas. Observe the following pattern:

  1. The Left End rule integrates constant functions exactly. It converges to the true solution as 1 /N. The stencil use fi.
  2. The Trapezoid rule integrates linear functions exactly. In converges to the true solution at the rate of 1 /N^2. The stencil uses fi and fi+1. This pattern can extended to any order n.
  3. The n-th order Newton-Cotes formula integrates polynomials up to order n exactly. It converges at least as fast as 1 /N n+1^ — sometimes faster as we shall see. (So perhaps I should call it the n + 1 order formula, but let’s stick to "n-th".) The stencil uses fi, .., fi+n. Secon order Newton-Cotes formula is called Simpson’s Rule. Here’s a good way to derive Simpson’s formula. Formally, we should consider the node points xi, xi+1 = xi + h, and xi+2 = xi + 2h and the corresponding values of the function fi, fi+1, and fi+2. But to simplify the algebra, let us instead consider x = 0, 1 , 2 and label the corresponding values of the function f 1 , f 2 , and f 3. The stencil looks like this

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 =

R 2

0 1 dx^ = 2 f (x) = x : 0 c 1 + 1c 2 + 2c 3 =

R 2

0 xdx^ = 2 f (x) = x^2 : 0 c 1 + 1^2 c 2 + 2^2 c 3 =

R 2

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

2 Deriving Simpson’s Rule By Interpolation

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.