330 likes | 426 Views
Numerical Solutions of ODE. Dr. Asaf Varol avarol@mix.wvu.edu. What is ODE and PDE.
E N D
Numerical Solutions of ODE Dr. Asaf Varol avarol@mix.wvu.edu
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.
Homogeneous ODEs • Homogeneous ODE is an equation which contains the dependent variable or its derivatives in every term.
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.
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
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)
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
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.
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
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
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
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