Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Y. K. Goh
2013
1 Numerical Integration
Basic Numerical Integration
Newton-Cotes Rules
Romberg Integration
Gaussian Quadrature
Adaptive Quadrature Methods
2 Numerical Differentiation
Finite Differences
Richardsons Extrapolation
1 Numerical Integration
Basic Numerical Integration
Newton-Cotes Rules
Romberg Integration
Gaussian Quadrature
Adaptive Quadrature Methods
2 Numerical Differentiation
Finite Differences
Richardsons Extrapolation
Example
Z 2
1
How many subintervals are needed to approximate 3
dx with error not exceed
1 x
105 by using a (i) composite trapezoid rule, and (ii) composite Simpsons rule?
ANSWER:
Composite trapezoid rule:
The error formula : ba 12
h2 f 00 ()
f 00 (x) = x125 , for [1, 2], |f 00 ()| 12.
Thus, the maximum error will not greater than h2 .
To have error less than 105 , h2 105 , or h 0.003162.
h = (b a)/n 0.003162 implies n 316.23, ie 317 or more partitions will
certainly produce the desirable accuracy.
Composite Simpsons rule:
The error formula : ba
180
h4 f (4) ()
f (x) = x7 , for [1, 2], |f (4) ()| 360.
(4) 360
1 Numerical Integration
Basic Numerical Integration
Newton-Cotes Rules
Romberg Integration
Gaussian Quadrature
Adaptive Quadrature Methods
2 Numerical Differentiation
Finite Differences
Richardsons Extrapolation
The quadrature rules are closed when the values of f (x) at the end points
are involve in the integration. Otherwise they are opened.
Midpoint Rule
Z x2
1 3 00
f (x) dx = 2hf1 + h f ()
x0 24
Two-Point Newton-Cotes Open Rule
Z x3
3 1
f (x) dx = h[f1 + f2 ] + h3 f 00 ()
x0 2 4
Three-Point Newton-Cotes Open Rule
Z x4
4 28
f (x) dx = h[2f1 f2 + 2f3 ] + h5 f (4) ()
x0 3 90
Four-Point Newton-Cotes Open Rule
Z x5
5 95 5 (4)
f (x) dx = h[11f1 + f2 + f3 + 11f4 ] + h f ()
x0 24 144
1 Numerical Integration
Basic Numerical Integration
Newton-Cotes Rules
Romberg Integration
Gaussian Quadrature
Adaptive Quadrature Methods
2 Numerical Differentiation
Finite Differences
Richardsons Extrapolation
1
Rn,m = Rn,m1 + (Rn,m1 Rn1,m1 ),
4m 1
then the previous approximation could be summarised as:
n1 n1
X h X h
R(0) (h) = [f (xi ) + f (xi+1 )] = R0,0 = [f (xi ) + f (xi+1 )]
i=0
2 i=0
2
4 1 1
R (h) = R(0) (h/2) R(0) (h)
(1)
= R1,1 = R1,0 + [R1,0 R0,0 ]
3 3 3
(2) 16 (1) 1 (1) 1
R (h) = R (h/2) R (h) = R2,2 = R2,1 + [R2,1 R1,1 ]
15 15 15
(3) 64 (2) 1 1
R (h) = R (h/2) R(2) (h) = R3,3 = R3,2 + [R3,2 R2,2 ]
63 63 63
1 Numerical Integration
Basic Numerical Integration
Newton-Cotes Rules
Romberg Integration
Gaussian Quadrature
Adaptive Quadrature Methods
2 Numerical Differentiation
Finite Differences
Richardsons Extrapolation
Example
R1 1
Evaluate 1 x+2
numerically with two-point Gauss-Legendre rule.
ANS:
Exact solution : ln(3) ln(1) 1.09861.
Gauss-Legendre : G2 (f ) = f 13 + f 13 = 1.09091.
2
Trapezoid rule : 2 [f (1) + f (1)] = 1.33333.
1
Simpsons rule : 3 [f (1) + 4f (0) + f (1)] = 1.11111.
Y. K. Goh (UTAR) Numerical Methods - Integration & Differentiation 2013 19 / 35
Gauss-Legendre Quadrature Nodes and Weights
The values of the nodes xi and weights wi are given by the following table
1 Numerical Integration
Basic Numerical Integration
Newton-Cotes Rules
Romberg Integration
Gaussian Quadrature
Adaptive Quadrature Methods
2 Numerical Differentiation
Finite Differences
Richardsons Extrapolation
1 Numerical Integration
Basic Numerical Integration
Newton-Cotes Rules
Romberg Integration
Gaussian Quadrature
Adaptive Quadrature Methods
2 Numerical Differentiation
Finite Differences
Richardsons Extrapolation
1 Numerical Integration
Basic Numerical Integration
Newton-Cotes Rules
Romberg Integration
Gaussian Quadrature
Adaptive Quadrature Methods
2 Numerical Differentiation
Finite Differences
Richardsons Extrapolation
Example
Let f (x) = cos x find f 0 ( 4 ), with h = 0.1 and 0.01. Calculate the corresponding
absolute errors.
ANSWER :
f ( 4 + h) f ( 4 )
f 0( ) .
4 h
0.6329813067 0.7071067812
For h = 0.1, f 0 ( ) = 0.7412547451.
4 0.1
0.7000004762 0.7071067812
For h = 0.01, f 0 ( ) = 0.7106305006.
4 0.1
For h = 0.1 case, absolute errors
= | 0.7412547451 ( sin(/4))| = 0.0341.
For h = 0.01 case, absolute errors
= | 0.7106305006 ( sin(/4))| = 0.00352.
Example
Let f (x) = exp(x) and x0 = 1. The following figure shows the secant lines for
h = 0.25, 0.5, 0.75 and 1.0.
Example
Find f 0 (x) for the following data set (x, f (x)) by using the forward / backward /
center difference formula, given that f (x) = tan(x)
ANSWER :
x f (x) f 0 (x)
Exact Value Forward Diff. Backward Diff. Center Diff.
2.1 -1.70985 3.9236 3.3602 - -
2.2 -1.37382 2.8874 2.5461 3.3602 2.9532
2.3 -1.11921 2.2526 2.0320 2.5461 2.2890
2.4 -0.91601 1.8391 1.6899 2.0320 1.8610
2.5 -0.74702 1.5580 1.4543 1.6899 1.5721
2.6 -0.60160 1.3619 - 1.4543 -
Example
Let f (x) = cos x, estimate f 00 ( 4 ) with h = 0.01 with the center difference
formulat and calculate the corresponding absolute error.
ANSWER :
f (/4 + h) 2f (/4) + f (/4 h)
f 00 (/4) = 0.7071008887.
h2
Absolute error = | 0.707100888650558 + cos(/4)| = 5.89 106 .
1 Numerical Integration
Basic Numerical Integration
Newton-Cotes Rules
Romberg Integration
Gaussian Quadrature
Adaptive Quadrature Methods
2 Numerical Differentiation
Finite Differences
Richardsons Extrapolation
Example
Let f (x) = xex . By using the center difference and Richardsons extrapolation,
find approximation of order O(h2 ), O(h4 ), and O(h6 ) for f 0 (2.0) with h = 0.2.
ANSWER :
The approximations required are D(0, 0), D(1, 1), D(2, 2).
D(0, 0) = 22.414160, D(1, 0) = 22.228786, D(2, 0) = 22.182564
D(1, 1) = D(1, 0) + 13 [D(1, 0) D(0, 0)] = 22.166995, D(2, 1) = 22.167157
1
D(2, 2) = D(2, 1) + 15 [D(2, 1) D(1, 1)] = 22.167168.
Y. K. Goh (UTAR) Numerical Methods - Integration & Differentiation 2013 34 / 35
THE END