Вы находитесь на странице: 1из 12

NEWTON-RAPHSON FORMULA FOR OBTAINING AN APPROXIMATE ROOT OF AN

EQUATION

Non-linear equations
𝑃𝑛 (𝑥) = 𝑎0 𝑥 0 + 𝑎1 𝑥1 + 𝑎2 𝑥 2 + ⋯ ⋯ + 𝑎𝑛−1 𝑥 𝑛−1 + 𝑎𝑛
𝑤ℎ𝑒𝑟𝑒 𝑎0 , 𝑎1 , 𝑎2 , ⋯ ⋯ 𝑎𝑛 are constants independent of 𝑥, 𝑛 is a positive integer
is called a polynomial of degree 𝑛. (provided 𝑎0 ≠ 0)
If 𝑥 = 𝛼, then 𝑃𝑛 (𝑥) = 𝑃𝑛 (𝛼) = 0.
𝛼 is called a zero of the polynomial
𝑃𝑛 (𝑥) has exactly 𝑛 zeros.
{Geometrically, zeros are points/values where 𝑃𝑛 (𝑥) crosses the 𝑥-axis}
Numerical methods of approximating the root
The root can be approximated by:
I. Direct methods:- yields exact solution in a finite number of elementary arithmetic
operations
II. Iterative methods:- involves assumptions of an initial approximation and finding suitable
algorithm approach to successively better approximation
1
e.g. 𝑥𝑛+1 = 2 (𝑥𝑛2 + 1)
such methods includes: bracketing methods (Bisection, False position etc)
& open methods (Newton-raphson method, secant methods etc)
Let 𝑓(𝑥) = 0, if 𝑓(𝛼) = 0, then 𝛼 is a root of 𝑓(𝑥) = 0.
Approximating the root 𝛼 has two stages:
a) Isolating the root i.e. finding the smallest possible interval (𝑎, 𝑏) containing one and only
one root of 𝑓(𝑥) = 0,
b) Improving the value of the approximate roots to the specified degree of accuracy.
If 𝑓(𝑥) is continous and 𝑓(𝑎) ∙ 𝑓(𝑏) < 0, then 𝑓(𝑥) = 0 has at least one real root in the interval
(𝑎, 𝑏).

Newton-Raphson method
Given an approximate value of a root of an equation, a better and closer approximation to the
root can be found by this iterative method.
Let 𝑟 be a zero of 𝑓(𝑥) = 0 and let 𝑥 be an approximation to 𝑟. Then 𝑟 = 𝑥 + ℎ, where ℎ is very
small, positive or negative. If 𝑓 ′′ exists and is continous, then by Taylor’s theorem
ℎ2
𝑓(𝑟) = 0 = 𝑓(𝑥 + ℎ) = 𝑓(𝑥) + ℎ𝑓 ′ (𝑥) + 𝑓 ′′ (𝑥) + ⋯ ⋯ (ℎ = 𝑟 − 𝑥)
2
If ℎ is small, neglecting ℎ2 , ℎ3 , ⋯ ⋯ 𝑒𝑡𝑐, we get
𝑓(𝑥) + ℎ𝑓 ′ (𝑥) ≈ 0
−𝑓(𝑥)
ℎ≈ ′ 𝑖𝑓 𝑓 ′ (𝑥) ≠ 0
𝑓 (𝑥)
𝑓(𝑥)
∴𝑟 =𝑥+ℎ =𝑥− ′
𝑓 (𝑥)
𝑓(𝑥)
Let this value be 𝑥1 , ∴ 𝑥1 = 𝑥 − (a better approximate root than 𝑥)
𝑓′ (𝑥)
𝑓(𝑥)
Starting with 𝑥1 we get 𝑥2 = 𝑥1 − 𝑓′ (𝑥) which is even better.
Continuing like this, we iterate until |𝑥1+1 − 𝑥1 | is less than the quantity desired.

𝑓(𝑥𝑛 )
∴ 𝑥𝑛+1 = 𝑥𝑛 − , 𝑛 = 0,1,2, ⋯ ⋯
𝑓 ′ (𝑥𝑛 )

Dedan Kimathi University of technology Page 1 of 12


This is the iterative formula of Newton’s method.

EXERCISES
1. Find the positive root of 𝑓(𝑥) = 2𝑥 3 − 3𝑥 − 6 = 0 by Newton-Raphson method correct to
five decimal places. [1.783769]
2. Find the real positive root of 3𝑥 − cos 𝑥 − 1 = 0 by Newton’s method correct to 6 decimal
places. [0.607102]
3. Find the root of 4𝑥 − 𝑒 𝑥 = 0 that lies bet5ween 2 and 3. [2.1533]
4. Determine the highest real root of 𝑓(𝑥) = 2𝑥 3 − 11.7𝑥 2 + 17.7𝑥 − 5 by Newton-Raphson
method using three iterations with an initial guess of 𝑥0 = 3.
5. Find by Newton_Raphson method the real root of 3𝑥 − Cos 𝑥 − 1 = 0 given that a root lies
between 0 and 1, correct to 5 decimal places.
6. The equation 3 tan 3𝑥 = 3𝑥 + 1 is found to have a root near 𝑥 = 0.9, 𝑥 being is radians. Find
the root by Newton-Raphson method. (correct to .... decimal places)
7. Find by Newton-Raphson method the real root of the equation 𝑥 − 𝑒 −𝑥 = 0 which lies in the
interval (0,1).

NUMERICAL SOLUTION OF ORDINARY DIFFERENTIAL EQUATIONS


Introduction
The most general form of an 𝑛𝑡ℎ order ODE is
𝜙(𝑥, 𝑦, 𝑦 ′ , 𝑦 ′′ , ⋯ , 𝑦 (𝑛) ) = 0 − − − − − 〈1〉
The general solution of 〈1〉 is a relation between 𝑦, 𝑥 and 𝑛 arbitrary constants which satisfies the
equation and is of the form:
𝑓(𝑥, 𝑦, 𝑐1 , 𝑐2 , ⋯ , 𝑐𝑛 ) = 0 − − − − − −〈2〉
If particular values of 𝑐1 , 𝑐2 , ⋯ , 𝑐𝑛 are given, then 〈2〉 becomes a particular solution. (for this to be
obtained, 𝑛 conditions must be given).
If all the 𝑛 conditions are specified the problem is caked an Initial Value Problem, IVP.
Where solutions cannot be obtained by analytical methods we resort to numerical methods.
Solution of first degree, first order ODE.
General form of a first order first degree ODE is:

𝑑𝑦
= 𝑓(𝑥, 𝑦)
𝑑𝑥 - - - - - - - - - - - - - - 〈3〉
With (ICs)
The equation together with the ICs is
{ }
𝑦(𝑥0 ) = 𝑦0 called an Initial Value Problem, IVP.
Or 𝑦 = 𝑦0 at 𝑥 = 𝑥0

There are two categories of methods for solving ODEs:


1) The One-Step Methods or Single-Step Methods
This category includes the Picard’s method of successive approximation, and the Taylor Series
method
2) The Step-by Step Methods or Marching Methods
This category includes the Euler’s and the Modified Euler’s methods, the Runge – Kutta method
(2nd and 4th order), Adam – Moulton predictor corrector method, Milne’s predictor corrector
methods etc.

Dedan Kimathi University of technology Page 2 of 12


The General Procedure
Partition the interval [𝑎, 𝑏], on which solution is derived, into a finite number of subintervals by the
points
𝑎 = 𝑥0 < 𝑥1 < 𝑥2 < ⋯ ⋯ < 𝑥𝑛 = 𝑏 called mesh points
Then apply an appropriate method to solve the ODE.
Two Types of Methods
A. Explicit Methods
These methods use an explicit formula for calculating the value of the dependent variable at the
next value of the independent variable.
In explicit methods, the RHS of the equation has all known quantities.
𝑒. 𝑔. 𝑦𝑛+1 = 𝐹(𝑥𝑛 , 𝑥𝑛+1 , 𝑦𝑛 ) Here 𝑥𝑛 , 𝑦𝑛 and 𝑥𝑛+1 are all known
B. Implicit Methods
Equation for 𝑦𝑛+1 has the form 𝑦𝑛+1 = 𝐹(𝑥𝑛 , 𝑥𝑛+1 , 𝑦𝑛 ) where 𝑦𝑛+1 is unknown.
RHS is non-linear. Therefore the equation must be solved for 𝑦𝑛+1 using suitable numerical
methods.
NB: Implicit Methods give better accuracy over explicit methods at the expense of additional effort.

I. Taylor Series Method

Consider the differential equation,


𝑑𝑦
= 𝑓(𝑥, 𝑦), with 𝑦(𝑥0 ) = 𝑦0 − − − − − 〈1〉
𝑑𝑥
Let 𝑦 = 𝑦(𝑥) be a continuously differentiable function satisfying 〈1〉. Expanding 𝑦 in terms of
Taylor’s Series around the point 𝑥 = 𝑥0 , we obtain,
(𝑥 − 𝑥0 ) ′ (𝑥 − 𝑥0 )2 ′′
𝑦 = 𝑓(𝑥) = 𝑓(𝑥0 ) + 𝑓 (𝑥0 ) + 𝑓 (𝑥0 ) + ⋯
1! 2!
Which may be written as
(𝑥 − 𝑥0 ) ′ (𝑥 − 𝑥0 )2 ′′
𝑦 = 𝑓(𝑥) = 𝑦0 + 𝑦0 + 𝑦0 + ⋯
1! 2!
Putting 𝑥 = 𝑥1 = 𝑥0 + ℎ, we get
ℎ ′ ℎ2 ′′ ℎ3 ′′′
𝑓(𝑥1 ) = 𝑦1 = 𝑦0 + 𝑦 + 𝑦 + 𝑦0 + ⋯
1! 0 2! 0 3!
Similarly, we obtain
ℎ ′ ℎ2 ′′ ℎ3 ′′′
𝑦𝑛+1 = 𝑦𝑛 + 𝑦𝑛 + 𝑦𝑛 + 𝑦𝑛 + ⋯ − − − − − 〈2〉
1! 2! 3!
Equation 〈2〉 may be written as
ℎ2 ′′
𝑦𝑛+1 = 𝑦𝑛 + ℎ𝑦𝑛′ + 𝑦 + 𝒪(ℎ3 ) − − − − − 〈3〉
2! 𝑛
where 𝒪(ℎ3 ) denotes all terms containing third and higher powers of ℎ.
NB: The method is applicable only when the derivatives of 𝑓(𝑥, 𝑦) exist and the value of (𝑥 − 𝑥0 )
in the expansion of 𝑦 = 𝑓(𝑥) near 𝑥0 must be small so that the series converges.
Examples

Dedan Kimathi University of technology Page 3 of 12


𝑑𝑦
1) Use 5th degree Taylor method to solve = 𝑦 − 𝑥 2 with 𝑦 = 1 when 𝑥 = 0 and find the value
𝑑𝑥
of 𝑦(0.1) and 𝑦(0.2) with ℎ = 0.1.
Solution
𝑥0 = 0, 𝑦0 = 1
𝑦′ = 𝑦 − 𝑥2 ⇒ 𝑦0′ = 1 − 0 = 1
𝑦 ′′ = 𝑦 ′ − 2𝑥 ⇒ 𝑦0′′ = 𝑦0′ − 2𝑥0 = 1
𝑦 ′′′ = 𝑦 ′′ − 2 ⇒ 𝑦0′′′ = 𝑦0′′ − 2 = −1
(4) (3)
𝑦 (4) = 𝑦 (3) ⇒ 𝑦0 = 𝑦0 = −1
(5) (4)
𝑦 (5) = 𝑦 (4) ⇒ 𝑦0 = 𝑦0 = −1
Substituting these values in the equation
ℎ2 ′′ ℎ3 ′′′ ℎ4 (4) ℎ5 (5)
𝑦1 = 𝑦0 + ℎ𝑦0′ + 𝑦 + 𝑦0 + 𝑦0 + 𝑦0
2! 0 3! 4! 5!
0.12 0.13 0.14 0.15
= 1 + 0.1(−1) + (−1) + (−1) + (−1) + (−1)
2 6 24 120
= 1.104829083
∴ 𝑦1 = 𝑦(0.1) = 1.104829083
To compute 𝑦2 = 𝑦(0.1), take 𝑦1 = 1.104829083 and 𝑥1 = 0.1. Then
𝑦1′ = 𝑦1 − 𝑥12 = 1.104829083 − 0.12 = 1.094829
𝑦1′′ = 𝑦1′ − 2𝑥1 = 1.104829083 − (2 × 0.1) = 0.894829
𝑦1′′′ = 𝑦1′′ − 2 = 1.104829083 − 2 = −1.105171
(4)
𝑦1 = 𝑦1′′′ − 𝑥12 = −1.105171
(5) (4)
𝑦1 = 𝑦1 − 𝑥12 = −1.105171
0.12 0.13
𝑦2 = 1.104829083 + 0.1(1.094829) + (0.894829) + (−1.105171)
2 6
4 5
0.1 0.1
+ (−1.105171) + (−1.105171)
24 120
= 1.218597236
2) Solve 𝑦 ′ = 𝑥 + 𝑦 2 , 𝑦(0) = 1 at 𝑦(0.1) using Taylor Series of 3rd degree.
𝑑𝑦
3) Solve for 𝑦(0.1) in 𝑑𝑥
= 𝑥 2 + 𝑦 2 and 𝑦(0) = 1 using Taylor Series method, correct to four
decimal places.
𝑑𝑦
4) Using Taylor Series method, find 𝑦 at 𝑥 = 0.1(0.1)0.4 given 𝑑𝑥 = 𝑥 2 − 𝑦, 𝑦(0) = 1 correct to
4 d.p. using the 4th order method.

{Ans: 𝑦(0.1) = 0.905125, 𝑦(0.2) = 0.821239, 𝑦(0.3) = 0.7492, 𝑦(0.4) = 0.6897}

STEP BY STEP METHODS OR MARCHING METHODS

In the step by step methods, 𝑦𝑛+1 is calculated from an explicit formula. This means that multi-step
methods are used e.g. if three points are used,
𝑦𝑛+1 = 𝐹(𝑥𝑛−2 , 𝑦𝑛−2 , 𝑥𝑛−1 , 𝑦𝑛−1 , 𝑥𝑛 , 𝑦𝑛 , 𝑥𝑛+1 ) − − − − − − 〈1〉

Dedan Kimathi University of technology Page 4 of 12


Equation 〈1〉 is in explicit form (since all quantities on the RHS are known). In implicit multi-step
methods, the unknown 𝑦𝑛+1 appears on both sides of the equation.
a) EULER’S METHOD,
Consider the first order ODE
𝑑𝑦
= 𝑓(𝑥, 𝑦)
𝑑𝑥 } − − − − − − − − 〈2〉
𝑦(𝑥0 ) = 𝑦0
Let 𝑦 = 𝐹(𝑥) be the solution of 〈2〉 satisfying initial conditions.
Then,
𝑑𝑦 ∆𝑦
= lim
𝑑𝑥 ∆𝑥→0 ∆𝑥
For a small curve 𝑦 = 𝐹(𝑥) ⇒ it is almost a straight line. Hence,
𝑑𝑦
∆𝑦 ≈ ∆𝑥 for small ∆𝑥
𝑑𝑥
= 𝑓(𝑥, 𝑦)∆𝑥
= ℎ𝑓(𝑥, 𝑦)
𝑦1 𝑥1
Thus, ∫ 𝑑𝑦 = ∫ 𝑓(𝑥, 𝑦)𝑑𝑦
𝑦0 𝑥0
𝑥1
or, 𝑦1 = 𝑦0 + ∫ 𝑓(𝑥, 𝑦)𝑑𝑦
𝑥0

Replacing 𝑓(𝑥, 𝑦) by the approximation 𝑓(𝑥0 , 𝑦0 ), we get


𝑥1
𝑦1 = 𝑦0 + ∫ 𝑓(𝑥0 , 𝑦0 )𝑑𝑦 = 𝑦0 + (𝑥1 − 𝑥0 )𝑓(𝑥0 , 𝑦0 ) for 𝑥 = 𝑥1
𝑥0

Thus,
𝑦1 = 𝑦0 + ℎ𝑓(𝑥0 , 𝑦0 ) + 𝑅 for 𝑥 = 𝑥1 − − − − − − − 〈3〉
Where 𝑅 is the error due to approximation (Truncation error)
𝑑𝑦
𝑦1 = 𝑦0 + ℎ ( ) = 𝑦0 + ℎ𝑓(𝑥0 , 𝑦0 )
𝑑𝑥 0
and
𝑦2 = 𝑦1 + ℎ𝑓(𝑥1 , 𝑦1 )
𝑦3 = 𝑦2 + ℎ𝑓(𝑥2 , 𝑦2 )

∴ 𝑦𝑛+1 = 𝑦𝑛 + ℎ𝑓(𝑥𝑛 , 𝑦𝑛 )

The methods drawbacks are:


1) If ℎ is small, Euler’s method is slow and if ℎ is large, the method is inaccurate.
2) Accuracy is limited by the length of the step, ℎ.
3) The method is slow and has limited accuracy.

Examples

Dedan Kimathi University of technology Page 5 of 12


1) Using Euler method solve the initial value problem 𝑦 ′ = 2𝑥 + cos 𝑦, 𝑦(0) = 1 for 𝑦(0.1)
correct to 6 decimal places.
Solution
𝑥0 = 0, 𝑦0 = 1 and 𝑥1 = 0.1
The Euler method is given by
𝑦𝑛+1 = 𝑦𝑛 + ℎ𝑓(𝑥𝑛 , 𝑦𝑛 )
𝑦1 = 𝑦0 + ℎ𝑓(𝑥0 , 𝑦0 )
= 1 + 0.1{2(0) + cos(1)}
= 1.05403023
𝑑𝑦 1
2) Solve the differential equation 𝑑𝑥
= 3𝑥 + 2 𝑦, 𝑦(0) = 1 for 𝑥 = 0: 0.1: 0.5. compare with the
exact solution given by 𝑦(𝑥) = 13𝑒 𝑥⁄2 − 6𝑥 − 12.
𝑑𝑦
3) Obtain a numerical solution of the differential equation 𝑑𝑥
= 3(1 + 𝑥) − 𝑦 given the initial
conditions 𝑦(1) = 4 for 𝑥 = 1.0(0.2)2.0.
𝑑𝑦 𝑦−𝑥
4) Given 𝑑𝑥
= 𝑦+𝑥 with 𝑦(0) = 1, find approximately the value of 𝑦 for 𝑥 = 0.1 by Euler’s
method (in five steps).

b) MODIFIED EULER’S METHOD,


By taking 𝑦 (1) as a new variable, then
𝑑𝑦
= 𝑦 (1) − − − − − 〈1〉
𝑑𝑥
and 𝑦 (1) = 𝑓(𝑥, 𝑦)
Integrating 〈1〉 from 𝑥𝑛 to 𝑥𝑛+1 we have
𝑥𝑛+1 𝑥𝑛+1
𝑑𝑦
∫ 𝑑𝑥 = ∫ 𝑦 (1) 𝑑𝑥
𝑥𝑛 𝑑𝑥 𝑥𝑛
𝑥𝑛+1
or 𝑦𝑛+1 = 𝑦𝑛 + ∫ 𝑦 (1) 𝑑𝑥
𝑥𝑛
(1)
with 𝑦𝑛 = 𝑓(𝑥𝑛 , 𝑦𝑛 )
using the trapezoidal rule, we obtain
ℎ (1) (1)
𝑦𝑛+1 ≈ 𝑦𝑛 + (𝑦𝑛 + 𝑦𝑛+1 )
2

𝑦𝑛+1 = 𝑦𝑛 + {𝑓(𝑥𝑛 , 𝑦𝑛 ) + 𝑓(𝑥𝑛+1 , 𝑦𝑛+1 )} + 𝑅 − − − − 〈2〉
2
where 𝑅 is the error due to an approximation of the integral.
Procedure
First 𝑦𝑛 is obtained by unmodified Euler’s formula 𝑦𝑛 = 𝑦𝑛−1 + ℎ𝑓(𝑥𝑛−1 , 𝑦𝑛−1 ) and then
substituted into 〈2〉.
(0)
𝑖. 𝑒. 𝑦1 = 𝑦0 + ℎ𝑓(𝑥0 , 𝑦0 ) by Euler ′ sformula
(1) ℎ (0)
⇒ 𝑦1 = 𝑦0 + {𝑓(𝑥0 , 𝑦0 ) + 𝑓(𝑥1 , 𝑦1 )}
2
(2) ℎ (1)
Similarly, 𝑦1 = 𝑦0 + 2 {𝑓(𝑥0 , 𝑦0 ) + 𝑓(𝑥1 , 𝑦1 )}

Dedan Kimathi University of technology Page 6 of 12


(3) ℎ (2)
𝑦1 = 𝑦0 + {𝑓(𝑥0 , 𝑦0 ) + 𝑓(𝑥1 , 𝑦1 )}
2
(4) ℎ (3)
𝑦1 = 𝑦0 + {𝑓(𝑥0 , 𝑦0 ) + 𝑓(𝑥1 , 𝑦1 )}
2

and so on. Therefore,


(𝑛+1) ℎ (𝑛)
𝑦1 = 𝑦0 + {𝑓(𝑥0 , 𝑦0 ) + 𝑓(𝑥1 , 𝑦1 )} 𝑛 = 0,1 2,3, ⋯ − − − − 〈3〉
2
(𝑛)
where 𝑦1 is the 𝑛𝑡ℎ approximation of 𝑦1 .
(𝑛) (𝑛−1)
The formula 〈3〉 is terminated at each step if the condition |𝑦1 − 𝑦1 | < 𝜖, where 𝜖 is a very
small arbitrary value selected depending on the level of accuracy to be accomplished is satisfied.
(𝑘)
i.e if 𝑦𝑛 = −𝑦1
Examples
1) Using modified Euler method solve the initial value problem 𝑦 ′ = 2𝑥 + cos 𝑦, 𝑦(0) = 1 for
𝑦(0.1) correct to 6 decimal places.
Solution
The modified Euler method is given by

𝑦𝑛+1 = 𝑦𝑛 + {𝑓(𝑥𝑛 , 𝑦𝑛 ) + 𝑓(𝑥𝑛+1 , 𝑦𝑛+1 )} i. e.
2
(1) ℎ (0)
𝑦1 = 𝑦0 + {𝑓(𝑥0 , 𝑦0 ) + 𝑓 (𝑥1 , 𝑦1 )}
2
By unmodified Euler’s formula,
(0)
= 𝑦0 + ℎ𝑓(𝑥0 , 𝑦0 ) = 1 + 0.1{2(0) + cos(1)} = 1.05403023
𝑦1
(1) 0.1 (0)
𝑦1 = 1 + {(2(0) + cos(1)) + (2(0.1) + cos (𝑦1 ))} = 1.06171867
2
(2) 0.1 (1)
𝑦1 = 1 + {2(0) + cos(1) + (2(0.1) + cos (𝑦1 ))} = 1.061383719
2
(3) 0.1 (2)
𝑦1 = 1 + {2(0) + cos(1) + (2(0.1) + cos (𝑦1 ))} = 1.061398341
2
(4) 0.1 (3)
𝑦1 = 1 + {2(0) + cos(1) + (2(0.1) + cos (𝑦1 ))} = 1.061397703
2
∴ 𝑦(0.1) = 1.061398
𝑑𝑦
2) Use the modified Euler’s method to solve the differential equation = 𝑥 + 𝑦 2 with 𝑦(0) = 1
𝑑𝑥
and ℎ = 0.1.
𝑑𝑦
3) Obtain a numerical solution of the differential equation 𝑑𝑥
= 3(1 + 𝑥) − 𝑦 given the initial
condition 𝑦(1) = 4 for 𝑥 = 1.0(0.2)2.0.
𝑑𝑦
4) Solve 𝑑𝑥 = 3𝑥 + 0.5𝑦, 𝑦(0) = 1 for 𝑥 = 0: 0.1: 0.5.

c) RUNGE-KUTTA,
Fourth order Runge-Kutta method
𝑑𝑦
Let = 𝑓(𝑥, 𝑦),
𝑑𝑥

Dedan Kimathi University of technology Page 7 of 12


ℎ ≡ steplength and 𝑥0 , 𝑦0 the initial values. Then,
𝑦𝑛+1 = 𝑦𝑛 + ∆𝑦𝑛−1
Where,
𝐾1 = ℎ𝑓(𝑥𝑛 , 𝑦𝑛 )
1 1
𝐾2 = ℎ𝑓 (𝑥𝑛 + ℎ, 𝑦𝑛 + 𝐾1 )
2 2
1 1
𝐾3 = ℎ𝑓 (𝑥𝑛 + ℎ, 𝑦𝑛 + 𝐾2 )
2 2
𝐾4 = ℎ𝑓(𝑥𝑛 + ℎ, 𝑦𝑛 + 𝐾3 )
1
𝑎𝑛𝑑 ∆𝑦𝑛−1 = (𝐾1 + 2𝐾2 + 2𝐾3 + 𝐾4 )
6
The fourth order Runge-Kutta method is most commonly used and is known as Runge-Kutta method
only.
Working rule
𝑑𝑦 1 1
To solve 𝑑𝑥 = 𝑓(𝑥, 𝑦), 𝑦(0) = 𝑦0 , calculate 𝐾1 = ℎ𝑓(𝑥0 , 𝑦0 ), 𝐾2 = ℎ𝑓 (𝑥0 + 2 ℎ, 𝑦0 + 2 𝐾1 ), 𝐾3 =
1 1 1
ℎ𝑓 (𝑥0 + 2 ℎ, 𝑦0 + 2 𝐾2 ), 𝐾4 = ℎ𝑓(𝑥0 + ℎ, 𝑦0 + 𝐾3 ) and ∆𝑦 = 6 (𝐾1 + 2𝐾2 + 2𝐾3 + 𝐾4 ).

Then 𝑦1 = 𝑦0 + ∆𝑦0 . Starting from (𝑥1 , 𝑦1 ) and repeating the process, obtain (𝑥2 , 𝑦2 ) etc
Examples
1. Solve the initial value problem 𝑦 ′ = 𝑒 𝑥 − 𝑦 2 , 𝑦(0) = 1 for 𝑦 at 𝑥 = 0.1 with ℎ = 0.1. Use
fourth order Runge-Kutta method and work with 4 decimal places.
Solution
𝑥0 = 0, 𝑦0 = 1, 𝑓(𝑥, 𝑦) = 𝑒 𝑥 − 𝑦 2 , ℎ = 0.1
2
𝐾1 = ℎ𝑓(𝑥, 𝑦) = 0.1 ∗ {𝑒 − 𝑦0 } = 0.1 ∗ {𝑒 − 12 } = 0
𝑥 0 0

ℎ 𝐾1 ℎ 𝐾1 2
𝐾2 = ℎ𝑓 (𝑥 + , 𝑦 + ) = 0.1 ∗ {𝑒 𝑥0+2 − (𝑦0 + ) } = 0.00513
2 2 2
ℎ 𝐾2 𝑥0 +
ℎ 𝐾2 2
𝐾3 = ℎ𝑓 (𝑥 + , 𝑦 + ) = 0.1 ∗ {𝑒 2 − (𝑦0 + ) } = 0.00461
2 2 2
𝐾4 = ℎ𝑓(𝑥 + ℎ, 𝑦 + 𝐾3 ) = 0.1 ∗ {𝑒 𝑥0 +ℎ − (𝑦0 + 𝐾3 )2 } = 0.00959
1 1
∆𝑦0 = ∗ (𝐾1 + 2𝐾2 + 2𝐾3 + 𝐾4 ) = ∗ (0 + 2 ∗ 0.00513 + 2 ∗ 0.00461 + 0.00959)
6 6
= 0.00485
𝑦1 = 𝑦0 + ∆𝑦0 = 1 + 0.00485 = 1.00485
𝑑𝑦
2. Using Runge-Kutta method, find the approximate value of 𝑦 for 𝑥 = 0.2 if 𝑑𝑥 = 𝑥 + 𝑦 2 , given
that 𝑦 = 1 when 𝑥 = 0, taking ℎ = 0.1.
𝑑𝑦
3. Obtain a numerical solution of the differential equation = 3(1 + 𝑥) − 𝑦 given the initial
𝑑𝑥
condition 𝑦(1) = 4 for 𝑥 = 1.0(0.2)2.0.
𝑑𝑦
4. Solve 𝑑𝑥 = 3𝑥 + 0.5𝑦, 𝑦(0) = 1 for 𝑥 = 0: 0.1: 0.5. An: 𝑦1 = 1.06402422, 𝑦2 =
1.16209365
𝑦 5 1
5. Given 𝑦 ′ = 𝑥 − 2 𝑥 2 𝑦 3, 𝑦(1) = , find 𝑦(2) taking ℎ = 0.25 by Runge-Kutta method.
√2

d) Predictor-Corrector methods

Dedan Kimathi University of technology Page 8 of 12


Multi-step methods
Single-step methods: use only the information from the last step computed. Therefore,
i) Next step can be performed with a different step-size.
ii) Are ideal for beginning the solution where only the initial conditions are available.
With additional information obtained, a multi-step method can be used.
The principle of multi-step
 Utilizes past values of 𝑦 and/or 𝑦 ′ to construct a polynomial that approximates the derivative
function, and extrapolates this into the next interval.
 Most of the methods use equispaced past values to make the construction of the polynomial
easy.
 The number of past points used sets the degree of the polynomial.
 The order of the method is equal to the power of ℎ in the global error term of the formula.
Formula sought:- that uses the information of the function 𝑦 and the derivative 𝑦𝑥′ at the past three
points together with one more old value of the derivative.
First:- Predict 𝑦𝑛+1 , then use a different formula to correct the value.
The correction can be used again to correct the new 𝑦𝑛+1 .
This process can be iterated as many times as we desire.

A predictor formula is used to predict the value of 𝑦 at 𝑥𝑛+1 and a corrector


formula is used to correct the error and to improve that value of 𝑦𝑛+1 .

Disadvantages of Predictor-corrector methods


Not self-starting. Therefore less convenient for computer solution.
Difficult to alter the step size ℎ.
Advantages of Predictor-corrector methods
Tends to be rapid. Use information from previous steps. If the information evaluated in the previous
step have been stored, the methods requires only one new value to be evaluated at each step.
I. Milne’s Predictor-Corrector Formulae

In general,
𝑝 4ℎ ′ ′
𝑦𝑛+1 = 𝑦𝑛−3 + (2𝑦𝑛−2 − 𝑦𝑛−1 + 2𝑦𝑛′ )
3
where 𝑥𝑛−3 < 𝜉1 < 𝑥𝑛+1 is called Milne’s Predictor formulae.

In general,
𝑐
ℎ ′ ′
𝑦𝑛+1 = 𝑦𝑛−1 + (𝑦𝑛−1 − 4𝑦𝑛′ + 𝑦𝑛+1 )
3
where 𝑥𝑛−1 < 𝜉2 < 𝑥𝑛+1 is called Milne’s Corrector formulae.
Examples
1) Use Milne’s method to find 𝑦(4.4) given that 5𝑥𝑦 ′ + 𝑦 2 − 2 = 0, 𝑦(4) = 1, 𝑦(4.1) =
1.0049, 𝑦(4.2) = 1.0097 and 𝑦(4.3) = 1.0143.
Solution

Dedan Kimathi University of technology Page 9 of 12


𝑥0 = 4, 𝑦0 = 1, 𝑥1 = 4.1, 𝑦1 = 1.0049, 𝑥2 = 4.2, 𝑦2 = 1.0097, 𝑥3 = 4.3, 𝑦3
1
= 1.0143, 𝑓(𝑥, 𝑦) = (2 − 𝑦 2 )
5𝑥
𝑝 𝑝
By Milne’s predictor formula, we compute 𝑦𝑛+1 = 𝑦4 with 𝑛 = 3
𝑝 4ℎ
𝑦4 = 𝑦0 + ∗ {2𝑓3 − 𝑓2 + 2𝑓1 } where
3
1 1
𝑓3 = (2 − 𝑦32 ) = (2 − 1.01432 ) = 0.045171884
5𝑥3 5(4.3)
1 1
𝑓2 = (2 − 𝑦22 ) = (2 − 1.00972 ) = 0.046690757
5𝑥2 5(4.2)
1 1
𝑓1 = (2 − 𝑦12 ) = (2 − 1.00492 ) = 0.048301267
5𝑥1 5(4.1) }
𝑝 4 ∗ 0.1
𝑦4 = 1 + ∗ {2(0.045171884) − 0.046690757 + 2(0.048301267)} = 1.018701
3
By Milne’s corrector formula,
𝑐 ℎ 𝑝
𝑦4 1 = 𝑦2 + ∗ {𝑓4 + 4𝑓3 + 𝑓2 }
3
𝑝 1 𝑝 2
𝑓4 = (2 − (𝑦4 ) ) = 0.043738581
5𝑥4
𝑐 0.1
𝑦4 1 = 1.0097 + ∗ {0.043738581 + 4(0.045171884) + 0.046690757} = 1.018737229
3
𝑐 1 𝑐 2
𝑓4 1 = (2 − (𝑦4 1 ) ) = 0.043735202
5𝑥4
𝑐 0.1
𝑦4 2 = 1.0097 + ∗ {0.043735202 + 4(0.045171884) + 0.046690757} = 1.01874
3
𝑑𝑦 1
2) Determine 𝑦(2) if the solution of 𝑑𝑥
− 2 (𝑥 + 𝑦) given 𝑦(0) = 2, 𝑦(0.5) = 2.636, 𝑦(1) =
3.595 and 𝑦(1.5) = 4.968.
𝑑𝑦
3) If 𝑑𝑥 = 2𝑒 𝑥 − 𝑦, 𝑦(0) = 2, 𝑦(0.1) = 2.010, 𝑦(0.2) = 2.040, 𝑦(0.3) = 2.090, find 𝑦(0.4) and
𝑦(0.5) by the Milne’s method.
1
4) Given 𝑦 ′ = 𝑥 2 + 2 𝑦, 𝑦(1) = 2, 𝑦(1.1) = 2.2156, 𝑦(1.2) = 2.4649, 𝑦(1.3) = 2.7514, use
Milnes method and Adam’s method to estimate 𝑦(1.4) sorrect to 4 decimal places. {3.0794}
2𝑥
5) Find 𝑦(0.4) given 𝑦 ′ = 𝑦 − 𝑦
, 𝑦(0) = 1, 𝑦(0.1) = 1.0959, 𝑦(0.2) = 1.1841, 𝑦(0.3) =
1.2662 using Milne’s method. {1.3428}
II. Adam-Bashforth-Moulton (ABM or Adam’s) Predictor-Corrector Method
The Adams-Bashforth-Moulton is the most popular multistep method for solving the IVP.
It is a two-fold process consisting of the predictor and corrector functions, 𝑦 𝑝 and 𝑦 𝑐 . The predictor
function is called the Adams-Bashforth function, whereas the corrector is the Adams-Moulton
function.
The Four-step Adams-Bashforth formula (Predictor) is
𝑝 ℎ ′ ′ ′
𝑦𝑛+1 = 𝑦𝑛 + {55𝑦𝑛′ − 59𝑦𝑛−1 + 37𝑦𝑛−2 − 9𝑦𝑛−3 } − − − − 〈1〉
24
where,
𝑦𝑛′ = 𝑓(𝑥𝑛 , 𝑦𝑛 )

𝑦𝑛−1 = 𝑓(𝑥𝑛−1 , 𝑦𝑛−1 )

Dedan Kimathi University of technology Page 10 of 12



𝑦𝑛−2 = 𝑓(𝑥𝑛−2 , 𝑦𝑛−2 )

𝑦𝑛−3 = 𝑓(𝑥𝑛−3 , 𝑦𝑛−3 )

The formula is based on the Lagrange polynomial approximation on four points,


𝑝
(𝑥𝑛−3 , 𝑦𝑛−3 ), (𝑥𝑛−2 , 𝑦𝑛−2 ), (𝑥𝑛−1 , 𝑦𝑛−1 ) and (𝑥𝑛 , 𝑦𝑛 ) to produce (𝑥𝑛+1 , 𝑦𝑛+1 ).

The three-step Adams-Moulton formula (Corrector) is

𝑐
ℎ ′ ′ ′
𝑦𝑛+1 = 𝑦𝑛 + {9𝑦𝑛+1 + 19𝑦𝑛′ − 5𝑦𝑛−1 + 𝑦𝑛−2 } − − − − 〈2〉
24
where,
′ 𝑝
𝑦𝑛+1 = 𝑓(𝑥𝑛+1 , 𝑦𝑛+1 )
Examples
1) Given the initial value problem 𝑦 ′ = 𝑥 3 + 𝑦, 𝑦(0) = 2, 𝑦(0.2) = 2.443, 𝑦(0.4) = 2.991 and
𝑦(0.6) = 3.681, find 𝑦(0.8) using Adams-Bashforth-Moulton method correct to 3 decimal
places, taking ℎ = 0.2.
Solution
𝑥0 = 0, 𝑦0 = 2, 𝑥1 = 0.2, 𝑦1 = 2.443214, 𝑥2 = 0.4, 𝑦2 = 2.990579,
𝑥3 = 0.6, 𝑦3 = 3.680917, 𝑓(𝑥, 𝑦) = 𝑥 3 + 𝑦
𝑝 𝑝
By Adams-Bashforth formula (predictor), we compute 𝑦𝑛+1 = 𝑦4 with 𝑛 = 3
𝑝 ℎ
𝑦4 = 𝑦𝑛 + ∗ {55𝑓3 − 59𝑓2 + 37𝑓1 − 9𝑓0 } where
24
𝑓3 = 𝑥33 + 𝑦3 = 0.63 + 3.680917 = 3.896917
𝑓2 = 𝑥23 + 𝑦2 = 0.43 + 2.990579 = 3.054579
𝑓1 = 𝑥13 + 𝑦1 = 0.23 + 2.443214 = 2.451214
𝑓0 = 𝑥03 + 𝑦0 = 03 + 2 = 2.000 }
𝑝 0.2
𝑦4 = 3.680917 + ∗ {55(3.896917) − 59(3.054579) + 37(2.451214) − 9(2.000)}
24
= 4.570960267
By Adams-Moulton (corrector) formula,
𝑐1 ℎ 𝑝
𝑦𝑛+1 = 𝑦𝑛 + ∗ {9𝑓𝑛+1 + 19𝑓𝑛 − 5𝑓𝑛−1 + 𝑓𝑛−2 }
24
𝑐 0.2 𝑝
𝑦4 1 = 𝑦3 + ∗ {9𝑓4 + 19𝑓3 − 5𝑓2 + 𝑓1 }
24
𝑝 𝑝
𝑓4 = 𝑥43 + 𝑦4 = 0.83 + 4.570960267 = 5.082960267
𝑐 0.2
𝑦4 1 = 3.680917 + ∗ {9(5.082960267) + 19(3.896917) − 5(3.054579) + 2.451214}
24
= 4.572303537
𝑐 𝑐
𝑓4 1 = 𝑥43 + 𝑦4 1 = 0.83 + 4.572303537 = 5.084303537
𝑐 0.2
𝑦4 2 = 3.680917 + ∗ {9(5.084303537) + 19(3.896917) − 5(3.054579) + 2.451214}
24
= 4.572404282
∴ 𝑦4 = 4.572 (3 𝑑. 𝑝)
𝑑𝑦 1
2) Determine 𝑦(2) if the solution of − (𝑥 + 𝑦) given 𝑦(0) = 2, 𝑦(0.5) = 2.636, 𝑦(1) =
𝑑𝑥 2
3.595 and 𝑦(1.5) = 4.968.

Dedan Kimathi University of technology Page 11 of 12


𝑑𝑦
3) If = 2𝑒 𝑥 − 𝑦, 𝑦(0) = 2, 𝑦(0.1) = 2.010, 𝑦(0.2) = 2.040, 𝑦(0.3) = 2.090, find 𝑦(0.4) and
𝑑𝑥
𝑦(0.5).
Exercises
1
1) Given 𝑦 ′ = 𝑥 2 + 2 𝑦, 𝑦(1) = 2, 𝑦(1.1) = 2.2156, 𝑦(1.2) = 2.4649, 𝑦(1.3) = 2.7514, use
Milnes method and Adam’s method to estimate 𝑦(1.4) correct to 4 decimal places. {3.0794}
2𝑥
2) Find 𝑦(0.4) given 𝑦 ′ = 𝑦 − 𝑦
, 𝑦(0) = 1, 𝑦(0.1) = 1.0959, 𝑦(0.2) = 1.1841, 𝑦(0.3) =
1.2662 using Milne’s method and Adam’s method. {1.3428, 1.3431}
𝑑𝑦 1
3) Solve = 3𝑥 + 𝑦, 𝑦(0) = 1 using ABM and Milne’s method. Use fourth-order Runge-Kutta
𝑑𝑥 2
method to obtain initial values.
4) Using Adams-Moulton method, obtain the slolution of 𝑦 ′ = 𝑥 2 𝑦 + 𝑥 2 at 𝑥 = 1.4 given the
values

𝑥 1 1.1 1.2 1.3


𝑦 1 1.233 1.548488 1.978921

Dedan Kimathi University of technology Page 12 of 12

Вам также может понравиться