Page 212 - Applied Numerical Methods Using MATLAB
P. 212
PROBLEMS 201
4.3 Recursive (Self-Calling) Routine for Bisection Method
As stated in Section 1.3, MATLAB allows us to make nested (recursive) rou-
tines which call itself. Modify the MATLAB routine “bisct()” (in Section
4.2) into a nested routine “bisct_r()” and run it to solve Eq. (P4.2.1).
4.4 Newton Method and Secant Method
As can be seen in Fig. 4.5, the secant method introduced in Section 4.5
was devised to remove the necessity of the derivative/gradient and improve
the convergence. But, it sometimes turns out to be worse than the Newton
method. Apply the routines “newton()”and “secant()” to solve
3
2
f p44 (x) = x − x − x + 1 = 0 (P4.4)
starting with the initial point x 0 =−0.2 one time and x 0 =−0.3 for another
shot.
4.5 Acceleration of Aitken–Steffensen Method
o
A sequence converging to a limit x can be described as
o
o
x − x k+1 = e k+1 ≈ Ae k = A(x − x k )
o
x − x k+1
with lim = A(|A| < 1) (P4.5.1)
o
k→∞ x − x k
In order to think about how to improve the convergence speed of this
sequence, we define a new sequence p k as
o o
x − x k+1 x − x k o o o 2
≈ A ≈ ; (x − x k+1 )(x − x k−1 ) ≈ (x − x k )
o o
x − x k x − x k−1
o
o
o
o 2
o 2
(x ) − x k+1 x − x k−1 x + x k+1 x k−1 ≈ (x ) − 2x x k + x 2
k
x k+1 x k−1 − x 2
o k
x ≈ = p k (P4.5.2)
x k+1 − 2x k + x k−1
(a) Check that the error of this sequence p k is as follows.
x k+1 x k−1 − x 2
o o k
x − p k = x −
x k+1 − 2x k + x k−1
x k−1 (x k+1 − 2x k + x k−1 ) − x 2 + 2x k−1 x k − x 2
o k−1 k
= x −
x k+1 − 2x k + x k−1
(x k − x k−1 ) 2
o
= x − x k−1 +
x k+1 − 2x k + x k−1
o
o
(−(x − x k ) + (x − x k−1 )) 2
o
= x − x k−1 +
o
o
o
−(x − x k+1 ) + 2(x − x k ) − (x − x k−1 )
o
2
(−A + 1) (x − x k−1 ) 2
o
= x − x k−1 + = 0 (P4.5.3)
o
2
(−A + 2A − 1)(x − x k−1 )