APM2613 Tut01 0 2023
APM2613 Tut01 0 2023
APM2613 Tut01 0 2023
Numerical Analysis I
APM2613
Year Module
This tutorial letter contains Tutorial 1 to compliment Assignment 01. Please read it along
Lesson 2 and Chapter 2 of the textbook.
BARCODE
Open Rubric
1 Tutorial 1: Solutions of Non-linear Equations
Reading: Chapter 2 and Chapter 10.2 of textbook; Lesson 2
Other resources:
https://sites.google.com/site/numericalanalysis1burden/
1.1 Objective
To go over (an) example(s) and give exercises to practise on the use of various methods to
solve a non-linear equation.
3. Newton’s method and its extensions: Secant method; Regula falsi method;
As these methods are applied, the following will be highlighted where appropriate:
Key points of other methods used for specific purposes in the study of solutions of
nonlinear equations;
Nature of the problem The methods are used to solve a nonlinear equation in two
forms, namely,
and the
x = g(x) referred to as thefixed − pointproblem (2)
The root problem involves rearranging the given equation so that one side of the equation
is 0. Whereas a solution of this problem is the usual x-intercept of the graph of f (x), the
solution of the fixed-point problem is x-value at the intersection of y = x and y = g(x).
It is also worth noting that the use of the terms root or, zero and fixed-point in the
context of these two equations.
1
Example 1
Consider the problem of finding the zeros of the function f (x) = x3 − 9x2 + 12 using the
various methods.
f ( x) = x 3- 9x 2+ 12
150
100
50
f ( x)
0 x= - 1. 0905
x= 1. 2438 x= 8. 8467
-50
-100
-150
-200
-4 -2 0 2 x 4 6 8 10
2
which confirms that there is a root between 4 and 10; i.e. f (4) and f (10) have opposite
signs).
Furthermore, the convergence rate of the method is simple and given in Theorem 2.1.
Termination criterion
Since the next iterate is obtained simply as the midpoint of the current interval, it is
possible to determine the number of iterations n required to attain a specified tolerance ϵ
by solving the inequality
b−a
< ϵ, b > a (3)
2n
for n.
3
f (x) = 0 in various ways to obtain the fixed-point equation x = g(x) associated with an
iteration formula xk+1 = g(xk ). The different ways of rearranging f (x) = 0 lead to different
expressions of g(x) in x = g(x).
Example
For our example, the root equation f (x) = x3 −9x2 +12 = 0 has solutions x = −1.0444; 1.3165; 8.7279;
i.e. can be rearranged in various expressions of x = g(x), to name one,
x3 + 12
x= ,
9x
3
where g(x) = x 9x+12
, which is a hyperbola which is asymptotic to x = 0.
Graphically, the line y = x crosses the hyperbola at the values of x corresponding to the
roots of f (x). (You can verify this for yourself.) The iterative formula is
g( x) = ( x 3+ 12) / 9x
15
10 x= 8. 8467
5 y= x
y= g( x)
y x= 1. 2438
0 x= - 1. 0905
-5
-10
-15
-2 0 2 x 4 6 8 10
x3 + 12
xk+1 =
9x
Various iterations using different initial values x0 lead to different results as shown in the
table:
x0 Result
-2 converges to 1.2438
2 converges to 1.2438
5 converges to 1.2438
8 converges to 1.2438
10 diverges
If you apply the Fixed-point Theorem to check the intervals from which x0 can be chosen
and obtain convergence, you would solve the inequality
2 8
|g ′ (x)| < 1 or − 1 < x + x−2 < 1
9 3
4
x3 + 12
with g(x) = .
9x
You can think of other iteration formulae x = g(x) and try them using different initial
values.
In a sense, the rest of the methods discussed for solving nonlinear equations entails finding
different expressions of g(x).
f (xi )
xi+1 = xi − .
f ′ (xi )
So with our example, the root equation is f (x) = x3 − 9x2 + 12 = 0, from which we get
f ′ (x) = 3x2 − 18x. The iterative formula then becomes
x3 − 9x2 + 12
xk+1 = xk −
3x2 − 18x
Having determined that there are three roots between −2 and 10, we run the algorithm for
different initial values, x0 and get the following results:
x0 = −2 x0 = 2 x0 = 7 x0 = 10
−2.0000 2.0000 7.0000 10.0000
−1.3333 1.3333 11.0952 9.0667
−1.1162 1.2460 9.5036 8.8571
−1.0909 1.2438 8.9281 8.8467
−1.0905 1.2438 8.8482 8.8467
−1.0905 . . . 8.8467 ...
We can see how fast the method converges for the various initial values. Note, in particular
that the convergence is not always monotonic; see the case for x0 = 7.
So Newton’s method is straight forward and normally much faster. We use the example
to demonstrate the variants of Newton’s method: the secant method and the regula falsi
methods. For these methods the derivative is approximated by the slope
f (xk ) − f (x + k − 1)
f ′ (xk ) ≈
(x + k − xk−1 )
to get the iterative algorithm
xk − xk−1
xk+1 = xk − f (xk ) ·
f (xk ) − f (xk−1 )
NB: These method require two initial values, x0 and x1 .
5
1.1.5 The Secant and Regula Falsi Methods
Secant Regula Falsi
4.0000 4.0000
10.0000 10.0000
6.2667 6.2667
7.9834 7.9834
10.1136 10.1136
8.6127 8.6127
8.7887 8.7887
8.8500 8.8500
8.8466 8.8466
8.8467 8.8467
8.8467 8.8467
where
x1
x=
x2
While Newton’s method for f (x) = 0 uses the iteration (fixed-point) formula
6
where J(x1 , x2 ) is now the Jacobian of F (x1 , x2 ), defined by
JF (x1 , x2 ) = ∂F ∂x 1 ∂x2
2 (x1 , x2 ) ∂F2 (x1 , x2 )
∂x1 ∂x2
which now replaces f ′ (x) in the case of one variable function.
Example 2
Consider the problem of approximating the solution of the nonlinear system:
5x21 = x22
0.25(sin x1 + cos x2 ) = x2
Here
F1 (x1 , x2 ) 5x21 − x22
F (x1 , x2 ) = =
F2 (x1 , x2 ) x2 − 0.25(sin x1 + cos x2 )
The Jacobian is
∂F1 ∂F1
∂x1 ∂x2 10x1 −2x2
J(x1 , x2 ) = ∂F2 ∂F2 =
∂x1 ∂x2
−0.25(cos x1 )1 + 0.25(sin x2 )
Iteration 1
" # −1
(1)
x1 0 0 4 0
(1) = − ∗
x2 0 −4 −12 0.2500
0.062500
=
0
Iteration 2
" # −1
(2)
x1 0.062500 −044274 4.0 0.019531
(2) = − ∗
x2 0 −3.8750 −12.0 0.234385
0.13560
=
−0.0040737
7
Carrying out a few more iterations yields
k x1 x2
0 0 0
1 0.0625 0
2 0.1356 −0.0041
3 0.2570 −0.0241
4 0.5430 −0.0925
5 1.6178 −0.3362
6 7.2729 −0.6543
7 9.0181 0.3750
8 9.8137 1.6723
9 10.3153 −5.2785
10 10.7114 −5.2483
11 11.0374 −5.2335
12 11.3143 −5.2308
13 11.5550 −5.2380