1 / 33

Numerical Solutions of ODE

Numerical Solutions of ODE. Dr. Asaf Varol avarol@mix.wvu.edu. What is ODE and PDE.

seda
Download Presentation

Numerical Solutions of ODE

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Numerical Solutions of ODE Dr. Asaf Varol avarol@mix.wvu.edu

  2. What is ODE and PDE • A differential equation is an equation which involves derivatives of one or more dependent variables. If there is only one independent variable involved in the equation(s), then the derivatives are referred to as ordinary derivatives. If, however, there is more than one independent variable in the equation, then partial derivatives (PDE) with respect to each of the independent variables are used.

  3. Linear first-order ODEs

  4. Non-Linear first-order ODEs

  5. Linear, second-order ODEs

  6. Non-Linear, second-order ODEs

  7. Homogeneous ODEs • Homogeneous ODE is an equation which contains the dependent variable or its derivatives in every term.

  8. Partial Differential Equation

  9. Euler’s Method

  10. MATLAB (Euler)

  11. Plot (Euler)

  12. Example • EULER METHOD’S • Solving a simple ODE with Euler’s Method • Consider the differential equation y’=f(x,y) on a≤x≥b. Let • y’ = x + y; 0 ≤ x ≥ 1 a = 0, b = 1, y(0) = 2. • First, we find the approximate solution for h=0.5 (n = 2), a very large step size. • The approximation at x1 = 0.5 is • y1=y0 + h (x0 + y0)= 2.0 + 0.5 (0.0 + 2.0) = 3.0 • Next, we find the approximate solution, we use n = 20 intervals, so that h = 0.05.

  13. Solution with MATLAB(Euler)

  14. Plot (Euler)

  15. Modified Euler Method

  16. Higher Order Taylor Methods • One way to obtain a better solution technique is to use more terms in the Taylor series for y in order to obtain higher order truncation error. For example, a second-order Taylor method uses • y(x+h)=y(x)+hy’(x)+(h2/2)y’’(x)+O(h3) • O(h3) is the local truncation error

  17. Solving a Simple ODE with Taylor’s Method • Consider the differential equation • y’=x+y; 0≤x≤1 with a initial condition y(0)=2. • To apply the second order Taylor method to the equation, we find • y’’=d/dx(x+y)=1+y’=1+x+y • This gives the approximation formula • y(x+h)=y(x)+hy’(x)+(h2/2)y’’(x)

  18. Cont’d yi+1=yi+h(xi+yi)+(h2/2)(1+xi+yi) For n=2 (h=0.5), we find y1=y0+h(x0+y0)+(h2/2)(1+x0+y0)= =2+0.5(0+2)+((.5)2/2)(1+0+2)=3.375 y2=y1+h(x1+y1)+(h2/2)(1+x1+y1)= =3.375+0.5(0.5+3.375)+((0.5)2/2)(1+0.5+3.375)=5.9219

  19. MATLAB Program f. Taylor

  20. Plot (Taylor)

  21. RUNGE-KUTTA METHODS • Runge-Kutta methods are the most popular methods used in engineering applications because of their simplicity and accuracy. One of the simplest Runge-Kutta methods is based on approximating the value of y at xi + h/2 by taking one-half of the change in y that is given by Euler’s method and adding that on to current value yi. This method is known as the midpoint method.

  22. Midpoint Method • k1=hf(xi,yi) Change in y given by Euler’s method. • k2=hf(xi+0.5h,yi+0.5k1) Change in y using slope estimate at midpoint

  23. Solving a Simple ODE with Midpoint Method • Consider the differential equation • y’=x + y; 0≤ x ≤1 with a initial condition (a=0.0, b=0.0), y(0) = 2. • First, we find the approximate solution for h=0.5 (n=2), a very large step size. • k1=hf(x0,y0)=0.5(0.0+2.0)=1.0 • k2=hf(x0+0.5h,y0+0.5k1)=0.5(0.0+0.5*0.5+2.0+0.5*1.0)=1.375 • Y1=y0+k2=2.0+1.375=3.375 • Next, we find the approximate solution y2 at point x2=0.0+2h=1.0

  24. Cont’d • k1=hf(x1,y1)=0.5(x1,y1)=0.5(0.5+3.375)=1.9375 • k2=hf(x1+0.5h,y1+0.5k1)=0.5(0.5+0.5*0.5+3.375+0.5*1.9375)=2.547 y2=y1+k2=3.375+2.5469=5.922

  25. MATLAB Prog. f. Midpoint

  26. Plot (Midpoint)

  27. References • Celik, Ismail, B., “Introductory Numerical Methods for Engineering Applications”, Ararat Books & Publishing, LCC., Morgantown, 2001 • Fausett, Laurene, V. “Numerical Methods, Algorithms and Applications”, Prentice Hall, 2003 by Pearson Education, Inc., Upper Saddle River, NJ 07458 • Rao, Singiresu, S., “Applied Numerical Methods for Engineers and Scientists, 2002 Prentice Hall, Upper Saddle River, NJ 07458 • Mathews, John, H.; Fink, Kurtis, D., “Numerical Methods Using MATLAB” Fourth Edition, 2004 Prentice Hall, Upper Saddle River, NJ 07458 • Varol, A., “Sayisal Analiz (Numerical Analysis), in Turkish, Course notes, Firat University, 2001

More Related