0% found this document useful (0 votes)
4 views27 pages

Microprocessor Notes

The document discusses various methods for finding roots of non-linear equations, including the Bisection method, Regula Falsi method, Newton Raphson method, and Secant method. It provides detailed examples and iterative processes for each method, demonstrating how to apply them to specific equations. Additionally, it covers solving systems of linear equations using Direct and Indirect methods, including Gauss Elimination and Gauss Jordan methods.

Uploaded by

saravanaoctaquad
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views27 pages

Microprocessor Notes

The document discusses various methods for finding roots of non-linear equations, including the Bisection method, Regula Falsi method, Newton Raphson method, and Secant method. It provides detailed examples and iterative processes for each method, demonstrating how to apply them to specific equations. Additionally, it covers solving systems of linear equations using Direct and Indirect methods, including Gauss Elimination and Gauss Jordan methods.

Uploaded by

saravanaoctaquad
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Unit I

NON-LINEAR EQUATIONS

To find the roots of the equation, we apply the following methods:

1. Bisection method

2. Regular Falsi method

3. Newton Raphson method

4. Secant method.

Bisection method

1. Show that f ( x )=x 3 + 4 x 2−10 has a root in [1, 2], and use the Bisection method

Solution:

Here [ a , b ]= [ 1 , 2 ]

Given: f ( x )=x 3 + 4 x 2−10

f ( 1 ) =1+ 4−10=−5 ; f ( 2 )=23 + 4 ( 22 )−10=14

When we have a shift from negative to positive, we say that the root lies between those values

Here the root lies between 1 and 2.

Bisection method:

a+ b 1+2
p1 = = =1.5
2 2

f ( p 1) =f ( 1.5 )=1.53 +4 ( 1.52 )−10=2.375(+ ve)


Applying the fact that f ( p 1) =¿ mid value ¿ ¿ ¿

Here, the root lies between [ a , p1 ] = [ 1 , 1.5 ]

a+ p1 1+1.5
p2 = = =1.25
2 2

f ( p 2) =f ( 1.25 )=1.253 +4 ( 1.252 )−10=−1.796875(−ve)

Here, the root lies between [ p2 , p 1 ] =[ 1.25 ,1.5 ]

p2 + p1 1.25+1.5
p3 = = =1.375
2 2

f ( p 3 )=f ( 1.375 )=1.3753 +4 ( 1.3752 )−10=0.16211(+ve )

p2=1.25 p3=1.375 p1=1.5

Here, the root lies between [ p2 , p 3 ] =[ 1.25 ,1.375 ]

p4 =1.3125

Iteration an bn a n + bn f ( pn)
pn =
2
1 1 2 1.5 2.375
2 1 1.5 1.25 −1.796875
3 1.25 1.5 1.375 0.16211
4 1.25 1.375 1.3125 −0.84839
5
6
7
8
9
10
11
12 1.3648 1.3653 1.3651 −0.00297
13 1.3651 1.3653 1.3652 −0.0005
14 1.3652 1.3653 1.36525 0.00033

The correct value of p to four decimal places is p=1.3653

Regula Falsi method (The method of False Position)

Given interval: [ a , b ]

Iterative formula:

af ( b )−bf ( a )
p1 =
f ( b ) −f ( a )

Problem 1: Using Regula falsi method find a solution to x=cos x .

Solution:

x−cos x =0

f ( x )=x −cos x (1)

f (−1 )=−1−cos (−1 )=−1−cos ( 1 )=−ve

f ( 0 )=0−cos 0=−1

f ( 1 ) =1−cos 1=0.4597=+ve

There is a shift in sign from negative to positive between 0 and 1.

Therefore, The root lies between 0 and 1

Here a=0 , b=1


Substitute in the following iterative formula.

Iterative formula:

af ( b )−bf ( a ) 0 f ( 1 )−1 f ( 0 ) 0−(−1 ) 1


p1 = = = = =0.6850
f ( b ) −f ( a ) f ( 1 )−f ( 0 ) 0.4597−(−1 ) 1.4597

Substitute this value in equation (1).

f ( p 1) =f ( 0.6850 )=0.685−cos ( 0.685 )=−0.0893

Applying the fact:

f ( p 1) =¿ mid value ¿ ¿ ¿

Here, the root lies between 0.685 to 1.

Iteration an bn f ( an ) f ( bn ) af ( b )−bf ( a ) f ( pn)


pn =
f ( b )−f ( a )

1 0 1 −1 0.4597 0.685 −0.0893


2 0.685 1 −0.0893 0.4597 0.7363 −0.047
3 0.7363 1 −0.047 0.4597 0.7389 −0.0002
4 0.7390 1 −0.0001 0.4597 0.7391 0.0000

The root is p=0.7391

(After convergence, consider the value of p to be the root)

Note:

Example 1.8
3
f ( x )=x −4 x +1

f ( 0 )=+ ve ; f ( 1 ) =−ve ; f ( 2 )=+ ve

Here the root lies between 1 and 2


Newton Raphson method

Iterative formula for Newton Raphson method

f (x n )
x n+1=x n −
f ' (x n )

Problem 1: Find a positive root of x 3 +3 x −1=0

Here f ( 0 )=−ve ; f ( 1 ) =+ ve

The root lies between 0 and 1.

Iterative formula for Newton Raphson method:


f (x n )
x n+1=x n −
f ' (x n )

Assume x 0=0.5

Given: f ( x )=x 3 +3 x−1; f ' ( x )=3 x 2+ 3

Iteration 1: Put n=0

f (x 0) f (0.5) 0.625
x 1=x 0− =0.5− =0.5− =0.3333
f ' (x 0) f '(0.5) 3.75
'
where , f ( 0.5 )=0.625 ; f ( 0.5 ) =3.75

Iteration 2: Put n=1

x 1=0.3333 ; f ( x 1 ) =f ( 0.3333 ) =? ? ? ; f ' ( x 1 )=f ' ( 0.3333 )=? ? ?

To find x 2

f (x 1 ) f ( x 1)
x 2=x 1− =0.3333− =0.3222
f '(x 1 ) f ' (x 1)

Iteration 3: Put n=2

x 2=0.3222 ; f ( x 2 ) =f ( 0.3222 )=? ; f ' ( x 2 )=f ' ( 0.3222 )=?


To find x 3

f (x 2 ) f ( x2 )
x 3=x 2− =0.3222− =0.3222
f '( x2 ) f ' (x 2)

Here x 2=x 3 we have achieved convergence.

Therefore, the root of the equation is 0.3222 .

n x0 f (x n ) f ( x n +1 ) f ' ( x n +1 )
x n+1=x n −
f ' (x n )

0 0.5 0.3333
1 0.3333 0.3222
2 0.3222 0.3222

Secant Method

Hint:

This method is similar to Regula Falsi method....

Here we need to consider a=x 0 and b=x 1

Given: Interval [ f 0 , f 1 ]

System of Linear Equations

Traditional or conventional way of solving Linear System of equations:

x + y + z=1(1)

x− y +3 z=0 (2)

x−2 y +3 z=0 ( 3 )

adding (1) and (2)


2 x+ 4 z=1(4)

Consider (2) and (3)

Multiply (2) by 2 2 x−2 y+ 6 z=0

Subtracting this equation with (3)

x +3 z=0(5)

−1
equation ( 4 )−2equation ( 5 )−2 z =1 z=
2

Sub z in ( 5 ) ,
3
x− =0
2

3
x=
2

Substitute in (1)

x + y + z=1 ( 1 )

3 1 3−1
+ y− =1 ⇒ + y=1 ⇒ 1+ y =1⇒ y=0
2 2 2

Solution:

3 −1
x= ; y =0 ; z=
2 2

To solve the system of Linear equations in Numerical methods

There are two methods to solve system of linear equations:

1. Direct Methods

2. Indirect/Iterative Methods

Note:

 Direct Methods: Gauss- Elimination method, Gauss Jordan method, Matrix Inversion method
etc
 Iterative Methods: Gauss Seidel method, LU Decomposition method

Gauss Elimination method (Direct Method)

Procedure:

1. Reduce the given system of equations into matrix form.

2. Reduce it to an upper triangular matrix by using elementary row operations.


3. Apply back substitution to find the solution of the system of equations.

Hint:

[ ]
a 11 a12 a 13
A= a 21 a22 a 23
a 31 a32 a 33

Upper Triangular matrix:

Below the diagonal elements, make all entries zero....this is called Upper Triangular matrix

[ ]
a11 a12 a13
0 a22 a23
0 0 a33

Lower Triangular matrix:

Above the diagonal elements, make all entries zero....this is called Lower Triangular matrix

[ ]
a11 0 0
a21 a22 0
a31 a32 a33

Problem 1:

Solve: x + y=−1 ; x−2 y=2

Solution:

Step 1:

The matrix form of system of linear equations: AX=b

A=
[ 11 −21 ] ; X=[ xy ] , b=[−12]
Augmented ¿ [ A∨B ]=
[ 11 −2
1 −1
2]

Reduce to upper triangular matrix by using Elementary row operations

R2 → R2 −R 1
[0
[ A∨B ]= 1 1 −1
−3 3 ]
Let us check how the system of equations looks like:

x + y=−1

−3 y=3

Back substitution:

−3 y=3 ⇒ y=−1 ;

∴ x+ y=−1 ⇒ x−1=−1 ⇒ x=0

Solution set =X=


[ xy ]=[−10 ]
Problem 2:

Solve the following system of equations using Gauss Elimination method:

x + y + z=1(1)

x− y +3 z=0 (2)

x−2 y +3 z=0 ( 3 )
Solution:

Step 1:

Matrix form:

[ ] [] []
1 1 1 x 1
A= 1 −1 3 , X = y B= 0
1 −2 3 z 0

Augmented Matrix:

[ ]
1 1 1 1
[ A :B ] = 1 −1 3 0
1 −2 3 0

Step 2:

Hint:

Make the yellow shaded values to zero.....

R2 → R2 −R 1 ; R3 → R 3−R1
[ ]
1 1 1 1
[ A :B ] = 0 −2 2 −1
0 −3 2 −1

Again make elementary row operations, Now R3 →2 R3 +3 R2

[ ]
1 1 1 1
[ A :B ] = 0 −2 2 −1
0 0 10 −5

We have reduced to Upper triangular matrix.....

Let us check how the system of equations looks like:

x + y + z=1

−2 y +2 z =−1

10 z=−5

Back Substitution:

−5 −1 −1
10 z=−5 ⇒ z= = ⇒ z=
10 2 2

Substitute in −2 y +2 z =−1

⇒−2 y +2 ( −12 )=−1 ⇒−2 y−1=−1⇒ y =1


Substitute in x + y + z=1

1 1 1
⇒ x +1− =1 ⇒ x+ =1 ⇒ x=
2 2 2

Gauss Jordan method (Direct Method)

Procedure:

1. Reduce the given system of equations into matrix form.

2. Reduce it to an diagonal matrix by using elementary row operations.

3. Solve to get the solution.

Hint:

Diagonal matrix

[ ]
a11 0 0
0 a22 0
0 0 a33
Problem 3: Solve the following system of equations using Gauss Jordan method:

x + y + z=1(1)

x− y +3 z=0 (2)

x−2 y +3 z=0 ( 3 )
Solution:

Step 1:

Matrix form:

AX=B

[ ] [] []
1 1 1 x 1
A= 1 −1 3 , X = y B= 0
1 −2 3 z 0

Augmented Matrix:

[ ]
1 1 1 1
[ A :B ] = 1 −1 3 0
1 −2 3 0

Step 2: Using elementary row operations, we reduce the above matrix into diagonal matrix...

Ie., by making it both upper and lower triangular matrix simultaneously....

[ ]
2 0 0 1
[ A :B ] = 0 1 0 1
0 0 2 −1

2 x=1

y=1

2 z=−1

Therefore, solution set is

[]
1
2
X= 1
−1
2
Matrix Inversion Method:

System of Equations in Matrix Form:

AX=B

To find X =? ? ? ?

Pre-multiply by A−1 on both sides,

( A−1 A ) X= A−1 B
−1
IX =A B
−1
X =A B

Where
−1 1
A = adj (A )
| A|

Example:

Solve the following system of equations using Matrix Inversion method.

x− y =3

x +2 y=6

Solution:

A=
[ 11 −12 ] , X =[ xy ] , B=[ 36]
Solution set is given by: X =A −1 B

|1 2 |
| A|= 1 −1 = (1 )( 2 )− (1 )(−1 )=2+ 1=3 ≠ 0

| A|≠ 0 implies A is a non−singular ¿


which means∈verse ∃for this ¿

Hint: If | A|=0 implies A is a singular ¿ Therefore ,inverse does not exist for A .

Minor of A= [−12 11]


Cofactor of A=
[ 21 −11 ] ¿
[ ] [ ]
t
2 −1 2 1
adj ( A )=Transpose of a cofactor ¿ =
1 1 −1 1

−1 1
A = adj ( A )
| A|

−1
A =
[
1 2 1
3 −1 1 ]
3 [−1 1 ][ 6 ] [−1/3 1/3 ][ 6 ]
−1 1 2 1 3 2/3 1/3 3
Solution set, X =A B= =

¿
[−12 /3/3×3+ 1/3× 6
]
×3+ 1/3× 6 −1+2
=
[ 2+2
] =
[ 1]
4

X=
[ 41]
Gauss – Seidel Method (Iterative Method)

The system should be diagonally dominant

|a11|>|a12|+|a 13|
|a22|>|a21|+|a23|
|a33|>|a 31|+|a32|
Example:

[ ]
10 −2 4
A= 2 −8 3
−4 2 9

Here matrix A is diagonally dominant.

If not, arrange the rows accordingly by interchanging the rows.

Example:

[ ]
2 −8 3
A= 10 −2 4 This matrix is not diagonally dominant. Therefore, we interchange first and the
−4 2 9
second rows...to make it as a diagonally dominant matrix.

Algorithm for Gauss Seidel method

Step 1: Make the given matrix into diagonally dominant matrix

Step 2: Assume y (0 )=0 and z(0) =0


Step 3: Write the equations in terms of x , y ∧z

Step 4: Iterate using the updated values...

Step 5: When we get same values in the following iterations, we truncate the iteration and get the
solution set.

Problem 1
Solve the following system of equations by applying Gauss Seidel method:

2 x+10 y + z=13 ,10 x +2 y+ z =13 ,2 x + y +10 z=13

Solution:

[ ] [] [ ]
2 10 1 x 13
A= 10 2 1 ; X = y ; b= 13
2 1 10 z 13

Given matrix is not diagonally dominate, so we interchange 1st and 2nd row

[ ] [] [ ]
10 2 1 x 13
A= 2 10 1 ; X = y ; b= 13
2 1 10 z 13

1
10 x+ 2 y + z=13 ⇒ 10 x=13−2 y−z ⇒ x= [ 13−2 y−z ]
10

1
2 x+10 y + z=13 ⇒ 10 y =13−2 x−z ⇒ y= [ 13−2 x−z ]
10

1
2 x+ y+10 z=13 ⇒ 10 z=13−2 x− y ⇒ z= [ 13−2 x− y ]
10

Iteration 1: Put y (0 )=0 , z(0) =0

1
x (1 )= [ 13−2 y (0 )−z (0 ) ]= 1 [ 13−2 ( 0 )−( 0 ) ]= 13 =1.3
10 10 10

1
y (1 )= [ 13−2 x (1) −z (0) ]= 1 [13−2 ( 1.3 )−0 ]=1.04
10 10

1
(1)
z = [ 13−2 x (1)− y (1) ]= 1 [ 13−2 (1.3 )−1.04 ]=0.936
10 10

[ ][ ]
x (1 ) 1.3
New values are: y (1 ) = 1.04
( 1)
z 0.936

Iteration 2:
1
x (2 )= [ 13−2 y (1 )−z (1) ]= 1 [13−2 ( 1.04 )− ( 0.936 ) ]=0.9984
10 10

1
y (2 )= [ 13−2 x (2) −z (1) ]= 1 [ 13−2 ( 0.9984 ) −0.936 ]= 1.00672
10 10

1
(2)
z = [ 13−2 x (2)− y (2) ]= 1 [13−2 ( 0.9984 ) −1.00672 ]=0.9996
10 10

[ ][ ]
x (2 ) 0.9984
New values are: y (2 ) = 1.00672
( 2)
z 0.9996

Proceeding till 3rd iteration, (exam point of view)

This problem goes till 5th iteration, and then the values gets repeated...therefore we stop iterating
further.

[ ][ ][]
x (5 ) x (6 ) 1
y ( 5 ) = y ( 6) = 1
( 5) ( 6)
z z 1

Hence, the solution set.

Note:

When the two set of iterations remain the same, we can terminate the procedure.

LU Decomposition Method:

Given matrix A is decomposed into Upper and Lower triangular matrix

A=LU

Therefore, the given system of equations AX=B⇒ ( LU ) X=B

Where

[ ] [ ]
1 0 0 U 11 U 12 U 13
L= L21 1 0 ∧U = 0 U 22 U 23
L31 L32 1 0 0 U 33

Procedure for Solving system of equations using LU Decomposition method;

1. AX=B⇒ ( LU ) X=B ⇒ L ( UX )=B

2. Take Y =UX ⇒ LY =B. Using Forward Substitution, we solve this system to get the solution of Y
.

3. Atlast, Using Backward Substitution solve for UX =Y . Here we get the solution for X .
Unit 2

Numerical Differentiation, Numerical Integration and Ordinary Differential Equations

Numerical Differentiation

Usual representation of a derivative for a given function f ( x )

'
f ( x 0 +h ) −f ( x 0 ) f ( x 0 +h ) −f ( x 0 )
f ( x 0 )=lim =lim
h→0 x 0 +h−x 0 h →0 h

Where x 0 +h= x1

x 0−2 h x 0−h x0 x 0 +h x 0 +2 h

Taylor series expansion for the functions f ( x 0 +h ) & f ( x 0 +h )

2 3
h ' h '' h ' ''
f ( x 0 +h )=f ( x 0 )+ f ( x0 ) + f ( x 0 ) + f ( x 0 )+ …
1! 2! 3!
2 3
h ' h '' h ' ''
f ( x 0 −h ) =f ( x 0 )− f ( x 0 ) + f ( x 0 )− f ( x 0 ) +…
1! 2! 3!

Forward Difference derivative formula

'
f ( x0 + h )−f ( x 0 ) h ''
f ( x 0 )= − f (ξ )
h 2

where x 0 <ξ < x 0+ h

Backward Difference derivative formula

'
f ( x0 ) −f ( x 0 −h ) h ''
f ( x 0 )= − f (ξ )
h 2

Three point mid-point formula

'
f ( x0 + h )−f ( x 0−h ) 2
h ' ''
f ( x 0 )= − f (ξ )
2h 6

where x 0−h< ξ< x0 + h

Three point End-point formula


'
−3 f ( x 0 ) + 4 f ( x0 + h )−f ( x 0+ 2h ) h2 ' ' '
f ( x 0 )= + f (ξ )
2h 6

where x 0 <ξ < x 0+ 2 h

Note:

Actual error is given by Functional value – tabulated/computed value

Second derivative Mid-point formula

(proof for 5 marks)

Extrapolation

Differentiation using Extrapolation

N 2 ( h )=N 1 ( h2 )+[ N ( h2 )−N ( h ) ]


1 1

General approximation formula for O ( h2 j )

(10 marks)

N j ( h )=N j −1 () h
2
+ [ N j−1 ( h2 )−N
4 j −1−1
j−1 ( h)
]
Numerical Integration
Definite integrals:
b

∫ f ( x ) dx=F ( b ) −F (a)
a

Perform numerical integration using

1. Trapezoidal rule and composite trapezoidal rule


2. Simpson’s one-third rule and composite Simpsons one-third rule

x x0 x1 x2 x3 x4

y=f (x ) y0 y1 y2 y3 y4

Trapezoidal rule

b xn 3
h h h ''
∫ f ( x ) dx=∫ f ( x ) dx = 2
[ ∑ of first∧last ordinate ] = [ y 0 + y n ]− f ( ξ )
2 12
a x0

b−a
where x 0 <ξ < x n and h=
n

Composite Trapezoidal rule


b xn
h h
∫ f ( x ) dx=∫ f ( x ) dx = 2 [ ∑ of first∧last ordinate+2 ( remaining ordinates ) ]= 2 [ y 0+ y n+ 2 ( y 1+ y 2 + y 3 +…+ y n−
a x0

b−a
Where h=
n

Simpson’s 1/3rd rule

b xn
h h
∫ f ( x ) dx=∫ f ( x ) dx = 3 [ ∑ of first∧last ordinate+ 4 ( remaining ordinates ) ]= 3 [ y 0+ y n+ 4 ( y1 + y 2 + y 3 +…+ y n
a x0

b−a
where x 0 <ξ < x n and h=
n

Composite Simpson’s rule

b xn
h h
∫ f ( x ) dx=∫ f ( x ) dx = 3 [ ∑ of first∧last ordinate+ 4 (∑ of odd ordinates )+2 (∑ of even ordinates ) ]= 3 ¿
a x0

b−a
where x 0 <ξ < x n and h=
n

Problem (Example 4.4 – pg no:92 in SLM)


2
Evaluate ∫ x e dx using (i) Composite Trapezoidal rule taking n=4 (ii) Composite Simpson’s rule
3 x

−2
taking n=4 and verify by actual integration.
Solution:

Here a=−2 , b=2 and y=f ( x )=x 3 e x

where x 0=−2 , x 4=2

b−a 2−(−2 )
length∨space width ,h= = =1
n 4

x x0 x1 x2 x3 x4

y=f (x ) y0 y1 y2 y3 y4

x −2 −1 0 1 2

y=f (x ) −1.0826 0.3678 0 2.718 59.112

Since y=f ( x )=x 3 e x

3 −2
f (−2 )=(−2 ) e =−1.0826
3 −1
f (−1 )=(−1 ) e =0.3678

f ( 0 )=0
3 1
f ( 1 ) =( 1 ) e =2.718
3 2
f ( 2 )=( 2 ) e =59.112

Composite Trapezoidal rule

b x4
h h 1
∫ f ( x ) dx=∫ f ( x ) dx = 2 [ ∑ of first∧last ordinate+2 ( remaining ordinates ) ]= 2 [ y 0+ y 4 +2 ( y 1 + y 2+ y 3 ) ]= 2 [−1
a x0

Composite Simpson’s rule

b x4
h 1
∫ f ( x ) dx=∫ f ( x ) dx = 3 [ y 0 + y 4 + 4 ( y 1 + y 3 ) +2 ( y 2 ) ]= 3 [−1.0826+59.112+ 4 ( 0.3678+ 2.718 ) +2 ( 0 ) ]=23.457
a x0

Actual integral value

Bernoulli s rule :∫ udv =uv−u v 1 +u v 2−u v 3 +…


' ' '' ' ''

'
Bernoulli s rule isthe extension of Integration by parts
where Integration by parts=∫ udv=uv−∫ vdu

∫ x 3 e x dx=? ? ? ?
−2

Hint: The variable which vanishes can be taken as u... and the remaining can be dv
3 x
u=x , dv=e dx

u =3 x , v=∫ e dx=e
' 2 x x

u =6 x , v 1=∫ e dx=e
'' x x

u =6 , v 2=∫ e dx=e
' '' x x

u( 4 )=0 , v 3=∫ e dx=e


x x

2
2 2
∫ udv =∫ x 3 e x dx=uv −u' v 1+u '' v 2−u' ' ' v3 + …=[ x 3 e x −3 x 2 e x +6 x e x −6 e x ]−2 ={e x [ x 3−3 x2 +6 x−6 ] }−2={e 2 [ 8−
−2

Conclusion:

Actual integral value ¿ 19.908

Composite Trapezoidal rule ¿ 32.1

Composite Simpon’s rule ¿ 23.457

Comparing, Composite Simpon’s rule gives approximate integral value.

Numerical solutions of ordinary Differential equations

Differential equation:

dy
=f ( x , y )
dx

with initial condition: y ( x 0 )= y 0

Differential equation along with the initial conditions are called IVP (Initial value problem) (2 marks)

Given a table:

x x0 x1 x2 x3 x4

y=f (x ) y0 y1 y2 ? ?
(i) Find y 3 Euler’s method (ii) Find y 4 Corrector method.

Methods:

1. Euler’s method

2. Taylor’s series method of fourth order

3. Runke Kutta (R-K) method of fourth order

4. Predictor and Corrector method

Euler’s method

Iterative formula:

y i+ 1= y i+ hf ( xi , y i ) , where x i+ 1=x i+ hi=0 ,1 , 2 , …

Taylor’s series method of fourth order


2 3
h ' h ' ' h '' '
y i+ 1= y i+ yi + y i + y i + … where xi +1=x i+ h i=0 , 1, 2 , …
1! 2! 3!

Runke Kutta (R-K) method of fourth order

1
k= [ k + 2 ( k 2+ k 3 ) + k 4 ]
6 1

y i+ 1= y i+ k

Predictor and Corrector method


Problem 1:

Solve the IVP (Initial value problem): y ' =t + y ,0 ≤ t ≤ 0.2 , y ( 0 )=1 with h=0.1

1. Find y 1 using Euler’s method

2. Find y 2 Taylor’s series method of fourth order

Solution:

Given:
'
y =t + y ,0 ≤ t ≤ 0.2 , y ( 0 )=1 with h=0.1

where y ' =f (t , y )=t+ y

t t 0=0 t 1=0.1 t 2=0.2

y=f (t ) y 0=1 y 1=? y 2=?

( t 0 , y 0) = ( 0 , 1 )
1. Euler’s method

To find y 1:

Iterative formula:

y i+ 1= y i+ hf ( t i , y i ) , wheret i+1=t i +h i=0 , 1 ,2 , …

Given: f ( t , y )=t+ y

To find y 1:

Put i=0 y 1= y 0 + hf ( t 0 , y 0 )=1+0.1 f ( 0 , 1 )=1+ 0.1 ( 1 ) =1.1

y 1=1.1
Answer: ( t 1 , y 1 )= ( 0.1 ,1.1 )

2. Taylor’s series method:


2 3
h ' h ' ' h '' '
y i+ 1= y i+ yi + y i + y i + … where xi +1=x i+ h i=0 , 1, 2 , …
1! 2! 3!

To find y 2:

Put i=1
2 3
h ' h '' h ' ''
y 2= y 1 + y 1 + y 1 + y 1 +…
1! 2! 3!

( t 1 , y 1 )= ( 0.1 ,1.1 )
' '
Given: y =t + y y =0.1+1.1=1.2
'' ' ''
y =1+ y y =1+1.2=2.2
' '' '' ' ''
y =y y =2.2
(4) '' ' (4)
y =y y =2.2

2 3 4
0.1
y 2=1.1+ ( 1.2 ) + 0.1 ( 2.2 ) + 0.1 ( 2.2 ) + 0.1 ( 2.2 ) + …
1! 2! 3! 4!

Truncating till 2nd derivative:


2
0.1
y 2=1.1+ ( 1.2 ) + 0.1 ( 2.2 )=1.1+0.12+ 0.011=1.231
1! 2!

( t 2 , y 2 ) =( 0.2 ,1.231 )
Answer:

t t 0=0 t 1=0.1 t 2=0.2

y=f (t ) y 0=1 y 1=1.1 y 2=1.231

Problem 2:

Solve the IVP (Initial value problem): y ' =t + y ,0 ≤ t ≤ 0.4 , y ( 0 )=1 with h=0.1

1. Find y 3 Runke Kutta (R-K) method of fourth order

2. Find y 4 Predictor and Corrector method


Solution:

t t 0=0 t 1=0.1 t 2=0.2 t 3=0.3 t 4=0.4

y=f (t ) y 0=1 y 1=1.1 y 2=1.231 y 3=? y 4 =?

Runke Kutta (R-K) method of fourth order

1
k= [ k + 2 ( k 2+ k 3 ) + k 4 ]
6 1

To find y 3:

Given: f ( t , y )=t+ y

We know from table: ( t 0 , y 0) =( 0 , 1 ) ; ( t 1 , y 1 )= ( 0.1 ,1.1 ) ; ( t 2 , y 2 ) =( 0.2 ,1.231 )

k 1=hf ( t 2 , y 2 )=0.1 f ( 0.2 , 1.231 )=0.1 ( 0.2+1.231 )=0.1431

( h k
)
k 2=hf t 2 + , y 2+ 1 =0.1 f ( 0.2+0.05 ,1.231+0.0715 )=0.1 f ( 0.25 , 1.3025 )=0.15525
2 2

( h k2
)
k 3=hf t 2 + , y 2 + =0.1 f ( 0.2+ 0.05 ,1.231+0.0077 )=0.1 f ( 0.25 , 1.2387 )=0.14887
2 2

k 4=hf ( t 2 +h , y 2+ k 3 )=0.1 f ( 0.3 ,1.37987 )=0.16798

1 1
k=
6
[ k 1+ 2 ( k 2+ k 3 ) + k 4 ] = [ 0.1431+2 ( 0.15525+0.14887 )+ 0.16798 ] =0.15322
6

y i+ 1= y i+ k

Put i=2, y 3= y2 + k=1.231+0.15322=1.38422

( t 3 , y 3 ) =( 0.3 , 1.38422 )
Predictor- corrector method:

To find y 4 :

Milne’s Predictor method


Put i=3

4h
y4= y0+
3
[ 2 f ( t 1 , y 1 )−f ( t 2 , y 2 ) +2 f ( t 3 , y 3 ) ]
We know from table:

( t 0 , y 0) =( 0 , 1 ) ; ( t 1 , y 1 )= ( 0.1 ,1.1 ) ; ( t 2 , y 2 ) =( 0.2 ,1.231 ) ; ( t 3 , y 3 ) =( 0.3 , 1.38422 )


Given: f ( t , y )=t+ y

Therefore,

4 ( 0.1 )
y 4 =1+
3
[2 f ( 0.1, 1.1 )−f ( 0.2 ,1.231 ) +2 f ( 0.3 ,1.38422 ) ]

y 4 , p=1+0.13333 [ 4.33744 ] =1.5783

Hence, ( t 4 , y 4 ) =( 0.4 , 1.5783 )

Simpson’s Corrector method:

We know by predictor method,

y 4 , p=1+0.13333 [ 4.33744 ] =1.5783

Now Put i=3 in corrector formula,

We get,

h
y 4 ,c = y 2 +
3
[ f ( t 4 , y 4 , p ) + 4 f ( t3 , y 3 )+ f ( t 2 , y 2 ) ]

We know from table:

( t 0 , y 0) =( 0 , 1 ) ; ( t 1 , y 1 )= ( 0.1 ,1.1 ) ; ( t 2 , y 2 ) =( 0.2 ,1.231 ) ; ( t 3 , y 3 ) =( 0.3 , 1.38422 ) and


y 4 , p=1+0.13333 [ 4.33744 ] =1.5783
h 0.1
y 4 ,c = y 2 +
3
[ f ( t 4 , y 4 , p ) + 4 f ( t 3 , y 3 )+ f ( t 2 , y 2 ) ] =1.231+
3
[ f ( 0.4 , 1.5783 ) + 4 f ( 0.3 , 1.38422 ) + f ( 0.2, 1.231 ) ]

¿ 1.231+0.0333 [ 1.9783+6.7363+1.431 ]=1.5688

Therefore,

y 4 ,c =1.5688

Complete answer is

t t 0=0 t 1=0.1 t 2=0.2 t 3=0.3 t 4=0.4

y=f (t ) y 0=1 y 1=1.1 y 2=1.231 y 3=1.38422 y 4 ,c =1.5688

You might also like