7.8 AUTOMATIC ERROR MONITORING Error Analysis: The numerical solutions of differential equations certainly differs from their exact solutions.. The relative error of an approximate solut
Trang 1Example 10 Solve y′ = 2e x – y at x = 0.4 and x = 0.5 by Milne’s method, given their values of the four points.
Sol Here we find the value of f f1, 2,f3.
0.1
1 2 2.010 0.2003
0.2
2 2 2.040 0.4028
0.3
3 2 2.090 0.6097
⇒ f3 =0.6097
By Milne’ predictor formula, we have
4
3
h
( ) ( ) ( )
4 0.1
2 2 0.2003 0.4028 2 0.6097 3
×
2.162293 2.1623
4 2.1623
y =
4 2 2.1623 0.8213494 0.8213
⇒ f4 =0.8213
Now again by Corrector formula, we get
3
h
y =y f + f +f
[ ] ( ) ( )
0.1 2.04 4028 4 0.6097 2 0.8213 3
2.162096 2.1621
⇒ y4 =2.1621
Again by using Predictor formula
4
3
h
4 0.1 2.10 2 0.4028 0.6097 2 0.8215
3
×
2.2551867 2.2552
Trang 2then f5 =2e0.5−2.2552
=1.0422425=1.0422
By Corrector formula, we get
3
h
y =y + f + f + f
( )
0.1 2.090 0.6097 4 0.8215 1.0422
3
= + + +
2.2545967 2.255
⇒ y5 =2.255 Ans
Example 11 Apply Milne’s method to find a solution of the differential equation dy x y2
dx= − in
the range 0 ≤ x ≤ 1 with y(0) = 0.
Sol Here, we use Picard’ method to compute y y1, 2, and y3
Picard’s successive approximations are given by
0x ,
y =y +∫ f x y − dx
for n=1, we have
2 1
0
0
2
y = +∫ xdx=
for n=2,
2 2 2
0
0
2
= + −
∫
2 5
2 20
x x
= −
Similarly,
2
2 5 3
0
0
2 20
= + − −
∫
2 20 160 4400
= − + −
Let us take
2 5
2 20
x x
y= − for finding the various values of y s i′ and f s i′
( )
1 0.2 0.019987 0.02,
( )
2 0.4 0.079488 0.0795,
( )
3 0.6 0.176112 0.176,
Now, using Predictor formula, we get
4
3
h
Trang 3=0 4 0.2 2 0.1996( ) 0.3937 2(0.5690)
3
×
0.3049333 0.3049
Further, using corrector formula, we get
3
h
y =y + f + f + f
0.2 0.0795 0.3937 4 0.5690 0.7070
3
3 f4 =x4+ y4 =0 8 −a0 3049 f2=0 7070359 =0 7070
Hence, y4 =0.3046 at x=0.8 and corrected ( )2
4 0.8 0.3046 0.7072
Again, using Predictor formula, we get,
4
3
h
y =y + f − +f f
4 0.2
3
×
0.4554133 0.4554
Now, e3 f5 =x5 +y5 = −1 a0 4554 f2 =.792610=0 7926 j
Using corrector formula, we get
3
h
y =y + f + f + f
0.2 0.176 0.5690 4 0.7072 0.7926
3
=0.45536=0.4554 Hence, y( )1 =0.4554 Ans
Example 12 Given dy 1( 2) 2
dx 2 and y(0) = 1, y(0.1) = 1.06, y(0.2) = 1.12, y(0.3) = 1.21. Evaluate by Milne’ predictor—Corrector method y(0.4).
Sol Milne’s predictor formula is
1 3 ( 2 1 )
4
3
h
y + =y − + y′− −y′− + y′
Putting n=3 in the above formula, we get
4 0 ( 1 2 3)
4
3
h
We have
0 1, 1 1.06, 2 1.12, 3 1.21,
The given differential equation is
( 2) 2
1 1 2
y′ = +x y
Trang 4( 2) 2 ( )2 ( )2
y′ = +x y = + ×
( )2 0.505 1.06
y′ = +x y = + ×
( )2 0.52 1.12
y′ = +x y = + ×
( )2 0.545 1.21
Substituting these values in (1), we get
4
4 0.1
3
1.27715
(correct to 4 decimal places)
∴ We get
1 1 2
y′ = +x y
( )2 ( )2
1
1 0.4 1.2772
Milne’s corrector formula is
1
h
y + =y − + y′− + y′ +y′ +
Putting n = 3 in (3), we get
4
3
h
y =y + y′+ y′+y′
0.1 1.12 0.6522 4 0.798 0.9458 3
= + + × + =1.2797 (correct to 4 decimal places)
∴ y( )0.4 =1.2797 Ans
7.8 AUTOMATIC ERROR MONITORING
Error Analysis: The numerical solutions of differential equations certainly differs from their exact
solutions The difference between the computed value y i and the true value y(xi) at any stage is known as the total error The total error at any stage is comprised of truncation error and round-off error
The most important aspect of numerical methods is to minimize the errors and obtain the solutions with the least errors It is usually not possible to follow error development quite closely
We can make only rough estimates That is why our treatment of error analysis at times, has to be somewhat intuitive
In any method, the truncation error can be reduced by taking smaller sub-intervals The round-off error cannot be controlled easily unless the computer used has the double precision arithmetic facility In fact, this error has proved to be more elusive that the truncation error
Trang 5The truncation error in Euler’s method is 1 2
2h y′′ n i.e., O (h2) while that of modified Euler’s method is 1 3
2h y′′′ n i.e., O (h3)
Similarly, in the fourth order Range-Kutta method, the truncation error is of O (h5)
In the Milne’s method, the truncation error,
(i) due to predictor formula 14 5
45h y n′′′′′and
(ii) due to corrector formula 1 5
90h y′′′′′ n
= −
i.e., the truncation error in Milne’s method is also of O (h5)
The relative error of an approximate solution is the ratio of the total error to the exact value
It is of greater importance than the error itself for if the true value becomes larger than a larger, error may be acceptable If the true value diminishes, then the error must also diminish otherwise the computed results may be absurd
Convergence of a Method
Any numerical method for solving a differential equation is said to be convergent if the
approximate solution y n approaches the exact solution y(x n ) at h tends to zero provided the
rounding error arising from the initial conditions approach zero This means that as a method is continually refined by taking smaller and smaller step-sizes, the sequence of approximate solutions must converge to the exact solution
Taylor’s series method is convergent provided f (x, y) possesses enough continuous derivatives.
The Runge-Kutta methods are also convergent under similar conditions Predictor-corrector methods
are convergent if f (x, y) satisfies Lipschitz condition, i.e.,
( ), ( ) ( ),
f x y −f x y ≤k y y−
k being constant, then the sequence of approximations to the numerical solution converges to the
exact solution
7.9 STABILITY IN THE SOLUTION OF ORDINARY DIFFERENTIAL
EQUATION
There is a limit to which the steps-size h can be reduced for controlling the truncation error, beyond which a further reduction in h will result in the increase of round-off error and hence increase in
the total error
A method is said to be stable if it produces a bounded solution which imitates the exact solution Otherwise it is said to be unstable If a method is stable for all values of the parameter,
it is said to be absolutely or unconditionally stable If it is stable for some values of the parameter,
it is said to be conditionally stable
Euler’s method and Runge-Kutta method are conditionally stable The Milne’s method is, however, unstable since when the parameter is negative, each of the error is magnified while the exact solution decays
Two types of stability considerations in the solution of ordinary differential equations
(i) Inherent stability
(ii) Numerical stability
Trang 6Inherent stability is determined by the mathematical formulations of the problem and is dependent on the eigen values of Jacobian Matrix of the differential equation
Numerical stability is a function of the error propagation in the numerical method Three types of errors occur in the application of numerical integration methods:
(a) Truncation error
(b) Round-off error
(c) Propagation error
Example 13 Applying Euler’s method to the equation.
dy y,
dx= λ given y x( )0 = y 0 determine its stability zone.
What would be the range of stability when λ = –1.
By Euler’s method, we have
y n=y n−1+hy n′−1=y n−1+ λhy n−1
= + λ(1 y y) n−1
y − = + λy y −
y2= + λ(1 y y) 1
y1 = + λ(1 y y) 0
y n= + λ(1 y)n y0 Integrating ( )1 , we get y=ceλx
Using y x( )0 =y0, we obtain 0
y =ceλ
Hence, we have ( 0 )
0 x x
y=y eλ −
In particular, the exact solution through (x y n, n) is
( 0 )
0 x n x 0 nh
y=y eλ − =y eλ [x n=x0+nh]
2
n n
= = + λ + +
Clearly, the numerical solution (2), agrees with exact solution (3) for small values of h The
solution (2), increases if 1+ λ >h 1
Hence, 1+ λh < 1 defines a stable zone.
When λ is real, then the method is stable if |1 +λh|< i.e.,
–2 < λh < 0.
When λ is complex (= +a ib), then it is stable if
[1+ =a ib h] 1<
i.e., ( ) ( )2 2
1+ah + bh <1
Trang 7i.e., (x + 1)2 + y2 < 1 where x = ah, y = bh.
i.e., lh lies within the unit circles shown in Fig 7.1
When λ is imaginary (= ib), |1 + λh| = 1, then we have a
periodic stability
Hence, Euler’s method is absolutely stable if and only if
(i) real λ : – 2 < λh < 0.
(ii) Complex λ, λh lies within the unit circle (Fig 7.1) i.e.
Euler’s method is conditionally convergent
(iii) When λ = –1, the solution is stable in the range
–2 < –h < 0, i.e., 0 < h < 2.
PROBLEM SET 7.2
1 Apply Runge-Kutta method find the solution of the differential equation 3 1
2
dy
dx= + with
0 1
2 Given dy 1 y2
dx= + where y=0when x=0, find y( ) 0.2 , y( ) 0.4 and y( ) 0.6 , using Runge-Kutta formula of order four [Ans y(0.2) = 0.2027, y(0.4) = 0.4228, y(0.6) = 0.6841]
3 Use classical Runge-Kutta method of fourth order to find the numerical solution at x = 1.4 for
( )
= 2+ 2, 1 =0
dy
dx Assume step size h=0.2. [Ans y(1.2)= 0.246326, y(1.4)=0.622751489]
4 Using Runge-Kutta method to solve 10dy x2 y2
dx= + y(0) = for the interval 0< ≤x 0.4 with 0.1
5 Solve the differential equation 2
1
y
−
= + where x0 =1, y0 =2, h=0.2 Obtain y( ) 1.2 and
( ) 1.4
y using Runge-Kutta method. [Ans 2.658913 and 3.432851]
6 Using Runge-Kutta method solve simultaneous differential equation dy f x y t( , , ) xy t
and dy ty x g x y t( , , )
dx= + = where t0=0, x0=1, y0= −1,h=0.2. [Ans y(0.2) = −0.8341]
7 By Milne’s method solve dy 2 xy2
dx= − with y(0) = 1 for x=1taking h=0.2 [Ans 1.6505]
8 Apply Milne’s method to solve the differential equation dy 2
xy
dx= − at x=0.8 given that
( ) 0 2, ( ) 0.2 1.923, ( ) 0.4 1.724, ( ) 0.6 1.471
9 Given that 1( 2) 2
1 2
dy
dx= + and y( )0 =0, y( )0.1 =1.06, y( )0.2 =1.12,y( )0.3 =1.21 Evaluate
( )0.4
y by Milne’s predictor corrector method [Ans y(0.2) =1.2797]
10 By Milne’s method solve y( )0.3 from dy x2 y2,
dx= + y( )0 =1 Find the initial values y(−0.1)
and y( )0.1 , y( )0.2 from the Taylor’s series method [Ans 1.4392]
GGG
Unstable ln( l h )
stable –1
e ( l )
FIG 7.1
Trang 8CHAPTER 8
Solution of Simultaneous
Linear Equation
8.1 INTRODUCTION
Let us consider a system of non-homogeneous linear equations in n unknowns x x1, 2, ,x n3,
11 1 12 2 1n n 1
a x21 1+a x22 2+ + a x2n n=b2
1 1 2 2
a x +a x + +a x =b
which we can solve by matrix method
Apart from this method we have some other direct methods to find out the solution of
a system of equations like Gauss-Elimination method, Gauss-Jordan’s method etc The drawback with Cramer’s and matrix inversion method is having the too much calculations If we consider
a system of 10 equations (or variables) then Cramer’s rule contains 7,00,00,000 multiplication while in matrix inversion method, evaluation of A–1 by cofactors became very complicated Now, we shall describe a few direct methods to solve a system of linear equations:
8.2 GAUSS-ELIMINATION METHOD
This is one of the most widely used method This emthod is a systematic process of eliminating
unknowns from the linear equations This method is divided into two parts: (i) Triangularization, (ii) Back substitution.
Let the system of equations in three unknowns, x, y, z be
a x a y a z b+ + =
a x a y a z+ + =b
We multiply the first equation by 21
11
a
a and subtract it from second equations to eliminate
x from second equation Similarly, we multiply the first equation by 31
11
a
a and subtract it from
third equation to eliminate x from third equation Then the above system ( )1 becomes,
373
Trang 911 12 13 1
a x a y a z+ + =b
a y a z b+ =
Again, to eliminate y from the third equation of the system ( )2 , we multiply the second equation by 32
1
22
a
a and subtract it from the third equation Then, the above system of equations
(2) becomes:
a x a y a z+ + =b
11 11
33 2
from which the values of x y z, , , can be obtained by back substitution The values of z y,
and x can be obtained from third, second and first equations respectively
The Gauss-Elimination method can be generalized to find the solutions of nsimultaneous
equations in n-unknowns.
Example 1 Solve the system of equation by Gauss-Elimination method.
2x + 3y z = 5−
2x 3y + 2x = 2−
Sol To eliminate x from the second equation of the system ( )1 , we multiply the first equation by 2 and subtract it from the second equation and obtain
− − = −2y z 7
or 2y z+ =7
Similarly, to eliminate x from the third equation of the system ( )1 we subtract first equation from the third equation and obtain
− +6y 3z= −3 Now, the system of equation (1) becomes
2x+ 3y z− = 5
2y z+ =7
Now, to eliminate y from the third equation of the system (2) we multiply the second
equation by 3 and add it to third equation of the system (2) and obtain
6z = 18
Thus, the system of equation (2) becomes
x y z
y z z
=
U V|
W|
–
Trang 10By back substitution, gives the solution
z= 3,y= 2 and x=1
Example 2 Solve the following system of equations by Gauss-Elimination method.
2x + y + z = 10
x + 4y + 9z = 16 Sol To eliminate x from the second equation of the system ( )1 , we multiply the first equation by 3
2 and subtract it from the second equation and obtain.
y+3z=6 Similarly, to eliminate xfrom the third equations of the system ( )1 , we multiply the first euqaiton by 1
2 and subtract it from the third equation and obtain.
7y+17z=22 Now, the system of equation ( )1 , becomes
2x y z+ + =10
7y+17z=22 Now, to eliminate y from the third equation of the system ( )2 , we multiply the second equation by 7 and subtract it from the third equation of the system ( )2 and obtain
4z=20 Thus, the system of equation (2) becomes
2x – y + z = 10; y + 3z = 6; 4z = 20 (3) Back substitution gives the solution
z = 5, y = –9 and x = 7 Ans.
8.3 GAUSS-ELIMINATION WITH PIVOTING METHOD
Pivoting: One of the ways around this problem is to ensure that small values (especially zeros)
do not appear on the diagonal and, if they do, to remove them by rearranging the matrix and vectors
Partial Pivoting: If zero element is found in diagonal position i.e., a ij for i=j which is called pivot element interchange the corresponding elements of two rows such that new diagonal element i if non-zero and having maximum value in that corresponding column The
process can be explained in following steps In the first step the largest coefficient of x1 (may
be positive or negative) is selected from all the equations Now we interchange the first
equation with the equation having largest coefficient of x i In the second step, the numerically
largest coefficient of x2 is selected from the remaining equations In this step we will not consider the first equations now interchange the second equation with the equation having
UV|
W|
UV|
W|