You are on page 1of 23

University of Palestine

Gaza Strip

Civil Engineering College


Numerical analysis
CIVL 3309
Formerly CVL 3308

Dr. Suhail Lubbad


Numerical analysis
CIVL 3309
CVL 3308
Lecture Ch6.3 Ch6.4 Ch6.5

2
6.3 THE SECANT METHOD

Derivatives are explicitly evaluated in Newton-Raphson method

What if derivative is extremely difficult or inconvenient to evaluate?


Approximate the derivative by back ward finite difference method.

Finite difference method ?!

3
Finite difference technique :
1- Taylor expansion theorem
A one variable functions that have n continuous derivatives over
the interval [x1 , x2], are approximated as follows:

2
h h n−1
f n−1 -x.∣x * O - h .
n
f -x 0*h.=f -x0 .*h f '-x.∣x * f ''-x.∣x *⋯*
0 2! 0 - n−1 . ! 0

Where x1 +x 0 +x 0*h+x 2 .

When we don`t have any formula but function values as points on a


grid, or when it is difficult to compute the derivative,
Finite Difference Method is used.

4
Simple Finite Difference Approximation to a Derivative

Truncate the taylor expansion form to the first derivative


term with ERROR of order h2.

Forward finite divided difference Backward finite divided difference


f -x 0*h.=f -x0 .*h f '-x.∣x * O - h . f -x 0−h.=f -x0 .−h f '-x.∣x * O - h .
n n

0 0

Rearranging Rearranging
f -x 0*h.−f -x0 . f -x 0 .−f -x0 −h.
*O - h .=f '-x. *O - h .=f '-x.
n n

h h
O - hn . , 0 O - hn . , 0
f -x 0*h.−f -x0 . f -x 0 .−f -x0 −h.
=f '-x . =f '-x .
h h

5
On the Grid and using our notation

f -x i−1 .−f -x i .
f '-x i .≃
x i−1−x i

6
The secant method replaces the derivative, in Newton-Raphson method,
by the finite difference, so that the formula to use becomes

f -x i . - x i−1−x i . f - xi.
REMEMBER
x i*1=x i− x i*1=xi − Newton Raphson Formula
f -x i −1.−f -x i . f '- xi .

This approach requires two initial estimates of x.

It is not a bracketing method, no sign change is looked for

7
Example 6.6 the secant method
Use the secant method to estimate the root of f(x) = e−x − x. Start with
initial estimates of x−1 = 0 and x0 = 1.0
The true root is 0.56714329


First iteration: Second iteration:
x−1 =0 f -x −1 .=1.00000 x 0 =1 f -x 0 .=−0.63212
x 0 =1 f -x 0 .=−0.63212 x 1=0.61270 f -x 1 .=−0.07081
−0.63212 - 0−1 . −0.07081 - 1−0.61270 .
x 1=1− =0.61270 x 2 =0.61270− =0.56384
1− -−0.63212 . −0.63212− -−0.07081 .
1 =8.0 % 1t 0.58 %
t

Third iteration :
x 1=0.61270 f -x 1 .=−0.07081
x 2 =0.56384 f -x 2 .=0.00518
0.00518 - 0.61270−0.56384 .
x 3=0.56387− =0.56717
−0.07081− -−0.00518 .
1t =0.0048 % 8
DIVERGENT

9
Modified Secant Method

Rather than using two points to estimate the derivative, it is possible to


use one point and a fractional change (perturbation ) in the independent
variable to estimate the derivative.
f -xi * / xi .−f -x i .
f '-x i .=
/ xi
/ is the small perturbation

This approximation gives a modified formula as follows:


/ x i f -x i .
x i*1=x i−
f -x i* / x i .−f -xi .

10
Example 6.8, Redo Example 6.6 Using the modified Secant method

Use the secant method to estimate the root of f(x) = e−x − x. Use a value
of 0.01 for δ and start with initial estimates and x0 = 1.0
The true root is 0.56714329

We will use the iteration relation


/ x i f -x i .
x i*1=x i−
f -x i* / x i .−f -xi .

11
First iteration:
x 0 =1 f -x 0 .=−0.63212
x 0 * / x 0 =1.01 f -x 0 */ x 0 .=−0.64578
0.01 - −0.63212 .
x 1=1− =0.537263 1=5.3 %
−0.64578 -−0.63212 .

Second iteration:
x 1=0.537263 f -x 1 .=0.047083
x 1* / x1 =0.542635 f -x 1* / x1 .=0.038579
0.005373 - 0.047083 .
x 2 =0.537263− =0.56701 1=0.0236 %
0.038579−0.047083

Third iteration:
x 2 =0.56701 f -x 2 .=0.000209
x 2 * / x 2 =0.572680 f -x 2 */ x 2 .=−0.00867
0.00567 - 0.000209 .
x 3 =0.56701− =0.567143 1=2.365×10−5 % 12
−0.00867−0.000209
Question 6.8
Determine the real root of x3.5 = 80, with the modified secant
method to within εs = 0.1% using an initial guess
of x0 = 3.5 and δ = 0.01

13
Iteration 1
The new approximate Root1 =Root 0−- Delta∗Root 0∗F - Root 0../- F - Root 0* Delta∗Root 0 .− F - Root *0..
=3.5000000e+00−--1.0000000e-02.∗-3.5000000e+00.∗- 2.1178023e-01../--3.0523167e+00 .−- 2.1178023e-01..=3.4973925e+00

Iteration 2
The new approximate Root2= Root 1−- Delta∗Root 1∗F - Root 1 ../- F - Root 1* Delta∗Root 1.−F - Root 1..
=3.4973925e+00−--1.0000000e-02.∗-3.4973925e+00.∗- 2.8221989e-03../--2.8380689e+00 .−-2.8221989e-03..=3.4973577e+00

The Approximate Error E_a2 =∣--Root 2− Root 1 ./ Root2 .∣∗100=∣--3.4973577e+00−3.4973925e+00 ./3.4973577e+00 .∣∗100
=9.9539790e-04

14
3.5
F -x . = x −80

x 0 = 3.5 , / = 0.01
−8
0 s = 10 OR the max # of iterations =10

Iteration 1
The new approximate Root1 = Root 0−-Delta∗Root 0∗F - Root 0 ../-F -Root 0* Delta∗Root 0 .−F -Root 0 ..
=3.5000000e+00−--1.0000000e-02.∗-3.5000000e+00.∗-2.1178023e-01../--3.0523167e+00.−-2.1178023e-01..=3.4973925e+00

Iteration 2
The new approximate Root2 = Root 1−-Delta∗Root 1∗F -Root 1 ../- F - Root 1* Delta∗Root 1 .−F - Root 1 ..
=3.4973925e+00−--1.0000000e-02.∗-3.4973925e+00.∗-2.8221989e-03../--2.8380689e+00.−-2.8221989e-03..=3.4973577e+00

The Approximate Error E_a2 =∣--Root 2−Root 1 ./ Root 2 .∣∗100=∣--3.4973577e+00−3.4973925e+00./3.4973577e+00.∣∗100=9.9539790e-04%

Iteration 3
The new approximate Root3 = Root 2−-Delta∗Root 2∗F - Root 2 ../-F -Root 2* Delta∗Root 2 .−F -Root 2 ..
= 3.4973577e+00−--1.0000000e-02.∗-3.4973577e+00.∗-3.5048904e-05../--2.8352112e+00.−-3.5048904e-05..=3.4973572e+00

The Approximate Error E_a3=∣--Root 3−Root 2 ./ Root 3 .∣∗100=∣--3.4973572e+00−3.4973577e+00./ 3.4973572e+00.∣∗100=1.2362161e-05%

Iteration 4
The new approximate Root4 = Root 3−-Delta∗Root 3∗F -Root 3 ../- F -Root 3* Delta∗Root 3 .− F - Root 3 ..
=3.4973572e+00−--1.0000000e-02.∗-3.4973572e+00.∗-4.3484721e-07../--2.8351757e+00 .−-4.3484721e-07..=3.4973572e+00
The Approximate Error E_a4 = ∣--Root 4−Root 3 ./ Root 4 .∣∗100=∣--3.4973572e+00−3.4973572e+00./ 3.4973572e+00.∣∗100=1.5337578e-07%

Iteration 5
The new approximate Root5 = Root 4−-Delta∗Root 4∗F -Root 4 ../- F -Root 4 *Delta∗Root 4 .− F - Root 4 ..
=3.4973572e+00−--1.0000000e-02.∗-3.4973572e+00.∗-5.3950373e-09../--2.8351752e+00.−-5.3950373e-09..=3.4973572e+00

The Approximate Error E_a5=∣--Root 5−Root 4 ./ Root 5 .∣∗100=∣--3.4973572e+00−3.4973572e+00./ 3.4973572e+00.∣∗100=1.9028999e-09%


15
Repeated or Multiple Roots (‫)الجذر املتكررا و املتعدد‬
See Ch6.5

16
Repeated or Multiple Roots (‫)الجذر املتكررا و املتعدد‬
See Ch6.5
f - x .=- x−3.- x−1.- x−1.
has a double root at x=1
The (x-1) term occurs twice thus making the f(x) =0.
In the graph, the curve is tangentially touching the x-axis without crossing it
Where as
f - x .=- x−3.- x−1.- x−1. -x−1. has triple root at x=1,
the function is tangent to the axis at the root but it doesn`t cross it

Generally: odd multiple roots cross the x-axis, whereas even ones do not.

17
The function does not change sign at even multiple roots:
Bracketing methods CAN NOT be used.

Only Open methods can be used, BUT the occurrence of


f(x) and f'(x) go to zero at the root.

An alternative form is the modified Newton-Raphson

'
f - xi . f - xi .
x i *1 =x i− ' 2 ''
f - x i . −f - x i . f - x i .

“ Bonus for who will have derived it by Midterm”

18
Example 6.10

Use both the standard and modified Newton-Raphson methods to evaluate


the multiple root of f -x.=-x−3.-x−1.-x−1. , with an initial guess of x0 = 0.

3 2 2
f -x.=x −5x *7x−3, f '-x.=3x −10x*7

standard Newton-Raphson method


3 2
xi −5x i *7x i −3
xi *1=x i− 2
3x i −10x i *7

1
Notice linearity in error 1t , i *1~ 1
2 t,i

19
3 2 2
f -x.=x −5x *7x−3, f '-x.=3x −10x*7, f ' '-x.=6x−10

- x3i −5x 2i *7x i−3 . - 3x 2i −10x i *7 .


xi*1=x i− 2
- 3x i −10x i *7 . −- x3i −5x 2i *7x i −3 . - 6x i −10 .
2

Notice quadratic convergence


2
1t , i*1~1t , i

20
21
Final note

Use the modified Newton-Raphson method to find a multiple or repeated


root

Use the standard Newton-Raphson method to find simple roots

22
Exercise Work

Questions 6.12 and 6.18

23

You might also like