Chapter 6: Techniques of Integration
Section 6.7: Numeric Methods
Example 6.7.9
Sketch a derivation of Simpson's rule.
Solution
Mathematical Solution
Figure 6.7.8(a) shows a black curve with five points corresponding to x=xk,k=0,…,4, with the first three points interpolated with a quadratic whose graph is shown in red along the curve.
The rightmost of these three points, and the next two are interpolated by a second quadratic whose graph is shown in green along the curve.
These five nodes determine two contiguous "double panels." Simpson's rule amounts to approximating the area under a curve with the area under such approximating quadratics.
The line along which the two double panels in the figure touch deliberatelyshows both red and green.
use plots in module() local g,a,b,c,P1,P2,p1,p2,p3,p4,p5,p6,p7; g := x-> 2+sin(x); a := .5; b := -1.;c:=.1; P1:=.2347601860*x^2+1.076231171*x+2.; P2:=-.2347601860*x^2+1.076231171*x+2.; p1:=plot([[x,P1,x =-1..0],[x,P2,x=0..1],[x,g(x),x=-1..1],[x,0,x=-1..1]],color=[red,green,black,black], thickness=[8,8,1,1],transparency=[.7,.7,0,0],scaling=constrained,axes=none,view=[-1..1,-.2..3]); p2:=textplot({[-1,-.1,x[k]],[0,-.1,x[k+2]],[1,-.1,x[k+4]],[-.5,-.1,x[k+1]],[.5,-.1,x[k+3]]}); p3:=plot([[[-1,g(-1)],[-1,0]],[[-.5,g(-.5)],[-.5,0]],[[0,0],[0,g(0)]]],color=[red$3],thickness=[1,1,4]); p4:=plot([[[.01,0],[.01,g(.01)]],[[.5,0],[.5,g(.5)]],[[1,0],[1,g(1)]]],color=[green$3],thickness=[2,1,1]); p5:=plot([[-1,g(-1)],[-.5,g(-.5)],[0,g(0)],[.5,g(.5)],[1,g(1)]],style=point,symbol=solidcircle,symbolsize=15,color=black): p6:=textplot({[-1,g(-1)+c,typeset(``(x[k],f[k]))],[-.5,g(-.5)+c,typeset(``(x[k+1],f[k+1]))],[0,g(0)+c,typeset(``(x[k+2],f[k+2]))],[.5,g(.5)+c,typeset(``(x[k+3],f[k+3]))],[1,g(1)+c,typeset(``(x[k+4],f[k+4]))]},align=left); p7:=display(p1,p2,p3,p4,p5,p6); print(p7); end module: end use:
Figure 6.7.8(a) Two interpolating quadratics
The expression for a quadratic interpolating the three points in Table 6.7.8(a) is cumbersome, and integrating it between x=xk=a+k h and x=xk+2=a+k+2 h is an even more complex task. Surprisingly, though, this definite integral simplifies to h3 fk+4 fk+1+fk+2, so that the sum of a succession of such expressions collapses to the compact form of Simpson's rule.
xk,fk
=a+k h,fk
xk+1,fk+1
=a+k+1 h,fk+1
xk+2,fk+2
=a+k+2 h,fk+2
Table 6.7.8(a) Points interpolated by quadratic
The actual calculations are so cumbersome that they are carried out only in Maple.
Maple Solution
Interpolate xk,fk,xk+1,fk+1,xk+2,fk+2 with a polynomial quadratic in x
Enter a+k+n h,fk+n and press the Enter key.
Context Panel: Sequence≻n=0,2
Context Panel: Conversions≻To List
Context Panel: Curve Fitting≻Polynomial Interpolation≻x
a+k+n h,fk+n
a+k+n⁢h,fk+n
→sequence w.r.t. n
h⁢k+a,fk,a+k+1⁢h,fk+1,a+k+2⁢h,fk+2
→to list
→polynomial curve fit
12⁢fk+2−2⁢fk+1+fk⁢x2h2+12⁢−2⁢h⁢k⁢fk+4⁢h⁢k⁢fk+1−2⁢h⁢k⁢fk+2−2⁢a⁢fk+4⁢a⁢fk+1−2⁢a⁢fk+2−3⁢h⁢fk+4⁢h⁢fk+1−h⁢fk+2⁢xh2+12⁢h2⁢k2⁢fk−2⁢h2⁢k2⁢fk+1+h2⁢k2⁢fk+2+2⁢a⁢h⁢k⁢fk−4⁢a⁢h⁢k⁢fk+1+2⁢a⁢h⁢k⁢fk+2+3⁢h2⁢k⁢fk−4⁢h2⁢k⁢fk+1+h2⁢k⁢fk+2+a2⁢fk−2⁢a2⁢fk+1+a2⁢fk+2+3⁢a⁢h⁢fk−4⁢a⁢h⁢fk+1+a⁢h⁢fk+2+2⁢h2⁢fkh2
Find the area under the interpolating polynomial
Context Panel: Definite Integral template Integrate between a+k h and a+k+2 h then press the Enter key.
Context Panel: Simplify≻Simplify
∫a+k ha+k+2 hⅆx
16⁢fk+2−2⁢fk+1+fk⁢a+k+2⁢h3−h⁢k+a3h2+14⁢−2⁢h⁢k⁢fk+4⁢h⁢k⁢fk+1−2⁢h⁢k⁢fk+2−2⁢a⁢fk+4⁢a⁢fk+1−2⁢a⁢fk+2−3⁢h⁢fk+4⁢h⁢fk+1−h⁢fk+2⁢a+k+2⁢h2−h⁢k+a2h2+12⁢h2⁢k2⁢fk−2⁢h2⁢k2⁢fk+1+h2⁢k2⁢fk+2+2⁢a⁢h⁢k⁢fk−4⁢a⁢h⁢k⁢fk+1+2⁢a⁢h⁢k⁢fk+2+3⁢h2⁢k⁢fk−4⁢h2⁢k⁢fk+1+h2⁢k⁢fk+2+a2⁢fk−2⁢a2⁢fk+1+a2⁢fk+2+3⁢a⁢h⁢fk−4⁢a⁢h⁢fk+1+a⁢h⁢fk+2+2⁢h2⁢fk⁢k+2⁢h−k⁢hh2
= simplify
13⁢h⁢4⁢fk+1+fk+2+fk
Add the areas under three contiguous interpolating parabolas
Expression palette: Evaluation template Set k=0,2,4 and add the results.
Context Panel: Factor
x=a|f(x)k=0+x=a|f(x)k=2+x=a|f(x)k=4
13⁢h⁢4⁢f1+f2+f0+13⁢h⁢4⁢f3+f4+f2+13⁢h⁢4⁢f5+f6+f4
= factor
13⁢h⁢4⁢f1+2⁢f2+f0+4⁢f3+2⁢f4+4⁢f5+f6
Generalize to the case of n/2 panels and n+1 nodes, x0,x1,…,xn.
If a=x0 and b=xn, then there are n+1 equispaced nodes in the interval a,b. If n is even, then the interval can be subdivided into n/2 contiguous "double panels" spanning three nodes. These three nodes can be interpolated by a quadratic polynomial (whose graph is a parabola), and the area under the generic parabola so formed is Ak=h3 fk+4 fk+1+fk+2. The sum of n/2 areas of this type will then be
∑k=0n/2Ak=h3y0+4∑k=1n/2f2 k−1+2∑k=1n/2−1f2 k+fn
<< Previous Example Section 6.7 Next Chapter >>
© Maplesoft, a division of Waterloo Maple Inc., 2024. All rights reserved. This product is protected by copyright and distributed under licenses restricting its use, copying, distribution, and decompilation.
For more information on Maplesoft products and services, visit www.maplesoft.com
Download Help Document