0% found this document useful (0 votes)
9 views40 pages

2-Roots of Nonlinear Single Equations

The document discusses numerical methods for solving nonlinear equations in one variable, focusing on iterative techniques such as Fixed-point iteration, Newton's Method, and the Secant Method. It provides examples and procedures for finding roots of equations, including testing for convergence and measuring accuracy. The document emphasizes the importance of choosing appropriate initial guesses and understanding the limitations of each method.

Uploaded by

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

2-Roots of Nonlinear Single Equations

The document discusses numerical methods for solving nonlinear equations in one variable, focusing on iterative techniques such as Fixed-point iteration, Newton's Method, and the Secant Method. It provides examples and procedures for finding roots of equations, including testing for convergence and measuring accuracy. The document emphasizes the importance of choosing appropriate initial guesses and understanding the limitations of each method.

Uploaded by

Yasser Bacus
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 40

CHE 111 – Advanced Engineering Mathematics in

Chemical Engineering
DCHET, COET, MSU-IIT
Numerical Solution of
Nonlinear Equations
in One Variable
AN ALGEBRAIC EQUATION CAN INCLUDE
Polynomial: 𝑥 2 , 𝑥 3 , 𝑥 4 , . . . 𝑥 𝑛

log 𝑥 or ln 𝑥

Exponential (𝑒 𝑥 )

Trigonometric functions:
▪ sin 𝑥, cos 𝑥, . . .
▪ sinh 𝑥, cosh 𝑥, . . .
THE VERY FAMOUS ALGEBRAIC EQUATION
Second order polynomial algebraic equation

𝑎𝑥 2 + 𝑏𝑥 + 𝑐 = 0
example
2𝑥 2 + 7𝑥 + 6 = 0

2𝑥 + 3 𝑥 + 2 = 0

𝑥 = −1.5, 𝑥 = −2

−𝑏 ± 𝑏2 − 4𝑎𝑐
𝑥=
2𝑎
MORE DIFFICULT EQUATIONS
5𝑥 4 + 6𝑥 3 − 𝑥 2 + 𝑥 − 10 = 0
or
2𝑥 4 − 7𝑥 2 + 6𝑒 2𝑥 = 0
or
2𝑥 3 + 2 sin 2𝑥 − cos 3𝑥 = 0
INTRODUCTION

When the solution of a single equation

𝑓 𝑥 =0 (1)

can not be obtained using formulas (except in


a few simple cases), one depends almost
entirely on numerical algorithms. A solution of
(1) is a number 𝑥 = 𝑠 such that 𝑓 𝑠 = 0.
INTRODUCTION
Solved by “trial and error” or “iterations”

No
Assumed
Assume Substitute in Satisfies Yes
value is
“𝑥” the equation equation?
correct
ITERATIVE METHODS
▪ Fixed-point iteration or M.O.S.S. (Method of
Successive Substitution)

▪ Newton’s Method

▪ Secant Method

▪ Inclusion Methods
▪ Bisection Method
▪ Regula-Falsi
ITERATIVE METHODS
▪ No numerical procedure works for all equations
▪ The root depends on the guess
▪ Measurement of accuracy of estimate depends
on:
▪ Absolute Error:

▪ Relative Error:

▪ Error Ratio:

▪ Mitigation of non-convergence
ITERATIVE METHODS
(Method of Successive Substitution)

▪ Condition: 𝑥 = 𝑔 𝑥

𝑑𝑔 𝑥
▪ Test for Convergence: <1
𝑑𝑥

▪ If 𝑓 𝑎 𝑓 𝑏 < 0, there exists a root of 𝑓 𝑥 in


the interval 𝑎, 𝑏

Transform (1) algebraically into the form 𝑥 =


𝑔 𝑥 . Then we choose an 𝑥0 and compute 𝑥1 =
𝑔 𝑥0 , 𝑥2 = 𝑔 𝑥1 , . . ., and in general
𝑥𝑛+1 = 𝑔 𝑥𝑛
FIXED-POINT ITERATION
(Graphical interpretation)
FIXED-POINT ITERATION
(Graphical interpretation)
FIXED-POINT ITERATION
Problem 1.
Given:
𝑓 𝑥 = 𝑥 3 − 3𝑥 + 1 = 0

Determine all three roots using fixed-point iteration. Use a relative


error of 0.0001.

Solution:
Test for vicinity of possible root:

𝑎 = 0, 𝑏 = 1
𝑓 𝑎 = 0 3 − 3 0 + 1 = 1,
3
𝑓 𝑏 = 1 − 3 1 + 1 = −1
𝑓 0 𝑓 1 = 1 −1 = −1, 𝑓 𝑎 𝑓 𝑏 < 0

Hence root exists in 0, 1


FIXED-POINT ITERATION
First Estimate:
Transform 𝑓 𝑥 = 𝑥 3 − 3𝑥 + 1 = 0 algebraically into the form 𝑥 =
𝑔 𝑥 .
𝑥3 + 1
𝑥=
3

Then we choose an 𝑥0

𝑥0 = 0

𝑑𝑔 𝑥
Test for Convergence: <1
𝑑𝑥

𝑑𝑔 𝑥
= 𝑥2 0 =0<1
𝑑𝑥 0
FIXED-POINT ITERATION
(Graphical interpretation)
𝑥1
FIXED-POINT ITERATION
Compute 𝑥1 = 𝑔 𝑥0 , 𝑥2 = 𝑔 𝑥1 , . . ., until

x=g(x) = (x^3 + 1) / 3
n x (n) x (n+1) = g (x(n)) Relative Error

0 0.0000

5
FIXED-POINT ITERATION
FIXED-POINT ITERATION
Solution:

x=g(x) = (x^3 + 1) / 3

n x (n) x (n+1) = g (n) Relative Error

0 0.00000 0.33333 1.0000

1 0.33333 0.34568 0.0357

2 0.34568 0.34710 0.0041

3 0.34710 0.34727 0.0005

4 0.34727 0.34729 0.0001


FIXED-POINT ITERATION
Solution:

x=g(x) = (3x - 1) ^(1/3)

n x (n) x (n+1) = g (n) Relative Error

0 -2.00000 -1.91293 0.0455

1 -1.91293 -1.88884 0.0128

2 -1.88884 -1.88206 0.0036

3 -1.88206 -1.88014 0.0010

4 -1.88014 -1.87960 0.0003

5 -1.87960 -1.87945 0.0001


FIXED-POINT ITERATION
Solution:

x=g(x) = (3 - 1/x) ^(1/2)

n x (n) x (n+1) = g (n) Relative Error

0 1.00000 1.41421 0.2929

1 1.41421 1.51423 0.0661

2 1.51423 1.52957 0.0100

3 1.52957 1.53174 0.0014

4 1.53174 1.53204 0.0002

5 1.53204 1.53208 0.0000


NEWTON’S METHOD
3.500

y = x^3 - 3x+ 1
3.000

2.500

2.000

1.500

1.000

0.500

0.000
-2.5 -2.0 -1.5 -1.0 -0.5 0.0 0.5 1.0 1.5 2.0 2.5

-0.500

-1.000

-1.500
NEWTON’S METHOD
If a differentiable function 𝑦 = 𝑓 𝑥 has a simple root 𝑠 in 𝑎, 𝑏
and 𝑓 ′ 𝑠 ≠ 0, then the iteration rule is given as

𝑓 𝑥𝑛
𝑥𝑛+1 = 𝑥𝑛 − ′
𝑓 𝑥𝑛
for 𝑛 = 1, 2, 3, . . .

Steps:
▪ Pick an 𝑥 close to the root of a continuous function 𝑓 𝑥
▪ Take the derivative of 𝑓 𝑥 to get 𝑓 ′ 𝑥
𝑓 𝑥𝑛
▪ Plug into 𝑥𝑛+1 = 𝑥𝑛 − ′ , 𝑓′ 𝑥 ≠ 0
𝑓 𝑥𝑛

▪ Repeat until converges where 𝑥𝑛+1 ≈ 𝑥𝑛


NEWTON’S METHOD
Problem 2.
Given:
𝑓 𝑥 = 𝑥 3 − 3𝑥 + 1

Determine all three roots using Newton’s Method. Use a relative


error of 0.0001.

Solution:
Pick an 𝑥 close to the root of a continuous function 𝑓 𝑥
𝑥 = −0.5

Take the derivative of 𝑓 𝑥 to get 𝑓 ′ 𝑥

𝑓 ′ 𝑥 = 3𝑥 2 − 3
NEWTON’S METHOD
𝑥 3 −3𝑥+1
Plug into 𝑥𝑛+1 = 𝑥𝑛 −
3𝑥 2 −3

f(x)=x^3-3x+1
n x (n) f(x) f '(x) x (n+1) Tolerance
1
2
3

5
6
7
8
9
10

11
NEWTON’S METHOD
Repeat until converges where 𝑥𝑛+1 ≈ 𝑥𝑛

f(x)=x^3-3x+1
n x (n) f(x) f (x) x (n+1) Tolerance
0 -0.50000 2.37500 -2.25000 0.55556 1.9000000000
1 0.55556 -0.49520 -2.07407 0.31680 -0.7536534447
2 0.31680 0.08140 -2.69892 0.34696 0.0869250821
3 0.34696 0.00089 -2.63886 0.34730 0.0009731972
4 0.34730 0.00000 -2.63816 0.34730 0.0000001298
5 0.34730 0.00000 -2.63816 0.34730 0.0000000000
6 0.34730 0.00000 -2.63816 0.34730 0.0000000000
7 0.34730 0.00000 -2.63816 0.34730 0.0000000000
8 0.34730 0.00000 -2.63816 0.34730 0.0000000000
9 0.34730 0.00000 -2.63816 0.34730 0.0000000000
10 0.34730 0.00000 -2.63816 0.34730 0.0000000000
11 0.34730 0.00000 -2.63816 0.34730 0.0000000000
12 0.34730 0.00000 -2.63816 0.34730 0.0000000000
13 0.34730 0.00000 -2.63816 0.34730 0.0000000000
14 0.34730 0.00000 -2.63816 0.34730 0.0000000000
DRAWBACK OF NEWTON’S METHOD
▪ Requires 𝑓 ′ 𝑥𝑛
▪ If 𝑓 𝑥 = sin cos 𝑒 𝑥
▪ 𝑓 ′ 𝑥 = −𝑒 𝑥 sin 𝑒 𝑥 cos cos 𝑒 𝑥

▪ Solution: Use a Secant instead of a Tangent

3.500

y = x^3 - 3x+ 1
3.000

2.500

2.000

1.500

1.000

0.500

0.000
-2.5 -2.0 -1.5 -1.0 -0.5 0.0 0.5 1.0 1.5 2.0 2.5

-0.500

-1.000

-1.500
SECANT METHOD
3.500

y = x^3 - 3x+ 1
3.000

2.500

2.000

1.500

1.000

0.500

0.000
-2.5 -2.0 -1.5 -1.0 -0.5 0.0 0.5 1.0 1.5 2.0 2.5

-0.500

-1.000

-1.500
SECANT METHOD
ALGORITHM:
1. Assume 𝑥0 and 𝑥1

2. Condition: If 𝑓 𝑥0 < 𝑓 𝑥1 then swap 𝑥0 and 𝑥1

3. Solve for 𝑥2
𝑥1 − 𝑥0
𝑥2 = 𝑥1 − 𝑓 𝑥1
𝑓 𝑥1 − 𝑓 𝑥0

4. Set 𝑥0 = 𝑥1 and 𝑥1 = 𝑥2
𝑥𝑛 − 𝑥𝑛−1
𝑥𝑛+1 = 𝑥𝑛 − 𝑓 𝑥𝑛
𝑓 𝑥𝑛 − 𝑓 𝑥𝑛−1

5. Solve for new 𝑥2

6. Continue until 𝑓 𝑥2 ≤𝜀
SECANT METHOD
Example 3
Solve for the root of

𝑓 𝑥 = 𝑥 3 + 𝑥 2 − 3𝑥 − 3 𝜀 = 0.00001

Solution:
Assume values for 𝑥𝑛−1 and 𝑥𝑛 :

𝑥𝑛−1 = 1
𝑥𝑛 = 2

Condition: 𝑖𝑠 𝑓 1 <𝑓 2 ?
𝑓 1 = 1 3 + 1 2 − 3 1 − 3 = −4
𝑓 2 = 2 3+ 2 2−3 2 −3=3

Swap.
SECANT METHOD

f(x)=x^3+x^2-3x-3
n x (n-1) x (n) f(x(n-1)) f(x(n)) x (n+1) Tolerance

1 2.00000 1.00000

6
SECANT METHOD

f(x)=x^3+x^2-3x-3
n x (n-1) x (n) f(x(n-1)) f(x(n)) x (n+1) Tolerance

1 2.00000 1.00000 3.00000 -4.00000 1.57143 0.36364

2 1.00000 1.57143 -4.00000 -1.36443 1.86726 0.15843

3 1.57143 1.86726 -1.36443 1.39534 1.71769 0.08708

4 1.86726 1.71769 1.39534 -0.13468 1.73085 0.00761

5 1.71769 1.73085 -0.13468 -0.01134 1.73206 0.00070

6 1.73085 1.73206 -0.01134 0.00011 1.73205 0.00001


INCLUSION METHODS
▪ Bisection method
▪ Regula-falsi (False-Position Method)

Bolzano’s intermediate value theorem. If 𝑓 is continuous


in 𝐼 = [𝑎, 𝑏] and 𝑓(𝑎) ⋅ 𝑓(𝑏) < 0, then f has at least one
root in 𝑠 ∈ 𝐼.
BISECTION METHOD
Let 𝑓 ∈ 𝐶 𝑎, 𝑏 be given with 𝑓 𝑎 ∙ 𝑓 𝑏 < 0 . Then we can
determine a zero in s ∈ 𝐶 𝑎, 𝑏 of odd order by means of repeated
interval bisection.
BISECTION METHOD
ALGORITHM:
1. Start with 𝑎 and 𝑏 such that 𝑓 𝑎 ∙ 𝑓 𝑏 < 0

2. Solve for the next iterate


𝑎+𝑏
𝑐=
2

3. Solve for 𝑓 𝑐

If 𝑓 𝑐 = 0, then c is a root
If 𝑓 𝑐 ≠ 0
AND 𝑓 𝑐 < 0, the root is between 𝑐, 𝑏
AND 𝑓 𝑐 > 0, the root is between 𝑎, 𝑐

4. If 𝑓 𝑐 < 0, set 𝑎 = 𝑐; BUT if 𝑓 𝑐 > 0, set 𝑏 = 𝑐.


BISECTION METHOD
Example 4
Solve for the root of

𝑓 𝑥 = 𝑥 3 + 𝑥 2 − 3𝑥 − 3 𝜀 = 0.0001

f(x)=x^3+x^2-3x-3
n a b f(a) f(b) c f(c)

7
REGULA-FALSI METHOD
An iterative method that works well with functions that are not
differentiable. It requires two initial values 𝑥0 , 𝑥1 , and iteration rule
is as follows:

𝑥𝑛 − 𝑥𝑛−1
𝑥𝑛+1 = 𝑥𝑛 − 𝑓 𝑥𝑛
𝑓 𝑥𝑛 − 𝑓 𝑥𝑛−1

for 𝑛 = 1, 2, 3, . . .
REGULA-FALSI METHOD
Example 5
Solve for the root of

𝑓 𝑥 = 𝑥 3 + 𝑥 2 − 3𝑥 − 3 𝜀 = 0.0001

f(x)=x^3+x^2-3x-3
n x(n-1) x(n) f(x(n-1)) f(x(n)) x(n+1) tolerance

7
EXERCISES
𝑥
▪ Find a root of 𝑥 cos =0
𝑥−2

𝑒 −2𝑥 −1
▪ Find a root of 𝑥2 =
𝑥

2 −1
▪ Find a root of 𝑒 𝑥 + 10 sin 2𝑥 − 5 = 0
EXERCISES
▪ Find a root of 𝑒 𝑥 − 3𝑥 2 = 0

▪ Find a root of tan 𝑥 − 𝑥 − 1 = 0

▪ Find a root of sin 2𝑥 − 𝑒 𝑥−1 = 0


Thank You!

Engr. Karl C. Ondoy, M.Sc.


Assistant Professor III
Department of Chemical Engineering and Technology
MSU-Iligan Institute of Technology
Iligan City, Philippines

You might also like