You are on page 1of 10

NUMERICAL SOLUTIONS:

Solved Examples

By

Mahmoud SAYED AHMED


Ph.D. Candidate
Department of Civil Engineering, Ryerson University
Toronto, Ontario 2013

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

Part I: Numerical Solution for Single Variable


1.1.

Newton-Raphson Method

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:
Answer:

Find the value of if


using Newton-Raphson Method for three iterations?
Start with guess value of
The function equation should equal to zero;
So the function equation;
NRM:

The first iteration


then

The absolute error,


| |

The second iteration

then

The absolute error,


| |

The third iteration

then

The absolute error,


| |

|
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

40
30

Error, %

50

20
10
0
3.4

3.3

3.2

3.1

2.9

2.8

2.7

Solution

Figure 1: High initial solution


Important notes
At any time

otherwise the process of iteration will not continue

Sayed-Ahmed, M.

1.2.

Ryerson University

Secant Methods

Question:

Find the value of if


where
and

Answer:

using Secant Method for three iterations,


?

then

The first iteration,


(

The absolute error


| |

The second iteration,

and
(

The absolute error


| |

The third iteration,

and
(

The absolute error


| |

The fourth iteration,

and

| |

The fifth iteration,

|
(

The absolute error


|

and
(

The absolute error


| |

Jan. 2013

Sayed-Ahmed, M.

Ryerson University

Jan. 2013

Summary
Table 2: Secant Method iteration results to three decimal places
Iteration
Value of x
Absolute error
Exact Solution
1
3.353
63.92%
2
3.059
9.691%
2.714417617
3
2.906
5.26%
4
2.823
2.94%
5
2.7765
1.675%
70
60

40
30
20
10
0
3.4

3.3

3.2

3.1

2.9

Solution

Figure 2: High initial solution

2.8

2.7

Error, %

50

Sayed-Ahmed, M.

Ryerson University

Jan. 2013

Part Two: Numerical Solutions for Multiple Variables


2.1.

Generalized Newton-Raphson Method for Two Variables

Question

For acceptable error less than 0.2, find the value of

and

Solution
Where
[ ]

Use Jacobian
]

The matrix notation


}
{ } [ ]{ }
[ ]{
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.
]

[
[ ]

Evaluate the function

[ ]

]
[

Sayed-Ahmed, M.

Ryerson University

[ ]

[ ]

][
]

] =[ ]

Jan. 2013

Evaluate the function

Iteration;
[

Evaluate the function

The iteration stops when results reached to specified tolerance of error | |


otherwise the process of iteration will continue.

Sayed-Ahmed, M.

Ryerson University

Jan. 2013

Summary
Table 3: Generalized Newton-Raphson Method
Parameters Value
Iteration
0
1
2

1
2.1
1.8284

1
1.3
1.2122

Error, | |

100%
52.38%
14.85%

100%
23.08%
7.24%

Where the absolute error


| |

3
2
1

Solution

0
-1

-2
-3
-4

f(x1)

-5
-6

f(x2)
Iteration

Figure 3: Graphical depiction of the solution of two simultaneous nonlinear equation

Sayed-Ahmed, M.

2.2.

Ryerson University

Jan. 2013

Multi-dimensional case for Newton-Raphson Method


Talyor Series of m functions with n variables:

where

= J (Jacobian)
with m = n Set

Advantages and Disadvantages:

The method is very expensive - It needs the function evaluation


and then the derivative evaluation.
If the tangent is parallel or nearly parallel to the x-axis, then the
method does not converge.
Usually Newton method is expected to converge only near the
solution.
The advantage of the method is its order of convergence is
quadratic.
Convergence rate is one of the fastest when it does converges

.
Source: (http://epoch.uwaterloo.ca/~ponnu/syde312/open_methods/page3.htm#example)

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
for the order of m x p.

Where is summed over all values of


and the uses the Einsten summation
conventions.
Example: Square matrix and column vector
and
The matrix product
(

10

You might also like