Numerics Hawassa Num Chap 6 Edited
Numerics Hawassa Num Chap 6 Edited
dy dy du 1 dy
dx du dx h du
1 2u 1 2 3u 2 6u 2 3 4u 3 18u 2 22u 6 4
y 0 y0 y0 y 0
h 2 3! 4!
dy d2y
If we want to find and 2
at exactly x x0 u 0
dx dx
1
dy 1 1 1 1
y0 2 y0 3 y0 4 y0 .......
dx x x 0
h 2 3 4
d2y 1 2 11 4 5 5
2
y 0 3
y 0 y 0 y0 .......
dx2 x x0
h 12 6
dy dy du 1 dy
dx du dx h du
1 2u 1 2 3u 2 6u 2 3 4u 3 18u 2 22u 6 4
y n yn yn y n
h 2 3! 4!
dy d2y
If we want to find and at exactly x x n u 0
dx dx 2
dy 1 1 1 1
y n 2 y n 3 y n 4 y n .......
dx x x h 2 3 4
n
d2y 1 2 3 11 4 5 5
y n y n 12 y n 6 y n .......
dx 2 x xn h2
dy d2y
Example: - Evaluate and at x 1.2 , x 2 & x 2.2 from the following table.
dx dx 2
2
x 1.0 1.2 1.4 1.6 1.8 2.0 2.2
y 2.7183 3.3201 4.0552 4.9530 6.0496 7.3891 9.0250
2 3 4 5 6
x y Dy Dy Dy Dy Dy Dy
1 2.7183
0.6018
1.2 3.3201 0.1333
0.7351 0.0294
1.4 4.0552 0.1627 0.0067
0.8978 0.0361 0.0013
1.6 4.953 0.1988 0.008 0.0001
1.0966 0.0441 0.0014
1.8 6.0496 0.2429 0.0095
1.3395 0.0535
2 7.3891 0.2964
1.6359
2.2 9.025
2 3 4 5 6
x y Vy Vy Vy Vy Vy Vy
dy 1 1 1 1 1
y0 2 y0 3 y0 4 y0 5 y0 3.32032
dx x1.2 h 2 3 4 5
dy 1 1 1 1
y5 2 y5 3 y5 4 y5 5 y 7.3895
dx x2 h 2 3 4 5
dy 1 1 1 1
y6 2 y6 3 y6 4 y6 5 y 6 y 9.8562
dx x2.2 h 2 3 4 6 6
Exercise: -
1. Given that
dy d2y
find the values of and at x 1.1 , 1.6 and 1.5
dx dx 2
3
2. Find the first and the second derivatives of the function tabulated below at tpoints
x 1.1 and 1.9
3. A slider n a machine moves along a fixed straight rod. Its distance y cm. along the
rod is given below for various values of the time t seconds. Find the velocity and
acceleration of the slider when t 0.1 , 0.5 and 0.6 seconds.
Numerical Integration
The process of integrating a definite integral from a set of tabulated values of the
integrand f(x) is called Numerical Integration. This process when applied to a function
of one variable is called Quadrature formula. In particular, this process can be used for
those definite integrals that have no explicit antiderivative or whose antidervative is not
easy to obtain.
e x sin x cos(x 3)
6 1 2
Like, e x dx , cos(x )dx , 1 ln x tan( x 3) dx , etc.
2
2
0 0
To apply numerical integration, we first represent f(x) by interpolation formula, for this
case we use Newton Forward Difference Interpolation Formula.
2 y 0 3 y 0 n y 0
f ( x) y 0 uy 0 u (u 1) u (u 1)(u 2) ........u (u 1)(u 2)....(u (n 1))
2! 3! n!
x x0
where u
h
b
Let I f ( x)dx
a
Dividing the interval [a, b] into n subintervals of width h we form the following table
x x0 x1 x2 x3 …………. xn
y=f(x) y0 y1 y2 y3 …………. yn
4
Where xi x0 ih , i 0, 1, 2, 3, 4, ...........
Trapezoidal Rule
b
To approximate f ( x)dx
a
using this rule, we first divide [a, b] into subintervals of step
x x0 x1 x2 x3 …………. xn
y=f(x) y0 y1 y2 y3 …………. yn
For each interval [xi, xi+1] i=0, 1, 2, 3…, we approximate f(x) by a linear forward
difference interpolation formula
y
f(x)
…………
x
a=x0 x1 x2 x3 x4 xn-1 xn
b xn x1 x2 x3 xn
a
f ( x)dx
x
f ( x)dx
x
f ( x)dx
x
f ( x)dx
x
f ( x)dx .....
x
f ( x)dx ...... (1)
0 0 1 2 n 1
x1
To evaluate x f ( x)dx
0
x x0 uh dx hdu
x x0 u 0 and x x1 x0 h u 1
1
u2
x1
h
1
1
x0
f ( x)dx h ( y 0 uy 0 )du h y 0 u y 0 h y 0 y 0 [ y 0 y1 ]
0 2 0 2 2
x1
h
f ( x)dx 2 [ y
x
0 y1 ] .................... (2)
0
5
To evaluate
x2
f ( x)dx
x1
x x1 uh dx hdu
x x1 u 0 and x x 2 u 1
x2 1
1
u2 1 h
x f ( x)dx h0 ( y1 uy1 )du h y1u y1 2 h y1 2 y1 2 [ y1 y 2 ]
1 0
x2
h
f ( x)dx 2 [ y
x
1 y 2 ] .................... (3)
1
Similarly
x3
h
f ( x)dx 2 [ y
x2
2 y3 ] .................... (4)
x4
h
f ( x)dx 2 [ y
x3
3 y 4 ] .................... (5)
.
.
.
xn
h
x
f ( x) dx
2
[ y n 1 y n ] ..............
n 1
b xn
h
f ( x)dx x f ( x)dx 2 [( y
a
0 y n ) 2( y1 y 2 y3 ..... y n1 )
0
And this is known as Trapezoidal Rule. This formula gives exact value if f(x) is a
6
Simpson’s 1/3 Rule
b
To approximate f ( x)dx
a
using this rule subdivide [a, b] into an even number of equally
space subintervals.
f(x)
..………..
x
a=x0 x2 x4 xn-2 b= xn
For each interval [x2i, x2i+2], i = 0, 1, 2…, we approximate f(x) by a quadratic Newton
Forward Difference Interpolating Polynomial.
For this
b xn x2 x4 x6 xn
x2
To evaluate f ( x)dx
x0
x x0 uh dx hdu
x x0 u 0 and x x2 u 2
7
x2
u (u 1) 2
2
h
f ( x)dx h ( y
x 0
0 uy 0
2!
y 0 )du [ y 0 4 y1 y 2 ]
3
........ (2)
0
x4
To evaluate f ( x)dx
x2
x x 2 uh dx hdu
x x 2 u 0 and x x 4 u 2
x4
u (u 1) 2
2
h
f ( x)dx h ( y
x 0
2 uy 2
2!
y 2 )du [ y 2 4 y 3 y 4 ]
3
........ (3)
2
Similarly
x6
h
x f ( x)dx 3 [ y 4 4 y5 y6 ] .............. (4)
4
.
.
xn
h
x
f ( x)dx 3 [ y n2 4 y n 1 y n ]
n2
b xn
h
f ( x)dx x f ( x)dx 3 [( y
a
0 y n ) 4( y1 y3 ..... y n1 ) 2( y 2 y 4 ..... y n2 )
0
and this is Simpson ' s 1 / 3 Rule
Note: - This rule requires the division of [a, b] in to an even number of subintervals of
width h and this formula gives exact value if f(x) is a polynomial function of degree at
most 2.
number multiple of 3.
8
y
f(x)
..………..
x
a=x0 x3 x6 xn-3 b= xn
For each interval [x3i, x3i+3], i = 0, 1, 2…, we approximate f(x) by Newton Forward
Difference Interpolating Polynomial of degree 3.
For this
b xn x3 x6 x9 xn
To evaluate f ( x)dx
x0
x x0 uh dx hdu
x x0 u 0 and x x3 u 3
x3
u (u 1) 2 u (u 1)(u 2) 3
3
3
x
f ( x)dx h ( y 0 uy 0
0
2!
y0
3!
y 0 )du h[ y 0 3 y1 3 y 2 y 3 ] ........(2)
8
0
x6
To evaluate f ( x)dx
x3
x x3 uh dx hdu
x x3 u 0 and x x6 u 3
x6
u (u 1) 2 u (u 1)(u 3) 3
3
3
x
f ( x)dx h ( y 3 uy 3
0
2!
y3
3!
y 3 )du h[ y 3 3 y 4 3 y 5 y 6 ]........(3)
8
3
Similarly
x6
3
f ( x)dx 8 h[ y
x
6 3 y 7 3 y8 y 9 ] ............. (4)
3
.
.
9
.
xn
3
x
f ( x)dx 8 h[ y n 3 3 y n 2 3 y n 1 y n ] .............
n 3
b xn
f ( x)dx x f ( x)dx
a 0
3h
[( y 0 y n ) 3( y1 y 2 y 4 y5 ..... y n 2 y n 1 ) 2( y3 y 6 ..... y n 3 )
8
and this is Simpson ' s 3 / 8 Rule
Note: - While applying Simpson’s 3/8 rule the number of subintervals should be taken as
multiple of 3 and this formula give exact value if f(x) is a polynomial function of degree
at most 3.
Remark: - In every rule accuracy could be increased by decreasing the step size h.
6
dx
Example: - By considering six subintervals evaluate , using
0 1 x 2
a. Trapezoidal rule
b. Simpson’s 1/3 rule
c. Simpson’s 3/8 rule
60 1
Solution: - Dividing [0, 6] into 6 subintervals means h 1 . And f ( x)
6 1 x2
x 0 1 2 3 4 5 6
y = f(x) 1 0.5 0.2 0.1 0.0588 0.0385 0.027
6
dx h
a. 1 x
0
2
[( y0 y 6 ) 2( y1 y 2 y3 y 4 y5 )] 1.4108
2
6
dx h
b. 1 x
0
2
[( y0 y6 ) 4( y1 y3 y5 ) 2( y 2 y 4 ) 1.3662
3
6
dx
3h
c.
0
1 x
8 2
[( y0 y6 ) 3( y1 y 2 y 4 y5 ) 2( y3 ) 1.3571
And from the following table we can see that accuracy in each method increases as h
decrease.
6
dx
Exact solution of [tan 1 x]60 tan 1 6 1.40564765
0 1 x
2
10
n h Trapezoidal Simpson’s 1/3 Simpson’s 3/8
6 1 1.41079867 1.3661735 1.3570808
12 0.5 1.40547621 1.403702 1.3996111
24 0.25 1.40560222 1.4056442 1.4055574
48 0.125 1.40563631 1.4056478 1.4056478
1
dx
Example: - Evaluate 1 x
0
using Simpson’s 1/3 rule for h = 0.25.
Solution: -
x 0 0.25 0.50 0.75 1.00
y = f(x) 1 0.8 0.6667 0.5714 0.5
1
dx h
1 x 3 [( y
0
0 y 4 ) 4( y1 y3 ) 2 y 2 0.69325399
And from the following table we can see that accuracy in each method increases as h
decrease.
1
dx
Exact solution of [ln(1 x)]10 ln 2 0.693147181
0
1 x
Exercise: -
6
1. Evaluate e x dx using Simpson’s 1/3 rule for h = 1.
2
0
2
x
3
2. Evaluate cos x 2 dx for h = 0.5 using
1
a. Trapezoidal rule
b. Simpson’s 1/3 rule
c. Simpson’s 3/8 rule.
11