Presentasi sedang didownload. Silahkan tunggu

Presentasi sedang didownload. Silahkan tunggu

Numerical Methods Semester Genap tahun 2015/2016 M. Ziaul Arif Jurusan Matematika - FMIPA Lecture 3 : Roots of Nonlinear equation.

Presentasi serupa


Presentasi berjudul: "Numerical Methods Semester Genap tahun 2015/2016 M. Ziaul Arif Jurusan Matematika - FMIPA Lecture 3 : Roots of Nonlinear equation."— Transcript presentasi:

1 Numerical Methods Semester Genap tahun 2015/2016 M. Ziaul Arif Jurusan Matematika - FMIPA Lecture 3 : Roots of Nonlinear equation Lecture /161Numerical methods

2 Solution Methods Several ways to solve nonlinear equations are possible. Analytical Solutions – possible for special equations only Graphical Illustration – Useful for providing initial guesses for other methods Numerical Solutions – Open methods – Bracketing methods Lecture /16 2 Numerical methods

3 Solution Methods: Analytical Solutions Analytical solutions are available for special equations only. Lecture /16 3 Numerical methods

4 Graphical Illustration Graphical illustration are useful to provide an initial guess to be used by other methods Lecture /16 4 Root Numerical methods

5 Bracketing & Open Methods In bracketing methods, the method starts with an interval that contains the root and a procedure is used to obtain a smaller interval containing the root. – Examples of bracketing methods : Bisection method, false position In the open methods, the method starts with one or more initial guess points. In each iteration a new guess of the root is obtained. Lecture /16 5 Numerical methods

6 Solution Methods Many methods are available to solve nonlinear equations  Bisection Method  False position Method  Newton’s Method  Secant Method  Fixed point iterations – Muller’s Method – Bairstow’s Method – Chebyshev method Lecture /16 6 These will be covered. Numerical methods

7 Bisection Method The Bisection method is one of the simplest methods to find a zero of a nonlinear function. To use the Bisection method, one needs an initial interval that is known to contain a zero of the function. The method systematically reduces the interval. It does this by dividing the interval into two equal parts, performs a simple test and based on the result of the test half of the interval is thrown away. The procedure is repeated until the desired interval size is obtained. Lecture /16 7 Numerical methods

8 Intermediate Value Theorem Let f(x) be defined on the interval [a,b], Intermediate value theorem: if a function is continuous and f(a) and f(b) have different signs then the function has at least one zero in the interval [a,b] Lecture /16 8 ab f(a) f(b) Numerical methods

9 Bisection Algorithm Assumptions: f(x) is continuous on [a,b] f(a) f(b) < 0 Algorithm: Loop 1. Compute the mid point c=(a+b)/2 2. Evaluate f(c ) 3. If f(a) f(c) < 0 then new interval [a, c] If f(a) f( c) > 0 then new interval [c, b] End loop Lecture /16 9 a b f(a) f(b) c Numerical methods

10 Bisection Method Assumptions: Given an interval [a,b] f(x) is continuous on [a,b] f(a) and f(b) have opposite signs. These assumptions ensures the existence of at least one zero in the interval [a,b] and the bisection method can be used to obtain a smaller interval that contains the zero. Lecture /16 10 Numerical methods

11 Bisection Method Lecture /16 11 a0a0 b0b0 a1a1 a2a2 Numerical methods

12 Flow chart of Bisection Method Lecture /16 12 Start: Given a,b and ε u = f(a) ; v = f(b) c = (a+b) /2 ; w = f(c) is u w <0 a=c; u= wb=c; v= w is (b-a)/2 <ε yes no Stop no Numerical methods

13 Example: Answer: Lecture /16 13 Numerical methods

14 Stopping Criteria Two common stopping criteria 1.Stop after a fixed number of iterations 2.Stop when Lecture /16 14 Numerical methods

15 Analisa kekonvergenan metode biseksi Lecture /16Numerical methods15

16 Analisa Hampiran pertama terhadap akar persamaan yang diberikan oleh metode biseksi adalah Galat Mutlak hampiran pertama adalah adalah nilai-nilai hampiran berikutnya, Lecture /16Numerical methods16

17 Analisa maka Akan tetapi, Lecture /16Numerical methods17

18 Sehingga Dengan memperhatikan ketaksamaan di atas, dapat disimpulkan bahwa  Semakin kecil interval (a,b) semakin kecil galat mutlak di dalam hampiran  Semakin besar nilai n, semakin kecil galat mutlak dalam hampiran Analisa Lecture /16Numerical methods18

19  Kekonvergenan metode bagi dua lambat  Batas galat tidak bergantung pada nilai fungsi yang dicari akarnya Analisa Lecture /16Numerical methods19

20 Contoh : Hitunglah berapa banyak iterasi yang diperlukan agar fungsi f(x) dapat dicari akarnya, jika diketahui, dan galat terbesarnya adalah Penyelesaian : misalkan n banyak iterasi yang diperlukan dalam mencari akar. Maka : Analisa Lecture /16Numerical methods20

21 Analisa Padahal, Karena galat paling besar adalah , berarti Lecture /16Numerical methods21

22 Maka, Jadi banyak iterasi adalah, Analisa Lecture /16Numerical methods22

23 Sehingga, Dengan demikian paling sedikit diperlukan iterasi sebanyak 27 iterasi untuk mendapatkan akar-akar dengan galat tersebut Analisa Lecture /16Numerical methods23

24 Lecture /16 24 Numerical methods

25 Bisection Method Initial Interval Lecture /16 25 a =0.5 c= 0.7 b= 0.9 f(a)= f(b) = Numerical methods

26 Lecture / ( )/2 = ( )/2 = 0.05 Numerical methods

27 Lecture / ( )/2= ( )/2=.0125 Numerical methods

28 Summary Initial interval containing the root [0.5,0.9] After 4 iterations – Interval containing the root [0.725,0.75] – Best estimate of the root is – | Error | < Lecture /16 28 Numerical methods

29 Bisection Method Programming in Matlab a=.5; b=.9; u=a-cos(a); v= b-cos(b); for i=1:5 c=(a+b)/2 fc=c-cos(c) if u*fc<0 b=c ; v=fc; else a=c; u=fc; end Lecture /16 29 c = fc = c = fc = c = fc = c = fc = Numerical methods

30 30 False Position Method x 2 defined as the intersection of x axis and x 0 f 0 -x 1 f 1 Choose [x 0,x 2 ] or [x 2,x 1 ], whichever is non-trivial Continue in the same way as bisection Compared to bisection: x 2 =(x 1 +x 0 )/2 Lecture /16Numerical methods

31 31 False Position (cont) Determine intersection point Using similar triangles: Lecture /16Numerical methods

32 32 False Position (cont) Alternatively, the straight line passing thru (x 0,f 0 ) and (x 1,f 1 ) Intersection: simply set y=0 to get x Lecture /16Numerical methods

33 33 Example kx k (Bisection) fkfk x k (False Position) fkfk ×10 -5 Lecture /16Numerical methods

34 Newton-Raphson Method (also known as Newton’s Method) Given an initial guess of the root x 0, Newton- Raphson method uses information about the function and its derivative at that point to find a better guess of the root. Assumptions: – f (x) is continuous and first derivative is known – An initial guess x 0 such that f ’(x 0 ) ≠0 is given Lecture /16 34 Numerical methods

35 Newton’s Method Lecture /16 35 X i+1 X i Numerical methods

36 Example Lecture /16 36 FN.m FNP.m Numerical methods

37 Results X = FNX = X = FNX =2.4495e-004 X = FNX =6.9278e-009 Lecture /16 37 Numerical methods

38 Secant Method Lecture /16 38 Numerical methods

39 Secant Method Lecture /16 39 Numerical methods

40 Example Lecture /16 40 Numerical methods

41 Example Lecture /16 41 Numerical methods

42 Results Lecture /16 42 Xi = -1 FXi =1 Xi = FXi = Xi = FXi = Xi = FXi =8.1695e-005 Xi = FXi =1.1276e-007 Numerical methods

43 Summary Bisection Reliable, Slow One function evaluation per iteration Needs an interval [a,b] containing the root, f(a) f(b)<0 No knowledge of derivative is needed Newton Fast (if near the root) but may diverge Two function evaluation per iteration Needs derivative and an initial guess x 0, f ’ (x 0 ) is nonzero Secant Fast (slower than Newton) but may diverge one function evaluation per iteration Needs two initial guess points x 0, x 1 such that f (x 0 )- f (x 1 ) is nonzero. No knowledge of derivative is needed Lecture /16 43 Numerical methods

44 Solving Non-linear Equation using Matlab Lecture /16 44 Example (i): find a root of f(x)=x-cos x, in [0,1] >> x-cos(x); >> fzero(f,[0,1]) ans = Example (ii): find a root of f(x)=e -x -x using the initial point x=1 >> exp(-x)-x; >> fzero(f,1) ans = Numerical methods

45 Solving Non-linear Equation using Matlab Lecture /16 45 Example (iii): find a root of f(x)=x 5 +x 3 +3 around -1 >> x^5+x^3+3; >> fzero(f,-1) ans = Because this function is a polynomial, we can find other roots >> roots([ ]) ans = i i i i Numerical methods

46 Use fzero Solver in Matlab Lecture /16 46 >>optimtool For example: want to find a root around -1 for x 5 +x 3 +3=0 The algorithm of fzero uses a combination of bisection, secant, etc. Numerical methods


Download ppt "Numerical Methods Semester Genap tahun 2015/2016 M. Ziaul Arif Jurusan Matematika - FMIPA Lecture 3 : Roots of Nonlinear equation."

Presentasi serupa


Iklan oleh Google