Zeros of functions with Matlab: Fixed point iteration
Zeros of functions with Matlab: Fixed point iteration
Emma Perracchione
Corso di Calcolo Numerico per Ingegneria Meccanica - Matr. PARI (Univ. PD)
Gli esercizi sono presi dal libro: S. De Marchi, D. Poggiali, Exercices of numerical calculus with solutions in Matlab/Octave.
A.A. 2018/2019
Materiale
Materiale
TUTTO IL MATERIALE SI TROVA AL SEGUENTE LINK E VERRA’
AGGIORNATO AD OGNI LEZIONE.
https://www.math.unipd.it/~emma/CN1819.html OPUURE VEDASI
https://elearning.unipd.it/dii/course/view.php?id=1720
Zeros of functions with Matlab: Fixed point iteration Remarks
Introduction
Finding the zeros of a function means finding:
¯
x : f (¯ x ) = 0.
We already know two approaches to solve such problem:
1
bisection method,
2
Newton.
In this lecture we will see the fixed point iteration.
It is based on building {x k } k≥1 converging to the fixed-point of an
auxiliary function g (x ) = x − f (x ).
Remarks
Bisection
Property
Given a continuous function f : [a, b] −→ R such that f (a)f (b) < 0 then
∃ ¯ x ∈ (a, b) so that f (¯ x ) = 0.
Thus, at the first step of the bisection method, we evaluate the mid point m 1 of [a, b] = [a 1 , b 1 ]. If f (m 1 )f (a) < 0 then
[a 2 , b 2 ] = [a 1 , m 1 ], else
[a 2 , b 2 ] = [m 1 , b 1 ].
We proceed in this way until a stopping criterion is satisfied, such as
f (m k ) < τ , for a fixed tolerance τ , at a certain step k.
Zeros of functions with Matlab: Fixed point iteration Remarks
Newton
Theorem (Convergence of Newton’s method)
Let f (x ) ∈ C 2 ([a, b]). Suppose f (¯ x ) = 0 and f
0(¯ x ) 6= 0 for some
x ∈ (a, b). Then, there exists δ ∈ R, δ > 0 such that for x ¯ 0 ∈ [¯ x − δ, ¯ x + δ]
the iterations via Newton’s method x k+1 = x k − f (x k )
f 0 (x k ) , k = 1, 2, . . . , converges quadratically to ¯ x .
The main drawback is that with Newton’s method we need to start
with an initial condition sufficiently close to the zeros of functions.
Exercises
Exercise 0
Exercise
Modify the script Newton for multiple zeros. Call it NewtonMod.
Hint
The iteration becomes
x k+1 = x k − m f (x k )
f 0 (x k ) , k = 1, 2, . . . ,
where m is the multiplicity of the zero.
Zeros of functions with Matlab: Fixed point iteration Remarks
Fixed point
We want to find ¯ x so that f (¯ x ) = 0 or equivalently the fixed point of g (x ) = x , for f (x ) = x − g (x ) = 0.
Theorem
Let us consider x (k+1) = g (x (k) ), for k ≥ 0, with x (0) given. If
1
g : [a, b] → [a, b];
2
g ∈ C 1 ([a, b]);
3
∃K < 1 such that |g
0(x )| < K ∀x ∈ [a, b];
then g has a unique fixed point ¯ x in [a, b] and {x (k) } k>1 converges to
¯
x ∈ [a, b].
Exercises
Exercise 1
Exercise
Write a Matlab function called fixedpoint for computing the zeros of functions with the fixed point iteration.
Hint
Use an exit criterion in case the method does not converge.
For the fixed point iteration the inputs that we need are g,x0,tol,maxiter.
Fix the stopping criterion for the fixed point as abs(x1-x0)<tol, where
x1,x0 are two successive iterations.
Zeros of functions with Matlab: Fixed point iteration Exercises