CS计算机代考程序代写 Numerical Integration Composite Rules CS/SE 4X03

Numerical Integration Composite Rules CS/SE 4X03
Ned Nedialkov McMaster University February 12, 2021

Outline
Composite trapezoidal rule Composite Simpson & midpoint rules Errors

Composite trapezoidal rule Composite Simpson & midpoint rules Errors
How to increase the accuracy of a rule
• We can increase the degree of the polynomial, but the error might be large
• Apply a basic rule over small subintervals
◦ subdivide [a, b] into r subintervals
◦ h = b−a length of each subinterval r
◦ ti =a+ih,i=0,1,…,r t0 = a, tr = b
􏰋 b a
f(x)dx =
􏰊r 􏰋 t i i=1 ti−1
f(x)dx
Copyright © 2021 N. Nedialkov. All rights reserved. 3/6

Composite trapezoidal rule Composite Simpson & midpoint rules Errors Composite trapezoidal rule
From the basic rule on [ti−1,ti], i = 1,…,r
􏰋 ti
ti−1 we derive
f(x)dx ≈
ti − ti−1 h
2 [f(ti−1) + f(ti)] = 2 [f(ti−1) + f(ti)]
􏰋 b a
􏰊r 􏰋 t i
h 􏰊r
f(x)dx ≈ 2 [f(ti−1) + f(ti)]
f(x)dx = =
i=1 i=1
= h(f(t0)+f(t1)+···+f(tr−1))
2
+h( f(t1)+···+f(tr−1)+f(tr)) 2
r−1
= h [f(a) + f(b)] + h􏰊f(ti)
2
i=1
Copyright © 2021 N. Nedialkov. All rights reserved. 4/6
i=1 ti−1 h􏰒rr􏰓
2
i=1 􏰊 f(ti−1) + 􏰊 f(ti)

Composite trapezoidal rule Composite Simpson & midpoint rules Errors Composite Simpson & midpoint rules
Simpson:
 􏰋b h r/2−1 r/2
a
f(x)dx≈ 3f(a)+2 􏰊 f(t2i)+4􏰊f(t2i−1)+f(b) i=1 i=1
Midpoint:
􏰋b 􏰊r f(x)dx ≈ h
f (a + (i − 1/2)h)
a
i=1
Copyright © 2021 N. Nedialkov. All rights reserved. 5/6

Composite trapezoidal rule Composite Simpson & midpoint rules
Errors
Errors
• Trapezoidal rule
• Midpoint rule
• Simpson
E(f) = −f′′(η)(b − a)h2 12
E(f) = f′′(ξ)(b − a)h2 24
E(f) = −f(iv)(ζ)(b − a)h4 180
Copyright © 2021 N. Nedialkov. All rights reserved.
6/6