You are on page 1of 11

APPLIED NUMERICAL METHODS

Dr. Khaled Ahmida Ashouri


Numerical Methods Course
Dr. Khaled Ahmida

NEWTON-RAPHSON METHOD
 Based on forming the tangent line to the f(x) curve at some
guess point x, then following the tangent line to where it crosses
the x-axis
𝑠𝑙𝑜𝑝𝑒 𝑓 𝑥 tan 𝜃

f(xi )
𝑓 𝑥  xi 1 = xi -
f ' (xi )
 This equation can be thought of 𝜃

as the slope (df/dx) of the


tangent line calculated at point xi
Numerical Methods Course
Dr. Khaled Ahmida

NEWTON-RAPHSON METHOD
 You can also think of it using Taylor’s series:

 using only the first two terms of the approximation

The point at which this equation has an answer is when f(x)=0, thus


Numerical Methods Course
Dr. Khaled Ahmida

NEWTON-RAPHSON METHOD
 Newton-Raphson Method is called “open method” because it is not bracketed
 The function to be solved should be continuous and differentiable
 the 1st derivative is always needed

f(xi )
xi 1 = xi -
f ' (xi )
Numerical Methods Course
Dr. Khaled Ahmida

NEWTON-RAPHSON METHOD
input x0, tol
 Flowchart:
delta = -f(x)/df(x)

x=x+delta

This could be done


If |delta| <= tol in different ways

Solution
obtaind
x
no
yes
end
Numerical Methods Course
Dr. Khaled Ahmida

NEWTON-RAPHSON METHOD
 Example: Graph of y=f(x)
3

2.5

f ( x)  x sin( x)  1
2
1.5

df ( x)
 2 x sin( x)  x 2 cos( x)
1

y
dx 0.5

-0.5

-1
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
x
Numerical Methods Course
Dr. Khaled Ahmida

NEWTON-RAPHSON METHOD
 Example: results

Iter x x Relative error (%)

1 1.00000000000000 --- ---

2 1.07130526183750 0.071305261 6.6559

3 1.06822902246379 -0.003076239 0.2879

4 1.06822354421466 -0.00000547 0.0005

5 1.06822354419725 0.0000000 0.0000000016


Numerical Methods Course
Dr. Khaled Ahmida

NEWTON-RAPHSON METHOD
 Difficulties: Newton-Raphson method may
diverge and root is hard to find
 There is no simple method to avoid this
kind of problems. Graphing may help
Numerical Methods Course
Dr. Khaled Ahmida

NEWTON-RAPHSON METHOD
 1D (1-equation in 1 variable), 2D (2 equations in 2 variables)
 nD (n equations in n variables)
x2  6x  9  0
 1D non-linear eqn.
x  cos( x)  0
e x log( x 2 )  x cos( x)  0

y 2 (1  x)  x 3
 2D non-linear eqn.
x2  y2  1
Numerical Methods Course
Dr. Khaled Ahmida

NEWTON-RAPHSON METHOD

Numerical Methods Course
Dr. Khaled Ahmida

NEWTON-RAPHSON METHOD
 Why do we need Newton-Raphson method in 2D?
 For linear system of equations, we can use Gauss elimination, Gauss
Seidel, …etc.

 For nonlinear system of equations ! What to do ?

y 2 (1  x)  x 3
 how to solve these?
x  y 1
2 2

You might also like