Numerical Methods With Applications
Numerical Methods With Applications
Numerical Methods With Applications
APPLICATIONS
(MEC500)
Open methods:
◦ require only a single starting value or two starting values
that do not necessarily bracket a root.
◦ based on formula to project from xi to xi+1in iterative
manner.
◦ may diverge as the computation progresses, but when they
do converge, they usually do so much faster than
bracketing methods.
Introduction
Bracketing method
Converging open method
Fixed-Point Iteration
Open method employs a formula to predict the roots.
Simple fixed-point also called one-point iteration or
successive substitution
Developing formula for simple fixed-point iteration:
Solution:
Rewrite as x = g(x) by isolating x
x ex
xi 1 ex i Simple fixed-point iteration formula
0 0.0000 100.0000
1 1.0000 100.0000 76.322 0.763
2 0.3679 171.828 35.135 0.460
3 0.6922 46.854 22.050 0.628
How to overcome
◦ Choose different initial guess
◦ Modify the function g(x) into another form
◦ Choose another
method
Fixed-Point Iteration: Convergence
Convergence:
◦ move closer to the true value as
computation progress
Checking for possibility of convergence:
1.Express x = g(x) as a pair of equations
◦ y1 = f(x1)= x & y2 = f(x2) = g(x)
◦ y1 & y2: component equations
2.Plot y1& y2 separately.
◦ The root is at the intersection of the
component equations.
◦ This method can be used to check for
convergence of the iteration
◦ In general there are 4 possible shapes
of plot of y2= g(x)
Fixed-Point Iteration: Convergence
Initial guess = x0 & xi+1=g(xi)
Open method will converge if
g (x) 1
[Note: Slope of f(x1) = y1 = 1]
a. Convergent, 0≤g’(x)<1
b.
Convergent, -1<g’(x)≤0
c. Divergent, g’(x)>1
d. Divergent, g’(x)<-1
Newton-Raphson
The most widely used of all root-finding formula
Based on forming the tangent line to the f(x) curve at some guess
x, then following the tangent line to where it crosses the x-axis.
Derivation of formula:
From the geometry of the graph, first
derivative is equivalent of the slope:
f (xi )
xi 1 xi
f (xi )
xi = initial guess
xi+1 = improve estimate
[Alternatively, the formula can be developed From Taylor series]
Newton-Raphson
1. Evaluate f’(x) symbolically
2. Use an initial guess of the root, x i, to estimate the new value of
the root, as
f (xi )
xi 1 xi
f (xi )
3. Find the absolute relative
approximate error, as
xi 1 xi
a 100%
xi 1
4. Repeat STEP 2 & 3 until one of the following is reached:
◦ a s
◦ allowable number of iterations
Example 2
Newton Raphson
x
Use Newton-Raphson method to estimate f (x) e x,
employing initial guess x0 = 0.
f (x) ex x
f (x) ex 1
f (xi ) ex i xi
Thus, xi 1 xi xi
f (xi ) ( ex i 1)
i xi |εt|%
0 0.000000000 100
1 0.500000000 11.8
Decrease faster
2 0.566311003 0.147
3 0.567143165 0.000022
4 0.567143290 <10-8
Remarks
A convenience method for function whose derivative can be
evaluated analytically
May not be convenience for function whose derivative cannot
be evaluated analytically
Termination criterion:
xi 1 xi
a s and a 100%
xi 1
Advantages:
◦ Converges fast (if converge): The error of the (i+1)-th
iteration
is roughly proportional to the square of the error
of the (i)-th iteration -this is called quadratic convergence
◦ Require only one guess
Remarks
Disadvantages:
◦ Divergence at inflection points
◦ Oscillations near local maximum and minimum
◦ Root jumping
◦ Division by zero
f (xi 1 ) f (xi )
f (xi )
xi 1 xi
Substitution of this approximation for the derivative
to the Newton-Raphson method equation gives:
f (xi )(xi 1 xi )
xi 1 xi
f (xi 1) f (xi )
This method requires two initial estimates of x but does not require an
analytical expression of the derivative.
The secant method has the same properties as Newton’s method.
Example 3
Secant Method
x
Use the secant method to estimate the root of f (x) e x.
Start with initial estimates of x−1 = 0 and x0 = 1.0.
Recall that the true root is 0.56714329.
First iteration:
x1 0 f (x1) 1.0000
x0 1 f (x0 ) 0.63212
0.63212(0 1)
x1 1 0.61270 t 8.0%
1 (0.63212)
Second iteration:
x0 1 f (x0 ) 0.63212
x1 0.61270 f (x1) 0.07081
0.07081(1 0.61270)
x2 0.61270 0.56384 t 0.58%
0.63212 (0.07081)
Example 3
Secant Method
Third iteration
x1 0.61270 f (x1 ) 0.07081
x2 0.56384 f (x2 ) 0.00518
0.00518(0.61270 0.56384)
x3 0.56384 0.56717 t 0.0048%
0.07081 (0.00518)
Secant Method
Advantages;
◦ Converge fast, if converge
◦ Requires two initial guesses that do not need to bracket the
root
Drawbacks;
◦ Division by zero
◦ Root jumping
Secant vs. False Position Method
f (xu )(xl xu )
xr xu
f (xl ) f (xu )
Secant Method
f (xi )(xi 1 xi )
xi 1 xi
f (xi 1 ) f (xi )
Comparison of several methods
Modified Secant Method
Secant method use 2 values to estimate the derivative:
f (xi )(xi 1 xi )
xi 1 xi
f (xi 1) f (xi )
Modified Secant method use a small perturbation of the independent
variable to estimate f’(x).
f (xi xi ) f (xi ) Where = a small perturbation fraction
f (xi )
xi (eg x0= 1.0 , δ = 0.01)
First iteration:
x0 1 f (x0 ) 0.63212
x0 x0 1.01 f (x0 x0 ) 0.64578
0.01(0.63212)
x1 1 0.537263 t 5.3%
0.64578 (0.63212)
Second iteration:
x1 0.537263 f (x1 ) 0.047083
x1 x1 0.542635 f (x1 x1 ) 0.038579
0.005373(0.047083)
x2 0.537263 0.56701 t 0.0236%
0.038579 0.047083
Example 4
Modified Secant Method
Third iteration
x2 0.56701 f (x2 ) 0.000209
x2 x2 0.57268 f (x2 x2 ) 0.00867
0.00567(0.000209)
x3 0.56701 0.567143 t 2.365 10 5%
0.00867 0.000209
Multiple Root –Problem & Solution
Multiple roots correspond to a point where the function is
tangent to x-axis more than one root
f (x) x 2 10x 25 (x 5)(x 5) Double roots = 5's
f (x) (x 3)(x 1)(x 1) Double roots = 1's
f (x) (x 3)(x 1)(x 1)(x 1) Triple roots = 1's
Example 5
Modified Newton-Raphson
Use both standard and modified Newton-Raphson methods to
evaluate the multiple roots of the following function with an
initial guess, x0= 0.
NOTE: True multiple roots are 1
f (x) x 3 5x 2 7x 3
Standard NR
f (x) 3x 10x 7
2
i xi εt (%)
Modified NR 0 0.0000000 100
i xi εt (%)
1 0.4285714 57
0 0.000000 100
2 0.6857143 31
1 1.105263 11
3 0.8328654 17
2 1.003082 0.31
4 0.9133290 8.7
3 1.000002 0.00024
5 0.9557833 4.4
6 0.9776551 2.2
Example 6
Modified Newton-Raphson
Use both standard and modified Newton-Raphson methods
to evaluate the single root of the following function with an
initial guess, x0= 4.
NOTE: True single root is 3
f (x) x 3 5x 2 7x 3
f (x) 3x 2 10x 7
Standard NR Modified NR
i xi εt (%) i xi εt (%)
0 4.000000 33.00 0 4.000000 33.0
1 3.400000 13.00 1 2.636364 12.0
2 3.100000 3.30 2 2.820225 6.0
3 3.008696 0.29 3 2.961728 1.3
4 3.000075 0.0025 4 2.998479 0.051
Exercise 1: Question
gm gcd
Determine the real root of f (cd ) tanhwith t v(t)
cd m
m = 80kg and v(4) = 36 m/s
(a) Graphically by taking x from 0 to 1 with increment of 0.1.
(b) Using bisection to determine the root to εs = 10%. Employ
initial guesses of xl = 0.1 and xu = 0.2.
(c) Perform the same computation as in (b) but use the false
position method and εs = 2 %.
Exercise 1: Solution
Substituting the given values
9.81(80) 9.81cd
f (cd ) tanh 4 36
cd 80
(a) Graphically ?
(b) Bisection, first iteration:
0.1 0.2
xr 0.15
2
f (0.1) f (0.15) 8.60291(0.204516) 0.175944
Therefore, the root is in the first interval and the upper guess is
redefined as x = 0.15.
u
Exercise 1: Solution
The second iteration is
0.1 0.15
xr 0.125
2
0.125 0.15
a 100% 20%
0.125
f (0.1) f (0.125) 8.60291(0.318407) 0.273923
Therefore, the root is in the second interval and the lower guess
is redefined as xu = 0.125. The iterations are displayed in the
following table:
i xl xu xr εa
Therefore, the root is in the first interval and the upper guess is redefined
as xu = 0.141809. The second iteration is:
0.0352109(0.1 0.141809)
xr 0.141809 0.140165
0.860291 (0.0352109)
0.140165 0.141809
a 100% 1.17%
0.140165
Solution:
Exercise 2: Solution
First iteration yields:
x1 sin( 0.5) 0.649637
0.649637 0.5
a 100% 23.034%
0.649637
Second iteration:
x1 sin( 0.649637) 0.721524
0.721524 0.649637
a 100% 9.9632%
0.721524
Exercise 2: Solution
The solutions are:
i xi |εa|% εt % εt,j/εt,j-1
a)
Using the Newton-Raphson method (three iterations, xi = 3.5).
b) Using the secant method (three iterations, xi–1 = 2.5 and xi = 3.5).
c) Using the modified secant method (three iterations, xi = 3.5, δ =
Solution:
0.01).
Exercise 3: Solution
a) Newton-Raphson Method to solve:
f (x) x 3 6x 2 11x 6.1
f (xi ) xi 3 6xi 2 11xi 6.1
xi 1 xi xi
f (xi ) 3xi 2 12xi 11
i xi |εa|%
0 3.500000 -
1 3.191304 9.673
2 3.068699 3.995
3 3.047317 0.702
Exercise 3: Solution
b) Secant Method to solve:
f (x) x 3 6x 2 11x x 6.1
f (xi )(xi 1 xi )
xi 1 xi
f (xi 1 ) f (xi )
x1 2.5
First iteration: and x0 3.5
xi 1 2.711111 with a 29.098%
x0 3.5 and x1 2.711111
Second iteration
xi 1 2.871091 with a 5.572%
Exercise 3: Solution
Third iteration:
x1 2.711111 and x2 2.871091
xi 1 3.221923 with a 10.889%
i xi |εa|%
0 3.500000 -
1 2.711111 29.098
2 2.871091 5.572
3 3.221923 10.889
Exercise 3: Solution
b) Modified Secant Method to solve:
f (x) x 3 6x 2 11x x 6.1
xi f (xi )
xi 1 xi
f (xi xi ) f (xi )
x0 3.5
First iteration: and x0 x0 3.535
x1 3.199597 with a 9.389%
x1 3.199597 and x1 x1 3.271725
Second iteration:
x2 3.075324 with a 4.041%
Exercise 3: Solution
Third iteration:
x2 3.075324 and x2 x2 3.143675
x3 3.048818 with a 0.869%
i xi |εa|%
0 3.500000 -
1 3.199597 9.389
2 3.075324 4.041
3 3.048818 0.869
What about modified Newton-Raphson?
f (xi ) f (xi )
xi 1 xi
[ f (xi )]2 f (xi ) f (xi )
Roots of Equations
ROOTS
ROOTS OF
OF
EQUATIONS
EQUATIONS
GRAPHICAL
GRAPHICAL BRACKETING
BRACKETING OPEN
OPEN METHODS
METHODS
METHODS
METHODS METHODS
METHODS
ONE-POINT
ONE-POINT
BISECTION
BISECTION METHOD
METHOD ITERATION
ITERATION (FIXED
(FIXED
POINT)
POINT) METHOD
METHOD
FALSE-POSITION
FALSE-POSITION NEWTON-RAPHSON
NEWTON-RAPHSON
METHOD
METHOD METHODD
METHODD
SECANT
SECANT METHOD
METHOD
MODIFIED
MODIFIED NEWTON-
NEWTON-
RAPHSON
RAPHSON METHOD
METHOD
(MULTIPLE
(MULTIPLE ROOTS)
ROOTS)
Next week
Linear algebraic equation - Gauss elimination