Академический Документы
Профессиональный Документы
Культура Документы
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, ⋯ ⋯
𝑓 ′ (𝑥𝑛 )
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).
𝑑𝑦
= 𝑓(𝑥, 𝑦)
𝑑𝑥 - - - - - - - - - - - - - - 〈3〉
With (ICs)
The equation together with the ICs is
{ }
𝑦(𝑥0 ) = 𝑦0 called an Initial Value Problem, IVP.
Or 𝑦 = 𝑦0 at 𝑥 = 𝑥0
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〉
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 = 𝑦𝑛 + ℎ𝑓(𝑥𝑛 , 𝑦𝑛 )
Examples
c) RUNGE-KUTTA,
Fourth order Runge-Kutta method
𝑑𝑦
Let = 𝑓(𝑥, 𝑦),
𝑑𝑥
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
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
𝑐
ℎ ′ ′ ′
𝑦𝑛+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.