Professional Documents
Culture Documents
Gaza Strip
2
6.3 THE SECANT 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 .
4
Simple Finite Difference Approximation to a Derivative
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 .
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
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
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
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
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
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.
'
f - xi . f - xi .
x i *1 =x i− ' 2 ''
f - x i . −f - x i . f - x i .
18
Example 6.10
3 2 2
f -x.=x −5x *7x−3, f '-x.=3x −10x*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
20
21
Final note
22
Exercise Work
23