0% found this document useful (0 votes)
32 views21 pages

The Solution of Nonlinear Equations: Doç. Dr. Seher KUMCUOĞLU Doç. Dr. Onur Özdikicierler

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 21

THE SOLUTION OF

NONLINEAR
EQUATIONS

Doç. Dr. Seher KUMCUOĞLU


Doç. Dr. Onur ÖZDİKİCİERLER

09.11.2023 Numerical Analysis 2023-2024 1


NONLINEAR EQUATION SYSTEMS

The equation system is the set of equations that involves one


or more nonlinear equation. All methods to solve nonlinear
equations are iterative.
To solve nonlinear equations;

• The number of independent equation should be equal to the


number of independent variable (degrees of freedom= 0)

Degrees of Freedom : is the difference between the number of


independent equations and number of unknown variables.

09.11.2023 Numerical Analysis 2023-2024 2


NONLINEAR EQUATION SYSTEMS

The Selection of the Method:

The following criteria should be considered.


• Convergence rate
• The number functions that the values are calculated
at each iteration
• Correction property of the method

09.11.2023 Numerical Analysis 2023-2024 3


BISECTION METHOD
The geometrical interpretation and usage of Bisection method is easy but,
it can be used only for single equation.
Consider a function represented by figure given below. The function has
single and real root.

f(x)

f(a)
Assume that
x
a ≤ x ≤ b is, true for the
b
root value of f(x)
a xm x

f(b)
f(a)*f(b) ≤ 0

09.11.2023 Numerical Analysis 2023-2024 4


The Steps of Bisection Method:

1) Third value of x can be calculated using given values of x:

𝑎+𝑏
𝑥𝑚 =
2

2) Function values f(a), f(b), f(xm) for a, b, and xm are


calculated consequently.

3) The multiplications for f(xm) x f(b), and f(xm) x f(a) are


calculated. Any one of the multiplication should give
negative value to find a real root.

09.11.2023 Numerical Analysis 2023-2024 5


ILL CONDITIONED FUNCTIONS
A feasible solution is not possible or difficult for the following
type functions:
• Function touch to the x axis and then change its direction
Therefore it never takes any negative value.

f(x)
f(x)

a b
x
x
a b

09.11.2023 Numerical Analysis 2023-2024 6


ILL CONDITIONED FUNCTIONS
• Function may have two or more root values. In this case, the
interpretation of the multiplication of f(xm) and f(a) or f(xm) and f(b)
and the application of the algorithm is difficult.

f(x)

a
b
xm x

The range of initial interval should be determined carefully.


Otherwise, f(b)f(a) < 0 means that single root available between
a and b, and f(b)f(a) > 0 means that double roots available in the
interval of a-b.

09.11.2023 Numerical Analysis 2023-2024 7


Example: Find the root value of f(x)= x2-5x+1 using bisection (a=0, b=1)
and ε=0.02

Solution:
1st iteration: (a=0, b=1)
𝑎+𝑏 0+1
𝑥𝑚 = = = 0.5
2 2

𝑓 𝑎 = 𝑓 0 = 02 − 5 × 0 + 1 → 𝑓 0 = 1

𝑓 𝑏 = 𝑓 1 = 12 − 5 × 1 + 1 → 𝑓 1 = −3

𝑓 𝑥𝑚 = 𝑓 0.5 = 0.52 − 5 × 0.5 + 1 → 𝑓 0.5 = −1.25


new a and b values
𝑓 0 × 𝑓 0.5 = 1 × −1.25 = −1.25 ≤ 0 ✓ New interval
a=0, b=0.5
𝑓 0.5 × 𝑓 1 = −1.25 × −3 = 3.75 ≥ 0 X for correct interval this
value should be negative

09.11.2023 Numerical Analysis 2023-2024 8


Solution:
2nd iteration: (a=0, b=0.5)

𝑎 + 𝑏 0 + 0.5
𝑥𝑚 = = = 0.25
2 2

𝑓 0 =1
𝑓 0.5 = −1.25

𝑓 𝑥𝑚 = 𝑓 0.25 = 0.252 − 5 × 0.25 + 1 → 𝑓 0.25 = −0.1875

𝑓 0 × 𝑓 0.25 = 1 × −0.1875 = −0.1875 ≤ 0 ✓ New interval new a and b values


a=0, b=0.25
𝑓 0.25 × 𝑓 0.5 = −0.1875 × −1.25 ≥ 0 X
for correct interval this
value should be negative

09.11.2023 Numerical Analysis 2023-2024 9


3rd iteration:

a=0, b=0.25, xm=0.125

𝑓 0 =1 𝑓 0 × 𝑓 0.125 ≥ 0 X
𝑓 0.25 = −1.25
𝑓 0.125 × 𝑓 0.25 ≤ 0 ✓ New interval
𝑓 0.125 = 0.39

4th iteration:

a=0.125, b=0.25, xm=0.1875

𝑓 0.125 = 0.39 𝑓 0.125 × 𝑓 0.1875 ≥ 0 X


𝑓 0.25 = −1.25
𝑓 0.1875 × 𝑓 0.25 ≤ 0 ✓ New interval
𝑓 0.1875 =0.0098

09.11.2023 Numerical Analysis 2023-2024 10


5th iteration:

a=0.1875, b=0.25, xm=0.21875

𝑓 0.1875 =0.0098 𝑓 0.1875 × 𝑓 0.21875 ≤ 0 ✓ New interval


𝑓 0.25 = −1.25
𝑓 0.21875 = −0.05
𝑓 0.21875 × 𝑓 0.25 ≥ 0 X

6th iteration:

a=0.1875, b=0.21875, xm=0.2031

𝑓 0.1875 =0.0098 𝑓 0.1875 × 𝑓 0.2031 ≥ 0 X


𝑓 0.21875 = −0.05
𝑓 0.2031 × 𝑓 0.21875 ≤ 0 ✓ New interval
𝑓 0.2031 =0.026

09.11.2023 Numerical Analysis 2023-2024 11


7th iteration:

a=0.2031, b=0.21875, xm=0.211

𝑓 0.2031 =0.026 𝑓 0.2031 × 𝑓 0.211 ≤ 0 ✓ New interval


𝑓 0.21875 = −0.05
𝑓 0.211 = −0.01
𝑓 0.211 × 𝑓 0.21875 ≥ 0 X

0.2031 + 0.211
𝑥𝑚 = → 𝑥𝑚 = 0.207
2
Relative error for consequent value
0.207 − 0.211 of x satisfies the given condition.
𝜖= = 0.019
0.207 Therefore, the value of root is 0.207
approximately.

09.11.2023 Numerical Analysis 2023-2024 12


NEWTON RAPHSON METHOD
The Newton Raphson method is one of the most widely used methods for
root finding. It can be easily generalized to the problem of finding
solutions of a system of non-linear equations

Newton Raphson technique requires only one initial value x0, which we
will refer to as the initial guess for the root. To see how the Newton
Raphson method works, we can rewrite the function f(x) using a Taylor
series expansion in (x-x0):
𝑓 ′′ 𝑥0 𝑥 − 𝑥0 2
𝑓 𝑥 = 𝑓 𝑥0 + 𝑓 ′ 𝑥0 𝑥 − 𝑥0 + + ⋯⋯⋯ = 0
2!

𝑓 ′ 𝑥 : the first derivative of f (x) with respect to x


𝑓 ′′ 𝑥 : is the second derivative, and and so forth

09.11.2023 Numerical Analysis 2023-2024 13


NEWTON RAPHSON METHOD
Suppose the initial guess is pretty close to the real root. Then (x-x0) is
small, and only the first few terms in the series are important to get
an accurate estimate of the true root, given x0.

By truncating the series at the second term (linear in x), we obtain the
Newton Raphson iteration formula for getting a better estimate of the
true root:

𝑓 ′′ 𝑥0 𝑥 − 𝑥0
𝑓 𝑥 = 𝑓 𝑥0 + 𝑓 ′ 𝑥0 𝑥 − 𝑥0 + + ⋯⋯⋯ = 0
2!
it is difficult to find

0 = 𝑓 𝑥0 + 𝑓 ′ 𝑥0 𝑥 − 𝑥0

𝑓 𝑥0 𝑓 𝑥0
𝑥 − 𝑥0 =− ′ 𝑥1 = 𝑥0 − ′
𝑓 𝑥0 𝑛𝑒𝑤 𝑣𝑎𝑙𝑢𝑒 𝑜𝑓 𝑥 𝑓 𝑥0

09.11.2023 Numerical Analysis 2023-2024 14


NEWTON RAPHSON METHOD
f(x)
• Find the tangent to the function f(x)
at x=x0 and extrapolates it to
f(x0) intersect the x axis to get x1
• This point of intersection is taken
as the new approximation to the
root
• The procedure is repeated until
convergence is obtained whenever
f(x1) possible
• Mathematically, given the value of
x = xi at the end of the ith iteration,
x2 x1 x0 we obtain xi+1 as
real root
𝑓 𝑥𝑖
𝑥𝑖+1 = 𝑥𝑖 − ′
𝑓 𝑥𝑖

09.11.2023 Numerical Analysis 2023-2024 15


Example: Find the root value of f(x)= x2-5x+1 for x0=0, and ε=0.001

Solution: 𝑓 𝑥𝑖
𝑥𝑖+1 = 𝑥𝑖 − ′
𝑓 𝑥𝑖
𝑓 𝑥 = 𝑥 2 − 5𝑥 + 1 𝑓 ′ 𝑥 = 2𝑥 − 5

1st iteration: x=0 (initial value)


𝑓 𝑥0 1
𝑓 0 = 02 +5×0+1→𝑓 0 = 1 𝑥1 = 𝑥0 − ′ = 0− = 0.2
𝑓 𝑥0 −5
𝑓 ′ 0 = 2 × 0 − 5 → 𝑓 ′ 0 = −5 0.2 − 0
∈= >∈
0.2

2nd iteration: x1=0.2


𝑓 𝑥1 0.04
𝑓 0.2 = (0.2)2 +5 × (0.2) + 1 → 𝑓 0.2 = 0.04 𝑥2 = 𝑥1 − = 0.2 −
𝑓 ′ 𝑥1 −4.6
𝑓 ′ 0.2 = 2 × (0.2) − 5 → 𝑓 ′ 0 = −4.6
𝑥2 = 0.208696
0.208 − 0.2
∈= >∈
0.208

09.11.2023 Numerical Analysis 2023-2024 16


3rd iteration: x=0.208696

𝑓 0.208696 = (0.208696)2 −5 × 0.208696 + 1 → 𝑓 0.208696 = 7.39𝑥10−5

𝑓 ′ 0.208696 = 2 × (0.208696) − 5 → 𝑓 ′ 0.208696 = −4.5826


𝑓 𝑥2 7.39𝑥10−5
𝑥3 = 𝑥2 − ′ = 0.208696 − = 0.20871
𝑓 𝑥2 −4.5826

0.20871 − 0.208
∈= <∈
0.20871

The procedure is terminated since the difference between the consequent


values of x is 1.6*10-5

09.11.2023 Numerical Analysis 2023-2024 17


DIRECT SUBSTITUTION METHOD
It is an iterative method and need an initial value for unknown variable.
In first step:

• The function is written explicitly for x; x=f(x)


For this purpose, a suitable term is written to the left side of the equality. If a suitable term is not
available a new term is added to both sides of the equality.

Example: 𝑓 𝑥 = 𝑥 2 − 2𝑥 − 𝑐 the suitable term is 2x

The equation is rewritten for x using this term, or by adding a new term such as x:
𝑥2 − 𝑐
𝑥= 𝑥 = 𝑥2 − 𝑥 − 𝑐
2
In second step:
• the initial value of unknown variable is used to calculate the new value of the
variable such as x1 = f (x0) for first iteration x2 = f (x1) for second iteration and finally
xn = f (xn-1) for nth iteration.

09.11.2023 Numerical Analysis 2023-2024 18


DIRECT SUBSTITUTION METHOD
If direct substitution is interpreted geometrically using the figure given below,
it is observed that x and x’ are located on y = x line and it is tried to reach
the intersection point of the curve y = f(x) and y = x line.
This is not possible if the condition of is not satisfied. But the satisfaction of
condition doesn’t mean the method converge to root value.
y=x
f(x)

f1

f0 B

0
x0 x1 x2 x3
x

09.11.2023 Numerical Analysis 2023-2024 19


DIRECT SUBSTITUTION METHOD
This is not possible if the condition of 0 < 𝑓 ′ (𝑥) < 1 is not satisfied. But the
satisfaction of condition doesn’t mean the method converge to root value.

f(x)
f(x)

a x0 x1 x 0 1
x2 x x x3 x
x2

𝑓 ′ (𝑥) > 1 𝑓 ′ (𝑥) < 1

09.11.2023 Numerical Analysis 2023-2024 20


Example: Find the root value of f(x)= x2-5x+1 using direct substitution
method for x0 = 0 and ε=0.00025

Solution:
𝑥2 + 1
𝑓 𝑥 = 𝑥2 − 5𝑥 +1 𝑥=
5
𝑥 0 2+1 02+1
0.2 − 0
1st iteration: x0=0 𝑥1 = = = 0.2 ∈= >∈
5 5 0.2

𝑥1 2
(0.2)2 +1
+1 0.208 − 0.2
2nd iteration: x1=0.2 𝑥2 = = = 0.208 ∈= >∈
5 5 0.208

3
(0.208)2 +1 0.20865 − 0.208
3rd iteration: x2=0.208 𝑥 = = 0.20865 ∈= >∈
5 0.20865
2 +1
(0.20865)
4th iteration: x3=0.20865 𝑥4 = = 0.2087
5
0.2087 − 0.20865 The relative error satisfies the required condition and
∈= = 0.00024 final value of x is approved as the root value of function.
0.2087 (x=0.2087)

09.11.2023 Numerical Analysis 2023-2024 21

You might also like