section 5.1: trapezoid and simpson’s rulesfacultyweb.kennesaw.edu/lritter/apr3_2335f.pdf · 2015....
Post on 07-Feb-2021
5 Views
Preview:
TRANSCRIPT
-
April 3 Math 2335 sec 001 Spring 2014
Section 5.1: Trapezoid and Simpson’s Rules
I(f ) =∫ b
af (x)dx
Trapezoid Rule: If [a,b] is divided into n equally spaced subintervalsof length h = (b − a)/n, then I(f ) ≈ Tn(f ) where
Tn(f ) =h2[f (x0) + 2f (x1) + 2f (x2) + · · ·+ 2f (xn−1) + f (xn)]
() April 1, 2014 1 / 47
-
Trapezoid and Simpson’s Rule
I(f ) =∫ b
af (x)dx
Simpson’s Rule: If [a,b] is divided into an even number n equallyspaced subintervals of length h = (b − a)/n, then I(f ) ≈ Sn(f ) where
Sn(f ) =h3[f (x0) + 4f (x1) + 2f (x2) + 4f (x3) + 2f (x4)+
+ · · ·+ 2f (xn−2) + 4f (xn−1) + f (xn)].
() April 1, 2014 2 / 47
-
Example: Approximate I(f ) with T4, S2 and S4Compute the error |I(f )− Xn(f )| for each case. (X = T ,S and n = 2,4)
I(f ) =∫ π
2
0
dx1 + sin x
= 1
() April 1, 2014 3 / 47
-
() April 1, 2014 4 / 47
-
() April 1, 2014 5 / 47
-
() April 1, 2014 6 / 47
-
Section 5.2: Error in Tn and Sn1
Consider the partiaion a = x0 < x1 < · · · < xn = b of equally spacednodes with h = xj+1 − xj . On the subinterval [xj , xj+1] we have the errorformula for P1 (assuming f ′′ exists)
f (x)− P1(x) =(x − xj)(x − xj+1)
2f ′′(cj) for some xj ≤ cj ≤ xj+1.
1We consider only the case of an equally spaced partition.() April 1, 2014 12 / 47
-
Error Formula for TnCompute the integral.∫ xj+1
xj
(x − xj)(x − xj+1)2
dx =12
∫ h0
u(u − h)du where u = x − xj
() April 1, 2014 13 / 47
-
Error ETn Formula for TnWriting
h3
12=
(h2
12
)h
we can add the errors from [x0, x1], [x1, x2], etc. together to get
ETn (f ) = −h2
12[hf ′′(c0) + hf ′′(c1) + · · ·+ hf ′′(cn−1)
]
We’re using E for error with a superscript T for the rule and subscript nfor the number of subintervals.
() April 1, 2014 14 / 47
-
Error ETn Formula for Tn
Recognizing the expression in brackets [ ] as a Riemann sum, we have
ETn (f ) = −h2
12[hf ′′(c0) + hf ′′(c1) + · · ·+ hf ′′(cn−1)
]
≈ −h2
12
∫ ba
f ′′(x)dx = −h2
12(f ′(b)− f ′(a)
)
By the Mean Value Theorem
f ′(b)− f ′(a) = (b − a)f ′′(c), for some a ≤ c ≤ b.
() April 1, 2014 15 / 47
-
Error ETn Formula for Tn
Our final error formula is
ETn (f ) = I(f )− Tn(f ) = −h2
12(b − a)f ′′(c)
for some c between a and b.
Since h = (b − a)/n, we can express ETn in terms of n as
ETn (f ) = −(b − a)3
12n2f ′′(c).
We see that the error is proportional to 1n2 .
() April 1, 2014 16 / 47
-
ExampleEstimate the number of subintervals needed to guarantee an accuracy
|ETn (f )| ≤ 10−4
for the integral
I(f ) =∫ 1
0
dx1 + x
.
() April 1, 2014 17 / 47
-
() April 1, 2014 18 / 47
-
Error in Trapezoid Rule
I(f ) =∫ 1
0
dxx + 1
= ln 2
n Tn ETn2 0.70833333 −0.015186154 0.69702381 −0.003876638 0.69412185 −0.0009746716 0.693391202 −0.00024402
Since ETn ∝ 1n2 , doubling the number of subintervals reduces the errorby a factor of 4.
() April 1, 2014 19 / 47
-
Error in Simpson’s Rule ESn
A similar derivation shows that for f sufficiently differentiable,
ESn (f ) = I(f )− Sn(f ) = −h4
180(b − a)f (4)(c)
for some c between a and b. Since h = (b − a)/n, the above can bewritten as
ESn (f ) = −(b − a)5
180n4f (4)(c)
() April 1, 2014 20 / 47
-
ExampleEstimate the number of subintervals needed to guarantee an accuracy
|ESn (f )| ≤ 10−4
for the integral
I(f ) =∫ 1
0
dx1 + x
.
() April 1, 2014 21 / 47
-
() April 1, 2014 22 / 47
-
Error in Simpson’s Rule
I(f ) =∫ 1
0
dxx + 1
= ln 2
n Sn ESn2 0.69444444 −0.001297264 0.69325397 −0.000106798 0.69315453 −0.00000735
16 0.69314765 −0.00000047
Since ESn ∝ 1n4 , doubling the number of subintervals reduces the errorby about a factor of 16.
() April 1, 2014 23 / 47
-
Order of a Rule
Note that the errors have the form
Error ≈ cnp
for some numbers p and c. In particular
ETn (f ) =cn2, and ESn (f ) =
cn4
for many functions f .
We may refer to p as the order of the integration rule.
() April 1, 2014 24 / 47
-
Richardson ExtrapolationLet an integration rule be denoted by In and have order p. TheRichardson extrapolation formula for this integration rule is
R2n =1
2p − 1(2pI2n − In
).
In particular, for the Trapezoid rule
R2n =13(4T2n − Tn) .
In particular, for Simpson’s rule
R2n =1
15(16S2n − Sn) .
() April 1, 2014 25 / 47
-
ExampleUse the previous results for the Trapezoid rule to compute R4(f ) for∫ 1
0
dxx + 1
and compare the error of R4 to that of T8.
() April 1, 2014 26 / 47
top related