7
MTH510 Numerical Analysis LF/S12 1 II Non-Linear Equations 1 2.1 Introduction Commo n problem in Applied Mathematics  f(x)=0 Algebraic equations Transcendental functions   Including Trig., log, exp to function  x of  polynomial order th i  f  f  x  f  y  f  y  f i n n n n = + + +  0 0 1 1 1 L 0 10 ) ln( 0 5 ) cos( 2 = + + = + +  x  x  x  x 2 Solution Methods Usin g formul a- for simpl e cases (quadratic eqn.) Graphical method-gives rough estimate Trial & Error – Tedious and Inadequate Numerical Method 3 2.2 Graphical method Simple method for one variable eqn. Limited practical value Plot the function and observe the crossing points @ x= x r , f(x r )=0 f(x) Root x 4 y x r Ways Roots may Occur  x l  x l  x u 1-root 0-root 2-root 3-root  x u (a) (c) (b) (d) 5 (a) (b) (c) (d) x x x       x f(x) f(x) f(x) f(x) 2.3 Bra cke ting Method Two methods: Bisection & False Position Need initial guess for the bracket Globally convergent Paralle l usage of Grap h- reduce s computation Cannot identify multiple roots 6

II Non-Linear Equations

Embed Size (px)

Citation preview

Page 1: II Non-Linear Equations

8/11/2019 II Non-Linear Equations

http://slidepdf.com/reader/full/ii-non-linear-equations 1/6

MTH510 Numerical Analysis

LF/S12

II Non-Linear Equations

1

2.1 Introduction

• Common problem in Applied Mathematics

f(x)=0• Algebraic equations

• Transcendental functions – Including Trig., log, exp to function

xof polynomialorder thi f

f x f y f y f

i

n

n

n

n

=+++ −

−0

01

1

1L

010)ln(

05)cos(2 =++

=++

x x

x x

2

Solution Methods

• Using formula- for simple cases(quadratic eqn.)

• Graphical method-gives rough estimate• Trial & Error – Tedious and Inadequate• Numerical Method

3

2.2 Graphical method

• Simple method – forone variable eqn.

• Limited practical value• Plot the function and

observe the crossingpoints @ x= x r , f(x r)=0

f(x)

Rootx

4

y

xr

Ways Roots may Occur

xl

xl xu

1-root 0-root

2-root 3-root

xu

(a)

(c)

(b)

(d)

5

(a) (b)

(c)(d)

x x

x x

f(x)

f(x)

f(x)

f(x)

2.3 Bracketing Method

• Two methods: Bisection & False Position• Need initial guess for the bracket

• Globally convergent• Parallel usage of Graph- reduces

computation• Cannot identify multiple roots

6

Page 2: II Non-Linear Equations

8/11/2019 II Non-Linear Equations

http://slidepdf.com/reader/full/ii-non-linear-equations 2/6

MTH510 Numerical Analysis

LF/S12

2.3.1 Bisection Method• Incremental search method/Graphical - to identify

the root location interval ;

• Interval always divided in half• Method systematically move the end points closer

until we obtain a small bracket

xu xl

xr 1

L. Interval U. Interval

xr 2

x xl r =

1 x xu r =

2

f (x)

x

7

Algorithm1 Choose lower & upper guesses ( xl , xu) such that the

function changes signs in the interval

2 Determine an estimate of the root xr by

3 Make evaluationsa) If f(xl). f(x r )<0, x u=x r and return to step 2b) If f(xl). f(x r )>0, x l=x r and return to step 2c) If f(xl). f(x r )=0 , root equals xr , terminate the

computation

2ul

r

x x x

+=

8

Error control• Relative Error εa

• Termination criteria

• Number of Iteration for specified error (E ad)

new

r

old

r

new

r

a x x x −

saε ε ≤

9

−−=

)2ln()ln()ln(

ad lu E x x

Integer n

Example 2.1: Bisection method

10

7.42.24.0)( 2 ++−= x x x f

2.3.2 False Position Method

• Method replaces a curve by a stra ight line• More efficient method than Bisection ( converges faster)• There are cases where Bisection converges faster

xl xu

xr

11

A

B

C

DE

f(xu)-f(xl)

xu - xl

Algorithm1 Choose lower & upper guesses such that the function

changes signs in the interval2 Determine an estimate of the root xr by

3 Compute the error

4 Set xl or xu = xr , which ever yields a function value withthe same sign as f(x r ) & repeat step 2

a) If f(xl). f(x r )<0, x u=x r

b) If f(xl). f(x r )>0, x l=x r and return to step 2

)()())((

ul

ulu

ur x f x f x x x f

x x−

−−=

snew

r

old

r

new

r

a x

x xε ε ≤

−=

12

Page 3: II Non-Linear Equations

8/11/2019 II Non-Linear Equations

http://slidepdf.com/reader/full/ii-non-linear-equations 3/6

MTH510 Numerical Analysis

LF/S12

Example 2.2 False Position method

13

7.42.24.0)( 2 ++−= x x x f

Comparison: Bisection & False Position

Bisection

FalsePosition

Iteration

ε a

14

Example 2.3: Bisection & False Positionmethods

15

x x x f +−= 5)ln()(2.3 Open Method

• Formula based & require 1or 2 starting values• Diverges sometimes• Converge faster than bracketing methods• Methods

– Newton-Raphson method – Secant method – Simple fixed Point method – Two curve method

16

2.3.1 Newton’s Method

• Most widely used,Needs one startingguess x 0 value

• Iteration formula

• Convergence dependson the function

)('

)(1

i

iii x f

x f x x −=

+

xr

x i x

i + 1

x f xi i, ( )

f x( )

17 18

Method Pitfalls

x0

x1 x2

f x( )

x0 x1 x2

(a) (b)

x0

x1

x2

x3

x0 x1

(c) (d)

Page 4: II Non-Linear Equations

8/11/2019 II Non-Linear Equations

http://slidepdf.com/reader/full/ii-non-linear-equations 4/6

MTH510 Numerical Analysis

LF/S12

Algorithm

1 Guess a value (x i) for the root & compute

f(x i), f’(x i)2 For f(x i)≠ 0, f’(x i)≠ 0, compute the next

estimate from formula

3 Alert possibility of f ’(x i)=0 during comp.4 Terminate Iteration

Criteria: εa< εs & | f(x i)|<Tol

19

Example 2.4: Newton Method

20

x x x f +−= 5)ln()(

Example 2.5: Determine the lowest and highestreal roots

21

-1

-0.8

-0.6

-0.4

-0.2

0

0.2

0.4

0.6

0 0.5 1 1.5 2 2.5 3 3.5

f(x)=-6.1+11x-6x 2+x 3

f(x)

Modified Newton’s Method

• Formula

• Suitable to determine (M) multiple rootsCondition : f(x), f ’(x), f ’’(x),…f M (x) – exits

f(xr )=0, f’(x r )=0,…f M (x)≠ 0M=1- simple root, M=2- double roots at x r

• Less efficient & requires more computational effort

( )[ ])('')()('

)(')(21

iii

iiii

x f x f x f

x f x f x x

−−=

+

22

Example 2.6: Find the roots of the polynomial

23

-3

-2

-1

0

1

2

3

4

0 0.5 1 1.5 2 2.5 3 3.5 4

f(x) = x 3-5x 2+7x-3

f’(x) = 3x 2-10x+7

f’’(x) = 6x-10, f’’(x=1) ≠0

24

Example 2.7

-4

-2

0

2

4

6

8

10

0 1 2 3 4

f(x)=x 4-6x 3+12x 2-10x+3

-5

0

5

10

15

20

25

0 1 2 3 4

f(x)=x 5-7x 4+6x 3-22x 2+13x-3

f(x)=f’x)=f’’(x)=f’’’(x)=0@x=1fIV≠ 0 @x=1f’(x) = 4x 3-18x 2+24x-10

f’’(x) = 12x 2-36x +24

f’’’(x) = 24x-36 , f’’’(x=1) ≠ 0

Page 5: II Non-Linear Equations

8/11/2019 II Non-Linear Equations

http://slidepdf.com/reader/full/ii-non-linear-equations 5/6

MTH510 Numerical Analysis

LF/S12

2.3.2 Secant Method

• Requires 2 initial estimates(NOT required to changesign)

• Eliminates the evaluation off’(x)

• Formula

( )[ ])()(

)(1

1

1

ii

ii

iii x f x f x x

x f x x−

−−=

+

xi xi −1

f x( )

f xi( )− 1

f xi( )

25

Algorithm

1 Choose initial estimates xi-1 & xi near to one

another2 Determine the next possible root from

formula

3 Until |f(x i)|<Tol & | xi+1 - xi |/| x i+1 | < ε s

26

Example 2.7: Solve Example 2.4 using Secant method

27

Modified Secant Formula

• Formula

• Problem: – Too small δ can result round off error – Big δ , the technique can be inefficient

[ ])()()(

1

iii

ii

ii x f x x f x x f

x x−+

−=+ δ

δ

28

2.3.3 Fixed Point Method

Function itself used to formulate the iteration formulaFormulation:

◦ Rearrange f(x)=0, so that x (independent variable) is on theLHS

X=g(x)G(x)- the iteration function of the original f(x),

if function can be separated◦ Algebraic manipulation◦ Add independent variable on both sides of the equation

X=f(x)+x=g(x)◦ Iteration formula x i+1=g(x i)

Check for convergence of g(x): Condition |g’(x)|<1

29

Algorithm

1. Guess initial value for the solution2. Evaluate the new estimate

xi+1=g(x i)1. Evaluate the error εa

If εa< εs Terminate iteration Else repeat step 2

30

Page 6: II Non-Linear Equations

8/11/2019 II Non-Linear Equations

http://slidepdf.com/reader/full/ii-non-linear-equations 6/6

MTH510 Numerical Analysis

LF/S12

Using Matlab functionGeneral NL function f(x)

>> [x,feval]=fzero(function, X0) fzero - matlab function (uses a combination of the methods)X0- interval [xl xf] / nearest to the point x0

Polynomial (p=[ an …a0])>>roots(p)

31 32

Example 2.8 Find the roots of function inExample 2.2, 2.4

Polynomial f= a n x^n +...a 0

P=[a n ...a 0]