Return to computing page for the first course APMA0330
Return to computing page for the second course APMA0340
Return to computing page for the fourth course APMA0360
Return to Mathematica tutorial for the first course APMA0330
Return to Mathematica tutorial for the second course APMA0340
Return to Mathematica tutorial for the fourth course APMA0360
Return to the main page for the course APMA0330
Return to the main page for the course APMA0340
Return to the main page for the course APMA0360
Return to Part III of the course APMA0330
This section discusses some practical algorithms for finding a point p
in the general equation
of the form p = g(p), for some continuous function
g(x). Existence of solution to the equation above is known as the
fixed point theorem, and it has numerous generalizations. This theorem has many
applications in mathematics and numerical analysis. For instance, Picard's
iteration and Adomian decomposition method are based on fixed point theorem.
Iteration is a fundamental principle in
computer science. As the name suggests, it is a process that is repeated until
an answer is achieved or stopped. In this section, we study the process of iteration using repeated substitution.
A fixed point of a function g(x) is a real number p such that p = g(p).
More specifically, given a functiong defined on the
real numbers with real values and given a point x_{0} in the domain of g, the fixed point (also called Picard's) iteration is
which gives rise to the sequence \( \left\{ x_i \right\}_{i\ge 0} . \) If this sequence
converges to a point x, then one can prove that the obtained x is a fixed point of g, namely,
\[
x = g(x ) .
\]
One of the most important features of iterative methods is their convergence rate defined by the order of convergence. Let { x_{n} } be a sequence converging to α and let ε_{n} = x_{n} - α.
If there exists a real number p and a nonzero positive constant C_{p} such that
then p is called the order at which the sequence { x_{n} } converges to the root α of the fixed point equation x = g(x), and C_{p} is the asymptotic error constant.
When one wants to apply a function until the result stops changing,
Mathematica provides dedicated commands FixedPoint and FixedPointList
to achieve that. We present an alternative
approaches.
One can also use NSolve command, as the following example shows.
Example 1:
Suppose we want to find all the fixed points of
\( f(x)=x\, \sin (1/x) . \) Since it has infinitely many fixed points, so there would
in theory have infinitely many outputs.
Let f(x) be the following piecewise function:
f[x_] := Piecewise[{{x Sin [1/x], -1 <= x < 0 || 0 < x <= 1}}, 0]
Example 2:
Suppose we need to solve the polynomial equation
\( x^3 + 4\,x^2 -10 =0 , \) which we
rewrite as \( 4\, x^2 = 10 - x^3 . \) Taking square root, we reduce our problem to fixed point problem:
\( x = \frac{1}{2}\, \sqrt{10 - x^3} . \) Then we force Mathematica to use a given precision is to use Block
and make $MinPrecision equal to $MaxPrecision. So you can obtain your result as:
Mathematical operations on numbers of a given precision cannot guarantee the output to maintain the precision of the input numbers. In general precision will
decrease. The amount of decrease depends on the operations and some operations will cause precision to decrease significantly. If you want a specific precision
on the final result then the working precision should be higher than the desired output precision. Frequently, the working precision is done at twice the
desired output precision to allow for significant lose of precision during complex calculations. Sometimes using machine precision numbers will perform well.
Example 4:
Consider \( g(x) = 10/ (x^3 -1) \) and the fixed point iterative scheme \( x_{i+1} = 10/ (x^3_i -1) ,\) with the initial guess x_{0} = 2.
If you repeat the same procedure, you will be surprised that the iteration
is gone into an infinite loop without converging.
■
Theorem (Banach): Assume that the function g is continuous on the interval [𝑎,b].
If the range of the mapping y = g(x) satisfies \( y \in [a,b] \) for all \( x \in [a,b] , \) then g has a fixed point in [𝑎,b].
Furthermore, suppose that the derivative g'( x) is defined over (𝑎,b) and that a positive constant (called Lipschitz constant) L < 1 exists with \( |g' (x) | \le L < 1 \) for all \( x \in (a,b) , \) then g has a unique fixed point P in [𝑎,b]. ■
Stefan Banach (was born in 1892 in Kraków, Austria-Hungary and died 31 August
1945 in Lvov, Ukrainian SSR, Soviet Union) was a Polish mathematician who is
generally considered one of the world's most important and influential
20th-century mathematicians. He was one of the founders of modern functional
analysis, and an original member of the Lwów School of Mathematics. His major
work was the 1932 book, Théorie des opérations linéaires (Theory of Linear
Operations), the first monograph on the general theory of functional
analysis.
Rudolf Otto Sigismund Lipschitz (1832--1903) was a German mathematician who
made contributions to mathematical analysis (where he gave his name to the
Lipschitz continuity condition) and differential geometry, as well as number
theory, algebras with involution and classical mechanics.
Theorem: Assume
that the function g and its derivative are continuous on the interval
[𝑎,b]. Suppose that \( g(x) \in [a,b] \) for all
\( x \in [a,b] , \) and the initial approximation
x_{0} also belongs to the interval [a,b].
If \( |g' (x) | \le K < 1 \) for all
\( x \in (a,b) , \) then the iteration
\( x_{i+1} = g(x_i ) \) will converge to the unique
fixed point \( P \in [a,b] . \) In this case,
P is said to be an attractive fixed point:
\( P= g(P) . \)
If \( |g' (x) | > 1 \) for all
\( x \in (a,b) , \) then the iteration
\( x_{i+1} = g(x_i ) \) will not converge to
P. In this case, P is said to be a repelling fixed point and
the iteration exhibits local divergence. ■
In practice, it is often difficult to check the condition
\( g([a,b]) \subset [a,b] \) given in the previous
theorem. We now present a variant of it.
Theorem: Let P be a fixed point of g(x), that is, \( P= g(P) . \) Suppose g(x) is differentiable on \( \left[ P- \varepsilon , P+\varepsilon \right] \quad\mbox{for some} \quad \varepsilon > 0 \) and g(x) satisfies the condition \( |g' (x) | \le K < 1 \) for all \( x \in \left[ P - \varepsilon , P+\varepsilon \right] . \) Then the sequence \( x_{i+1} = g(x_i ) , \) with starting point \( x_0 \in \left[ P- \varepsilon , P+\varepsilon \right] , \) converges to P.
Remark: If g is invertible then P is a fixed point of g if and only if P is a fixed point of g^{-1}.
Remark: The above theorems provide only sufficient conditions. It is possible for a function to violate one or more of the
hypotheses, yet still have a (possibly unique) fixed point. ■
The Banach theorem allows one to find the necessary number of iterations for a given error "epsilon." It can be calculated by the following formula (a-priori error estimate)
Example 5:
The function \( g(x) = 2x\left( 1-x \right) \)
violates the hypothesis of the theorem because it is continuous everywhere \( (-\infty , \infty ) . \) Indeed, g(x) clearly does not map the interval \( [0.5, \infty ) \) into itself; moreover, its derivative \( |g' (x)| \to + \infty \) for large x. However, g(x) has fixed points at x = 0 and x = ½.
■
Example 6:
Consider the equation
\[
x = 1 + 0.4\, \sin x , \qquad \mbox{with} \quad g(x) = 1 + 0.4\, \sin x .
\]
Note that g(x) is a continuous functions everywhere and \( 0.6 \le g(x) \le 1.4 \) for any \( x \in \mathbb{R} . \) Its derivative \( \left\vert g' (x) \right\vert = \left\vert 0.4\,\cos x \right\vert \le 0.4 < 1 . \) Therefore, we can apply the theorem and conclude that the fixed point iteration
we do not expect convergence of the fixed point iteration
\( x_{k+1} = 1 + 2\, \sin x_k . \)
■
I. Aitken's Algorithm
Sometimes we can accelerate or improve the convergence of an algorithm with
very little additional effort, simply by using the output of the algorithm to
estimate some of the uncomputable quantities. One such acceleration was
proposed by A. Aiken. Alexander Craig "Alec" Aitken was born in 1895 in
Dunedin, Otago, New Zealand and died in 1967 in Edinburgh, England, where he
spent the rest of his life since 1925. Aitken had an incredible memory
(he knew π to 2000 places) and could instantly multiply, divide and take
roots of large numbers. He played the violin and composed music to a very
high standard.
Suppose that we have an iterative process that generates a sequence of numbers \( \{ x_n \}_{n\ge 0} \)
that converges to α. We generate a new sequence \( \{ q_n \}_{n\ge 0} \) according to
Theorem (Aitken's Acceleration): Assume that the sequence \( \{ p_n \}_{n\ge 0} \) converges linearly to the limit p and that \( p_n \ne p \) for all \( n \ge 0. \) If there exists a real number A < 1 such that
converges to p faster than \( \{ p_n \}_{n\ge 0} \) in the sense that \( \lim_{n \to \infty} \, \left\vert \frac{p - q_n}{p- p_n} \right\vert =0 . \)
▣
This algorithm was proposed by one of New Zealand's greatest mathematicians Alexander Craig "Alec" Aitken (1895--1967).
When it is applied to determine a fixed point in the equation \( x=g(x) , \) it consists in the following stages:
calculate x_{6} as the extrapolate of \( \left\{ x_3 , x_4 , x_5 \right\} . \) Continue this procedure, ad infinatum. ■
We assume that g is continuously differentiable, so according to Mean Value Theorem there exists
ξ_{n-1} between α (which is the root of \( \alpha = g(\alpha ) \) ) and
x_{n-1} such that
Since we are assuming that \( x_n \,\to\, \alpha , \) we also know that
\( g' (\xi_n ) \, \to \,g' (\alpha ) ; \) thus, we can denote
\( \gamma_n \approx g' (\xi_{n-1} ) \approx g' (\alpha ) . \) Using this notation, we get
Now we present version 1 of Aitken extrapolation that does not take as much
advantage of acceleration as is possible.
Aitken Extrapolation, Version 1
x1 = g(x0)
x2 = g(x1)
for k=1 to n do
if (dabs[x1 - x0) > 1.d-20) then
gamma = (x2 - x1)/(x1 - x0)
else
gamma = 0.0d0
endif
q = x2 + gamma*(x2 - x1)/(1 - gamma)
if(abs(q - x2) < error) then
alpha = q
stop
endif
x = g(x2)
x0 = x1
x1 = x2
x2 = x
enddo
Since division by zero---or a very small number---is possible in the algorithm's computation of γ, we put in a
conditional test: Only if the denominator is greater than 10^{-20} do we carry through the division.
Example 9:
Repeat the previous example according to version 1.
■
II. Steffensen's Acceleration
Johan Frederik Steffensen (1873--1961) was a Danish mathematician, statistician, and actuary who did research in the fields of calculus of finite differences and interpolation. He was a professor of actuarial science at the University of Copenhagen from 1923 to 1943. Steffensen's inequality and Steffensen's iterative numerical method are named after him.
When Aitken's Δ² process is combined with the fixed point iteration, the result is called Steffensen's acceleration. Starting with p_{0}, two steps of iteration procedure should be performed
If at some point \( \Delta^2 p_n =0 \) (which appears in the denominator), then we stop and select the current value of p_{n+2} as our approximate answer.
Steffensen's acceleration is used to quickly find a solution of the fixed-point equation x = g(x) given an initial approximation p_{0}. It is assumed that both g(x) and its derivative are continuous, \( | g' (x) | < 1, \) and that ordinary fixed-point iteration converges slowly (linearly) to p.
for \( n=0,1,2,\ldots . \) Wegstein (1958) found
that the iteration converge differently
depending on the value of q.
q < 0
Convergence is monotone
0 < q < 0.5
Convergence is oscillatory
0.5 < q < 1
Convergence
q > 1
Divergence
Wegstein's method depends on two first guesses x^{0} and x^{1} and poor start may cause the process to fail, converge to another root, or, at best, add unnecessary number of iterations.
Example 12:
Repeat the previous example according to Wegstein's method.
■
IV. Krasnosel’skii--Mann iteration algorithm (K-M)
Mark Krasnosel'skii
William Robert Mann
There are several iteration techniques for approximating fixed points equations of various
classes. The Picard’s iteration technique, the Mann
iteration technique and the Krasnosel’skii iteration technique are the most used of all those methods.
Mark Alexandrovich Krasnosel'skii (1920--1997) was a Soviet, Russian mathematician renowned for his work on nonlinear functional analysis and its applications. William Robert Mann (1920--2006) was a mathematician from Chapel Hill, North Carolina, USA.
The K--M algorithm is used to a fixed point equation
\[
T\,x = x ,
\]
where T is a self-mapping of a closed subset. The K--M algorithm generates a sequence { x_{m} } according to the recursive formula
where α_{n} is a sequence in the interval (0,1) and the initial guess x_{0} is chosen arbitrary. Obviously, for the special case α_{n} =1, the Krasnosel’skii--Mann iterative scheme results in Picard's method.
Example 13:
Repeat the previous example according to version 1.
■
V. The Adomian decomposition method
The Adomian decomposition method (ADM) is a method for solving nonlinear equations. The crucial step of this method includes the decomposition of the nonlinear term into so called Adomian's polynomials.
Consider the nonlinear equation f(x) = 0, which can be transformed into
\[
x = g(x) ,
\]
where g(x) is a nonlinear function, which is assumed to have as many derivatives as needed. Let x = c be an estimated root of the above equation x = g(x). By making a shift u = x - c, we transfer the given fixed problem to the following one:
\[
u + c = g( u+c) \qquad\Longrightarrow \qquad u = g( u+c) - c .
\]
The above equation is more friendly for the Adomian decomposition method (ADM for short) because u has small value, so u_{0} = 0 will be its initial approximation. Then we represent u as the series that is assumed to converge:
\[
u = \sum_{i\ge 0} u_i = \sum_{i\ge 1} u_i .
\]
Hence, the initial approximation is zero: u_{0} = 0, which corresponds to x_{0} = c.
The nonlinear term g(u+c) can be also decomposed into the Adomian polynomials, which leads to the equation
Depending on the initial approximation c, we can calculate its 5-term Adomian approximation using the following Mathematica code
AdoFixed5[c_, g_] := Module[{x},
x = c +
N[g[c]]*(1 + N[D[g[x], x] /. x -> c] +
N[D[g[x], x] /. x -> c]^2 + N[D[g[x], x] /. x -> c]^3 +
N[(D[g[x], x] /. x -> c)^4] +
0.5*N[g[c]]*N[D[g[x], x, x] /. x -> c] +
N[3/2 *g[c]]*N[D[g[x], x] /. x -> c]*
N[D[g[x], x, x] /. x -> c ] +
N[3*g[c]]*N[D[g[x], x] /. x -> c]^2 *
N[D[g[x], x, x] /. x -> c]) +
N[(g[c])^3 /3] *(0.5*N[D[g[x], x, x, x] /. x -> c] +
2*N[D[g[x], x] /. x -> c]*N[D[g[x], x, x, x] /. x -> c] +
N[1/8*g[c]]*N[D[g[x], {x, 4}] /. x -> c])]
The ADM does not assure the existence and uniqueness of solutions, but it can be safely applied in cases when a fixed point theorem holds. This will be demonstrated in the following examples.
Example 14:
Let us calculate the first five Adomian polynomails for g(x) = 1/x = x^{-1}:
Example 15:
Consider the
simplest algebraic equation---quadratic equation
\[
a\, x^2 +b\, x +c =0, \qquad b\ne 0,
\]
where a, b, and c are some given constants. The case b = 0 can be easily included in our consideration by adding and subtracting x. Expressing x from it, we obtain
Our next step is to express the nonlinear term x² as a series over Adomian's polynomials.
More specifically, we can write the quadratic equation in the operator form
\[
L\,x = N\left[ x \right] + g ,
\]
where L x = x, N[x] = -ax²/b = βx² = x², and g = -c/b = α 6. We decompose the nonlinear term into the Adomian polynomials:
The series converges when \( \left\vert 4\alpha\beta \right\vert <1 , \) which is equivalent to \( \displaystyle \left\vert 4\left( -\frac{c}{b} \right) \left( -\frac{a}{b} \right) \right\vert <1 . \) So the series converges when \( b^2 > \left\vert a\,c \right\vert . \) This condition is violated for our case and series diverges.
We rewrite our algebraic equation as \( x= g(x) = x^2 -6 . \) Then the derivative, \( g' (x) = 2x , \) at two roots is \( |g' (3) | > 1 \) and \( |g' (-2) | = 4 > 1 , \) so our equation is not a contraction (as required by condition discovered by Cherruault for ADM convergence). To overcome this misfortune, we add and subtract 4x to both sides of the given equation
which we expect to be approximations to the root -2.
■
Example 16:
Consider the transcendent equation
\[
x\,\cos x - e^{x}\, \sin x +x = 0,
\]
which we transfer into fixed point expression by subtracting x from both sides:
\[
x= g(x) , \qquad\mbox{where} \quad g(x) = e^{x}\, \sin x - x\,\cos x .
\]
First, we find its nontrivial (≠ 0) root with the standard Mathematica command:
FindRoot[Exp[x]*Sin[x] - x*Cos[x] - x == 0, {x, 0.5}]
{x -> 0.656321}
So the root is 0.6563205569359923.
Let x = c be an estimated root of the above equation x = g(x). By making a shift u = x - c, we transfer the given fixed problem to the following one:
\[
u + c = g( u+c) \qquad\Longrightarrow \qquad u = g( u+c) - c .
\]
Assuming that the null of the above equation is represented by a convergent series
which is wrong. This indicates that our initial approximation x_{0} = 0.5 is too far for the ADM method. Now we try another initial approximation: x_{0} = 0.6. Computations show.
x3 = x2*(D[g[x], x] /. x -> x0) + x1^2/2*(D[g[x], x, x] /. x -> x0)
-0.267617
x4 = x3*(D[g[x], x] /. x -> x0) + x1*x2*(D[g[x], x, x] /. x -> x0) +
x1^3/6*(D[g[x], x, x, x] /. x -> x0)
-0.506002
x5 = x4*(D[g[x], x] /. x -> x0) + (x2^2/2 + x1*x3)*(D[g[x], x, x] /.
x -> x0) + 1/2*x1^2 *x2*(D[g[x], {x, 3}] /. x -> x0) +
x1^3 *x2/6*(D[g[x], {x, 4}] /. x -> x0) +
x1^5/120*(D[g[x], {x, 5}] /. x -> x0)
-0.911373
Adding these components, we get
p5 = x0 + x1 + x2 + x3 + x4 + x5
which gives again the wrong answer.
Therefore, we conclude that this fixed point problem does not satisfy conditions of fixed point theorem and the ADM method diverges independently what initial guess was made.
■
Example 17:
Consider the transcendent equation
\[
3\,x\,\cos x - e^{-x}\, \sin x +x = 0,
\]
which we transfer into fixed point expression by subtracting x from both sides:
\[
x= g(x) , \qquad\mbox{where} \quad g(x) = e^{-x}\, \sin x - 3\,x\,\cos x .
\]
By plotting these functions, g(x) and x, we estimate its fixed point to be around 1.8:
Krasnosel’skii, M.A., Two remarks on the method of successive approximations,
Uspekhi Matematicheskikh Nauk, 1955, vol. 10, pp. 123--127.
Mann, W.R., Mean value methods in iteration,
Proceedings of the American Mathematical Society, 1953, vol.4, pp. 506--510.
McNamee, J.M., Numerical Methods for Roots of Polynomials, Part I, Elsevier, Amsterdam, 2007.
Ortega, J.M., Rheinboldt, W.C., Iterative Solution of Nonlinear Equations in Several Variables, Academic Press, New York, 1970.
Ostrowski, A.M., Solutions of Equations and System of Equations, Academic Press, New York, 1960
Petković, M.S., Neta, R., Petković, L.D., Džunić, J., Multipoint methods for solving nonlinear equations: A survey, Applied Mathematics and Computation, 2014, Vol. 226, pp. 635--660.
Traub, J.F., Iterative Methods for the Solution of Equations, Prentice-Hall, Englewood Cliffs, New Jersey, 1964.
Wegstein, J.H., Accelerating convergence of iterative processes, Communications of the Association for the Computing Machinery (ACM), 1, 9--13, 1958.
Return to Mathematica page
Return to the main page (APMA0330)
Return to the Part 1 (Plotting)
Return to the Part 2 (First Order ODEs)
Return to the Part 3 (Numerical Methods)
Return to the Part 4 (Second and Higher Order ODEs)
Return to the Part 5 (Series and Recurrences)
Return to the Part 6 (Laplace Transform)
Return to the Part 7 (Boundary Value Problems)