Download presentation

Presentation is loading. Please wait.

Published byMakayla Lane Modified over 2 years ago

1
Lecture 44 Numerical Analysis

2
Solution of Non-Linear Equations

3
Bisection Method Regula-Falsi Method Method of iteration Newton - Raphson Method Mullers Method Graeffes Root Squaring Method

4
Newton - Raphson Method

5
An approximation to the root is given by

6
Better and successive approximations x 2, x 3, …, x n to the root are obtained from N-R Formula

7
Newtons algorithm To find a solution to f(x)=0 given an initial approximation p 0

8
INPUT initial approximation p 0 ; tolerance TOL; maximum number of iterations N 0 OUTPUT approximate solution p or message of failure

9
Step 1 Set I = 1 Step 2 While i < N0 do Steps 3-6

10
Step 3 Setp = p 0 – f ( p 0 ) / f ( p 0 ) (compute p i ). Step 4 If Abs (p – p 0 ) < TOL OUTPUT ( p ); If Abs (p – p 0 ) < TOL OUTPUT ( p ); (The procedure was successful.) STOP

11
Step 5 Set i = i + 1 Step 6 Set p 0 = p (Update p 0 ) Step 7 OUTPUT (The method failed after N 0 iterations, N 0 =,N 0 ) The procedure was unsuccessful STOP

12
Example Using Maple to solve a non-linear equation.

13
Solution The Maple command will be as follows, Fsolve ( cos (x) -x);

14
alg023(); alg023(); This is Newton's Method This is Newton's Method Input the function F(x) in terms of x For example: > cos(x)-x Input initial approximation > Input tolerance >

15
Input maximum number of iterations - no decimal point > 25 Select output destination 1. Screen 2. Text file Enter 1 or 2 > 1

16
Select amount of output 1. Answer only 2. All intermediate approximations Enter 1 or 2 > 2

17
Newton's Method I P F(P) I P F(P) e e e e e e-01 Approximate solution = with F(P) = Number of iterations = 3 Tolerance = e-05

18
Another Example > alg023(); Input the function F(x) in terms of x, > sin(x)-1 Input initial approximation > Input tolerance >

19
Input maximum number of iterations – no decimal point > 25 Select output destination 1. Screen 2. Text file Enter 1 or 2 >2

20
Select amount of output 1. Answer only 2. All intermediate approximations Enter 1 or 2 > 2

21
Newton's Method I P F(P) I P F(P) e e e e e e e e e e e e e e e e e e e e e e e e e e e e-05More…

22
e e e e e e e e e e e e e e e e e e e e e e e e e e e e e e e e-10

23
Approximate solution = with F(P) = e-10 Number of iterations = 15 Tolerance = e-05

24
Bisection Method > alg021(); This is the Bisection Method. Input the function F(x) in terms of x For example: > x^3+4*x^2-10

25
Input endpoints A < B separated by blank > 1 2 Input tolerance > Input maximum number of iterations - no decimal point > 25

26
Select output destination 1.Screen, 2. Text file Enter 1 or 2 > 1 Select amount of output 1. Answer only 2. All intermediate approximations Enter 1 or 2 > 2

27
Bisection Method I P F(P) I P F(P) e e e e e e e e e e e e-01

28
e e e e e e e e e e e e e e e e e e e e e e e e e e e e e e-03 Approximate solution P = with F(P) = Number of iterations = 11 Tolerance = e-04

29
alg021(); Another example of the Bisection Method. Input the function F(x) in terms of x, > cos(x) Input endpoints A < B separated by blank > 1 2 Input tolerance >

30
Input maximum number of iterations - no decimal point > 25 Select output destination 1. Screen, 2. Text file Enter 1 or 2 > 1 Select amount of output 1. Answer only 2. All intermediate approximations Enter 1 or 2 > 2

31
Bisection Method 1 P F(P) 1 P F(P) e e e e e e e e e e e e e e e e e e e e-02

32
e e e e e e e e e e e e e e e e e e e e e e-06 Approximate solution P = with F(P) = Number of iterations = 11 Tolerance = e-04

33
alg025(); This is the Method of False alg025(); This is the Method of FalsePosition Input the function F(x) in terms of x > cos(x)-x Input endpoints P0 < P1 separated by a blank space Input tolerance >0.0005

34
Input maximum number of iterations - no decimal point > 25 Select output destination 1. Screen 2. Text file Enter 1 or 2 >1

35
Select amount of output 1. Answer only 2. All intermediate approximations Enter 1 or 2 > 2

36
METHOD OF FALSE POSITION I P F(P) e e e e e e e e e e e e-07 Approximate solution P = with F(P) = Number of iterations = 4 Tolerance = e-04

37
System of Linear Equations

38
Gaussian Elimination Gauss-Jordon Elimination Crouts Reduction Jacobis Gauss- Seidal Iteration Relaxation Matrix Inversion

39
> alg061(); This is Gaussian Elimination to solve a linear system. The array will be input from a text file in the order: A(1,1), A(1,2),..., A(1,N+1), A(2,1), A(2,2),..., A(2,N+1),..., A(N,1), A(N,2),..., A(N,N+1) Place as many entries as desired on each line, but separate entries with at least one blank.

40
Has the input file been created? - enter Y or N. > y Input the file name in the form - drive:\name.ext for example: A:\DATA.DTA > d:\maple00\dta\alg061.dta Input the number of equations - an integer. > 4 Choice of output method: 1. Output to screen2. Output to text file Please enter 1 or 2. > 1

41
GAUSSIAN ELIMINATION The reduced system - output by rows: Has solution vector: with 1 row interchange (s)

42
> alg071(); This is the Jacobi Method for Linear Systems. The array will be input from a text file in the order A(1,1), A(1,2),..., A(1,n+1), A(2,1), A(2,2),..., A(2,n+1),..., A(n,1), A(n,2),..., A(n,n+1) Place as many entries as desired on each line, but separate entries with at least one blank.

43
The initial approximation should follow in the same format has the input file been created? - enter Y or N. > y Input the file name in the form - drive:\name.ext for example: A:\DATA.DTA > d:\maple00\alg071.dta Input the number of equations - an integer. > 4

44
Input the tolerance. > Input maximum number of iterations. > 15 Choice of output method: 1. Output to screen 2. Output to text file Please enter 1 or 2. > 1

45
JACOBI ITERATIVE METHOD FOR LINEAR SYSTEMS The solution vector is : using 10 iterations with Tolerance e-03

46
Lecture 44 Numerical Analysis

Similar presentations

© 2016 SlidePlayer.com Inc.

All rights reserved.

Ads by Google