Roots of Nonlinear Equations - Open Methods

40
Roots of Non-Linear Equations Mohammad Tawfik #WikiCourses http://WikiCourses.WikiSpaces.com Roots of Nonlinear Equations Open Methods

Transcript of Roots of Nonlinear Equations - Open Methods

Page 1: Roots of Nonlinear Equations - Open Methods

Roots of Non-Linear Equations

Mohammad Tawfik #WikiCourses

http://WikiCourses.WikiSpaces.com

Roots of Nonlinear Equations

Open Methods

Page 2: Roots of Nonlinear Equations - Open Methods

Roots of Non-Linear Equations

Mohammad Tawfik #WikiCourses

http://WikiCourses.WikiSpaces.com

Objectives

• Be able to use the Newton Raphson method to find a root of an equations

• Be able to use the Secant method to find a root of an equations

• Write down an algorithm to outline the method being used

Page 3: Roots of Nonlinear Equations - Open Methods

Roots of Non-Linear Equations

Mohammad Tawfik #WikiCourses

http://WikiCourses.WikiSpaces.com

Fixed Point Iterations

Page 4: Roots of Nonlinear Equations - Open Methods

Roots of Non-Linear Equations

Mohammad Tawfik #WikiCourses

http://WikiCourses.WikiSpaces.com

kk xgx 1

Fixed Point Iterations

• Solve 0xf

0 xgxxf

• Rearrange terms:

• OR

xgx

Page 5: Roots of Nonlinear Equations - Open Methods

Roots of Non-Linear Equations

Mohammad Tawfik #WikiCourses

http://WikiCourses.WikiSpaces.com

In some cases you do not get a

solution!

Page 6: Roots of Nonlinear Equations - Open Methods

Roots of Non-Linear Equations

Mohammad Tawfik #WikiCourses

http://WikiCourses.WikiSpaces.com

Example

Page 7: Roots of Nonlinear Equations - Open Methods

Roots of Non-Linear Equations

Mohammad Tawfik #WikiCourses

http://WikiCourses.WikiSpaces.com

Example

22 xxxf Which has the solutions -1 & 2

To get a fixed-point form, we may use:

22 xxg

x

xg 21

2 xxg

12

22

x

xxg

Page 8: Roots of Nonlinear Equations - Open Methods

Roots of Non-Linear Equations

Mohammad Tawfik #WikiCourses

http://WikiCourses.WikiSpaces.com

First trial!

• No matter how close

your initial guess is,

the solution diverges!

Page 9: Roots of Nonlinear Equations - Open Methods

Roots of Non-Linear Equations

Mohammad Tawfik #WikiCourses

http://WikiCourses.WikiSpaces.com

Second trial

• The solution converges

in this case!!

Page 10: Roots of Nonlinear Equations - Open Methods

Roots of Non-Linear Equations

Mohammad Tawfik #WikiCourses

http://WikiCourses.WikiSpaces.com

Condition of Convergence

• For the fixed point iteration to ensure

convergence of solution from point xk we should

ensure that

1' kxg

Page 11: Roots of Nonlinear Equations - Open Methods

Roots of Non-Linear Equations

Mohammad Tawfik #WikiCourses

http://WikiCourses.WikiSpaces.com

Fixed Point Algorithm

1. Rearrange f(x) to get f(x)=x-g(x)

2. Start with a reasonable initial guess x0

3. If |g’(x0)|>=1, goto step 2

4. Evaluate xk+1=g(xk)

5. If (xk+1-xk)/xk+1< es; end

6. Let xk=xk+1; goto step 4

Page 12: Roots of Nonlinear Equations - Open Methods

Roots of Non-Linear Equations

Mohammad Tawfik #WikiCourses

http://WikiCourses.WikiSpaces.com

Newton-Raphson Method

Page 13: Roots of Nonlinear Equations - Open Methods

Roots of Non-Linear Equations

Mohammad Tawfik #WikiCourses

http://WikiCourses.WikiSpaces.com

Newton’s Method: Line Equation

1

21

21 ' xfxx

yym

The slope of the

line is given by:

Page 14: Roots of Nonlinear Equations - Open Methods

Roots of Non-Linear Equations

Mohammad Tawfik #WikiCourses

http://WikiCourses.WikiSpaces.com

Newton’s Method: Line equation

1

21

1 ' xfxx

xf

1

112

' xf

xfxx

k

kkk

xf

xfxx

'1

Newton-Raphson

Iterative method

Page 15: Roots of Nonlinear Equations - Open Methods

Roots of Non-Linear Equations

Mohammad Tawfik #WikiCourses

http://WikiCourses.WikiSpaces.com

Newton’s Method: Taylor’s Series

1121 ' xfxxxf 1

112

' xf

xfxx

k

kkk

xf

xfxx

'1

Newton-Raphson

Iterative method

11212 ' xfxxxfxf

Page 16: Roots of Nonlinear Equations - Open Methods

Roots of Non-Linear Equations

Mohammad Tawfik #WikiCourses

http://WikiCourses.WikiSpaces.com

Newton-Raphson Algorithm

1. From f(x) get f’(x)

2. Start with a reasonable initial guess x0

3. Evaluate xk+1=xk-f(xk)/f’(xk)

4. If (xk+1-xk)/xk+1< es; end

5. Let xk=xk+1; goto step 4

Page 17: Roots of Nonlinear Equations - Open Methods

Roots of Non-Linear Equations

Mohammad Tawfik #WikiCourses

http://WikiCourses.WikiSpaces.com

Secant Method

Page 18: Roots of Nonlinear Equations - Open Methods

Roots of Non-Linear Equations

Mohammad Tawfik #WikiCourses

http://WikiCourses.WikiSpaces.com

Secant Method

21

21

2

2

xx

yy

xx

yy

The line equation

is given by:

2

21

221 0xx

yy

yxx

Page 19: Roots of Nonlinear Equations - Open Methods

Roots of Non-Linear Equations

Mohammad Tawfik #WikiCourses

http://WikiCourses.WikiSpaces.com

Secant Method

2

21

221 0xx

yy

yxx

21

2122

yy

xxyxx

kk

kkkkk

xfxf

xxxfxx

1

11

Page 20: Roots of Nonlinear Equations - Open Methods

Roots of Non-Linear Equations

Mohammad Tawfik #WikiCourses

http://WikiCourses.WikiSpaces.com

Secant Algorithm

1. Select x1 and x2

2. Evaluate f(x1) and f(x2)

3. Evaluate xk+1

4. If (xk+1-xk)/xk+1< es; end

5. Let xk=xk+1; goto step 3

Page 21: Roots of Nonlinear Equations - Open Methods

Roots of Non-Linear Equations

Mohammad Tawfik #WikiCourses

http://WikiCourses.WikiSpaces.com

Why Secant Method?

• The most important advantage over

Newton-Raphson method is that you do

not need to evaluate the derivative!

Page 22: Roots of Nonlinear Equations - Open Methods

Roots of Non-Linear Equations

Mohammad Tawfik #WikiCourses

http://WikiCourses.WikiSpaces.com

Comparing with False-Position

• Actually, false

position ensures

convergence, while

secant method does

not!!!

Page 23: Roots of Nonlinear Equations - Open Methods

Roots of Non-Linear Equations

Mohammad Tawfik #WikiCourses

http://WikiCourses.WikiSpaces.com

Conclusion

• The fixed point iteration, Newton-Raphson

method, and the secant method in general

converge faster than bisection and false position

methods

• On the other hand, these methods do not ensure

convergence!

• The secant method, in many cases, becomes

more practical than Newton-Raphson as

derivatives do not need to be evaluated

Page 24: Roots of Nonlinear Equations - Open Methods

Roots of Non-Linear Equations

Mohammad Tawfik #WikiCourses

http://WikiCourses.WikiSpaces.com

Roots of Nonlinear System

of Equations

Page 25: Roots of Nonlinear Equations - Open Methods

Roots of Non-Linear Equations

Mohammad Tawfik #WikiCourses

http://WikiCourses.WikiSpaces.com

Objectives

• Be able to use the fixed point method to

find a root of a set of equations

• Be able to use the Newton Raphson

method to find a root of a set equations

Page 26: Roots of Nonlinear Equations - Open Methods

Roots of Non-Linear Equations

Mohammad Tawfik #WikiCourses

http://WikiCourses.WikiSpaces.com

Fixed Point Iterations

Page 27: Roots of Nonlinear Equations - Open Methods

Roots of Non-Linear Equations

Mohammad Tawfik #WikiCourses

http://WikiCourses.WikiSpaces.com

kk xgx 1

Fixed Point Iterations

• Solve 0xf

0 xgxxf

• Rearrange terms:

• OR

xgx

Page 28: Roots of Nonlinear Equations - Open Methods

Roots of Non-Linear Equations

Mohammad Tawfik #WikiCourses

http://WikiCourses.WikiSpaces.com

kkk

kkk

yxgy

yxgx

,

,

21

11

Fixed Point Iterations (cont’d)

• Solve

0,

0,

2

1

yxf

yxf

0,,

0,,

22

11

yxgyyxf

yxgxyxf• Rearrange terms:

• OR

yxgy

yxgx

,

,

2

1

Page 29: Roots of Nonlinear Equations - Open Methods

Roots of Non-Linear Equations

Mohammad Tawfik #WikiCourses

http://WikiCourses.WikiSpaces.com

Example

0573

010

2

2

2

1

xyyxf

xyxxfWhich has a solution x=2 & y=3

To get a fixed-point form, we may use:

With initial values: x=1.5 and y=3.5

kkk

k

k

k

yxy

y

xx

2

1

2

1

357

10

38.245.3*5.1*357

214.25.3

5.110

2

1

2

1

y

x

7.42938.24*214.2*357

209.038.24

214.210

2

2

2

2

y

x

Page 30: Roots of Nonlinear Equations - Open Methods

Roots of Non-Linear Equations

Mohammad Tawfik #WikiCourses

http://WikiCourses.WikiSpaces.com

Diverging !

Page 31: Roots of Nonlinear Equations - Open Methods

Roots of Non-Linear Equations

Mohammad Tawfik #WikiCourses

http://WikiCourses.WikiSpaces.com

Another trial

k

kk

kkk

x

yy

yxx

3

57

10

1

1

861.25.1*3

5.357

179.25.3*5.110

1

1

y

x

05.3179.2*3

861.257

941.1861.2*179.210

2

2

y

x

Page 32: Roots of Nonlinear Equations - Open Methods

Roots of Non-Linear Equations

Mohammad Tawfik #WikiCourses

http://WikiCourses.WikiSpaces.com

Condition of Convergence

• For the fixed point iteration to ensure

convergence of solution from point xk and yk we

should ensure that

1

1

21

21

y

g

y

g

and

x

g

x

g

Page 33: Roots of Nonlinear Equations - Open Methods

Roots of Non-Linear Equations

Mohammad Tawfik #WikiCourses

http://WikiCourses.WikiSpaces.com

Newton-Raphson Method

Page 34: Roots of Nonlinear Equations - Open Methods

Roots of Non-Linear Equations

Mohammad Tawfik #WikiCourses

http://WikiCourses.WikiSpaces.com

Newton’s Method: Taylor’s Series

1

21

1 ' xfxx

xf

1

112

' xf

xfxx

k

kkk

xf

xfxx

'1

Newton-Raphson

Iterative method

112 ' xxfxfxf

Page 35: Roots of Nonlinear Equations - Open Methods

Roots of Non-Linear Equations

Mohammad Tawfik #WikiCourses

http://WikiCourses.WikiSpaces.com

Taylor’s series in multiple variables

y

fy

x

fxyxfyxf

y

fy

x

fxyxfyxf

22112222

11111221

,,

,,

11222

11111

,

,

yxfy

fy

x

fx

yxfy

fy

x

fx

Page 36: Roots of Nonlinear Equations - Open Methods

Roots of Non-Linear Equations

Mohammad Tawfik #WikiCourses

http://WikiCourses.WikiSpaces.com

Manipulating the equations

112

111

22

11

,

,

yxf

yxf

y

x

y

f

x

f

y

f

x

f

Solve for x and y then evaluate:

y

x

y

x

y

x

1

1

2

2

Repeat until convergence

Page 37: Roots of Nonlinear Equations - Open Methods

Roots of Non-Linear Equations

Mohammad Tawfik #WikiCourses

http://WikiCourses.WikiSpaces.com

Example

0573

010

2

2

2

1

xyyxf

xyxxfWhich has a solution x=2 & y=3

With initial values: x=1.5 and y=3.5

Get the derivatives

xyy

fy

x

f

xy

fyx

x

f

613

2

222

11

Page 38: Roots of Nonlinear Equations - Open Methods

Roots of Non-Linear Equations

Mohammad Tawfik #WikiCourses

http://WikiCourses.WikiSpaces.com

Example Using initial values: x=1.5 and y=3.5

Get the derivatives

5.3275.36

5.15.6

22

11

y

f

x

f

y

f

x

f

625.1

5.2

5.3275.36

5.15.6

y

x

656.0

536.0

y

x

844.2

036.2

2

2

y

x

Page 39: Roots of Nonlinear Equations - Open Methods

Roots of Non-Linear Equations

Mohammad Tawfik #WikiCourses

http://WikiCourses.WikiSpaces.com

Conclusion

• The fixed point iteration and Newton-

Raphson methods were used to find a

solution for a system of nonlinear

equations in a manner similar to that used

in single-variable problems

Page 40: Roots of Nonlinear Equations - Open Methods

Roots of Non-Linear Equations

Mohammad Tawfik #WikiCourses

http://WikiCourses.WikiSpaces.com

Homework #2

• Chapter 6, p 171, numbers:

6.1,6.2,6.3,6.16,6.17

• Homework due next week