Sunteți pe pagina 1din 11

# NUMERICAL SOLUTIONS:

Solved Examples

By

Ph.D. Candidate

## Toronto, Ontario 2013

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

## 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: Find the value of if using Newton-Raphson Method for three iterations?

The function equation should equal to zero; ( )

NRM: ( )

( )

( )

()
then
()
()

## The absolute error,

| | | |

( )
The second iteration ( )

( )
then
()
()

( )
( )

| | | |

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

%
50

40

Error,
30

20

10

Solution

## Figure 1: High initial solution

Important notes ()

## At any time otherwise the process of iteration will not continue

3
Sayed-Ahmed, M. Ryerson University Jan. 2013

## 1.2. Secant Methods

Question: Find the value of if using Secant Method for three iterations,
where and ?
( )

( )( )

( ) ( )

( )( ) ( )( )

( ) ( ) ( )( )

| | | | | |

and
( )( ) ( )( )

( ) ( ) ( ) ( )

| | | | | |

and
( )( ) ( )( )

( ) ( ) ( ) ( )

| | | | | |

and
( )( ) ( )( )

( ) ( ) ( ) ( )

| | | | | |

and
( )( ) ( )( )

( ) ( ) ( ) ( )

## The absolute error

| | | | | |

4
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

%
50

40

Error,
30

20

10

Solution

## Figure 2: High initial solution

5
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

(
( ))

( )

()

( )

( )

() [] [ ] [ [ ]
]

6
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.

7
Sayed-Ahmed, M. Ryerson University Jan. 2013
Summary

## Table 3: Generalized Newton-Raphson Method

Iteration Parameters Value Error, | |

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

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

8
Sayed-Ahmed, M. Ryerson University Jan. 2013

where

= J (Jacobian)

with m = n Set

##  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
 Convergence rate is one of the fastest when it does converges

.
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 ( ) 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 ()

( )() ( )

10