Numerical Methods Solved Examples
Numerical Methods Solved Examples
Solved Examples
By
Table of Contents
Part I: Numerical Solution for Single Variable..............................................................................................2
1.1. Newton-Raphson Method...........................................................................................................2
1.2. Secant Methods...........................................................................................................................4
Part Two: Numerical Solutions for Multiple Variables.................................................................................6
2.1. Generalized Newton-Raphson Method for Two Variables...........................................................6
2.2. Multi-dimensional case for Newton-Raphson Method................................................................9
Appendix: Matrix......................................................................................................................................10
Sayed-Ahmed, M. Ryerson University Jan. 2013
The Newton-Raphson method (NRM) is powerful numerical method based on the simple idea of linear
approximation. NRM is usually home in on a root with devastating efficiency. It starts with initial guess,
where the NRM is usually very good if , and horrible if the guess are not close.
Question: Find the value of if using Newton-Raphson Method for three iterations?
NRM: ( )
( )
()
then
()
()
( )
The second iteration ( )
( )
then
()
()
( )
( )
2
Sayed-Ahmed, M. Ryerson University Jan. 2013
Summary
Table 1: Newton-Raphson Method iteration results to three decimal places
Iteration Value of x Absolute error Exact Solution
1 2.741 9.45%
2 2.715 0.96% 2.714417617
3 2.714 0.009%
70
60
%
50
40
Error,
30
20
10
3
Sayed-Ahmed, M. Ryerson University Jan. 2013
Question: Find the value of if using Secant Method for three iterations,
where and ?
Answer: then
( )
( )( )
( ) ( )
( ) ( ) ( )( )
( ) ( ) ( ) ( )
( ) ( ) ( ) ( )
( ) ( ) ( ) ( )
( ) ( ) ( ) ( )
4
Sayed-Ahmed, M. Ryerson University Jan. 2013
Summary
60
%
50
40
Error,
30
20
10
5
Sayed-Ahmed, M. Ryerson University Jan. 2013
Question
( )
( )
For acceptable error less than 0.2, find the value of and
Solution
Where
[ ]
( )
Use Jacobian
( ) ( )
() [ [ ]
( ) ( )
]
[ ]{ } { } [ ]{ }
OR
{ } { } [] {}
(
[ ] [ ] [ )]
( )
Iteration;
The arbitrarily guess ( )
[ ]
This scalar parameter which is adjusted to either less than 1 or more than 1 (=1 is the
original Newton Method) to force for convergence.
[ ] [ ] [ ]
[] [ ] [ ] [ ] [ ]
( )( ) ( )
( )
()
( )
( )
() [] [ ] [ [ ]
]
6
Sayed-Ahmed, M. Ryerson University Jan. 2013
()
()
] =[] [ ( ) ( )( )
[] [ ][ ]
( )( ) ( )( )
[] [ ] [ ]
Evaluate the function ( ( ))
( )
( )
( )
( )
Iteration;
( )
[ ] [ ] [ ] [ ]
( )
( )
( )
()
( ( )) [ ]
The iteration stops when results reached to specified tolerance of error | | otherwise the process of iteration will continue.
7
Sayed-Ahmed, M. Ryerson University Jan. 2013
Summary
0 1 1 100% 100%
1 2.1 1.3 52.38% 23.08%
2 1.8284 1.2122 14.85% 7.24%
Where the absolute error
| | | |
2
1
0
1
2 3
Solution -1
-2
-3
-4
f(x1)
-5
f(x2)
Iteration
8
Sayed-Ahmed, M. Ryerson University Jan. 2013
where
= J (Jacobian)
with m = n Set
.
Source: (http://epoch.uwaterloo.ca/~ponnu/syde312/open_methods/page3.htm#example )
9
Sayed-Ahmed, M. Ryerson University Jan. 2013
Appendix: Matrix
Inverse of Matrix
For 2 x 2 matrices
[ ] the inverse can be found using this formula
[ ] [ ]
Multiplication of Matrix
( ) for m x n matrix size and ( ) for n x p matrix size
Where is summed over all values of and the uses the Einsten summation
conventions.
Example: Square matrix and column vector
( )
and ()
( )() ( )
10