Title: Numerical Solutions of ODE
1Numerical Solutions of ODE
- Dr. Asaf Varol
- avarol_at_mix.wvu.edu
2What 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.
3Linear first-order ODEs
dy/dx x y y x y
du/dx u 2 u u 2
4Non-Linear first-order ODEs
dy/dx x cos(y) y x cos(y)
du/dt u2 2 u u2 2
5Linear, second-order ODEs
d2y/dx2 dy/dx xy
y -2y 0.1y
6Non-Linear, second-order ODEs
d2y/dx2 dy/dx xy-y
y -2y 0.1(y)2
7Homogeneous ODEs
- Homogeneous ODE is an equation which contains the
dependent variable or its derivatives in every
term.
d2y/dx2 dy/dx xy-y
y -2y 0.1(y)2
8Partial Differential Equation
First order, linear PDE where for a given function u u( x, t) x and t are the independent variables ? is the independent variable.
Second-order linear PDE Here, x and y are the independent variables.
9Eulers Method
10(No Transcript)
11(No Transcript)
12(No Transcript)
13(No Transcript)
14(No Transcript)
15MATLAB (Euler)
16Plot (Euler)
17(No Transcript)
18Example
- EULER METHODS
- Solving a simple ODE with Eulers 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 h0.5
(n 2), a very large step size. - The approximation at x1 0.5 is
- y1y0 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.
19Solution with MATLAB (Euler)
20Plot (Euler)
21Modified Euler Method
22Higher 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(xh)y(x)hy(x)(h2/2)y(x)O(h3)
- O(h3) is the local truncation error
23Solving a Simple ODE with Taylors Method
- Consider the differential equation
- yx y 0 x 1 with a initial condition
y(0) 2. - To apply the second order Taylor method to the
equation, we find - yd/dx( x y) 1 y 1 x y
- This gives the approximation formula
- y(x h)y(x)hy(x)(h2/2)y(x)
24Contd
-
- yi1yih(xiyi)(h2/2)(1xiyi)
-
- For n2 (h0.5), we find
- y1y0h(x0y0)(h2/2)(1x0y0)
- 20.5(02)((.5)2/2)(102)3.375
- y2y1h(x1y1)(h2/2)(1x1y1)
3.3750.5(0.53.375)((0.5)2/2)(10.53.375)5.92
19
25MATLAB Program f. Taylor
26Plot (Taylor)
27RUNGE-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 Eulers method and
adding that on to current value yi. This method
is known as the midpoint method.
28Midpoint Method
- k1hf(xi,yi) Change in y given by Eulers method.
- k2hf(xi0.5h,yi0.5k1) Change in y using slope
estimate at midpoint
29Solving a Simple ODE with Midpoint Method
- Consider the differential equation
- yx y 0 x 1 with a initial condition
(a0.0, b0.0), y(0) 2. - First, we find the approximate solution for h0.5
(n2), a very large step size. - k1hf(x0,y0)0.5(0.02.0)1.0
- k2hf(x00.5h,y00.5k1)0.5(0.00.50.52.00.51.
0)1.375 - Y1y0k22.01.3753.375
- Next, we find the approximate solution y2 at
point x20.02h1.0
30Contd
- k1hf(x1,y1)0.5(x1,y1)0.5(0.53.375)1.9375
- k2hf(x10.5h,y10.5k1)0.5(0.50.50.53.3750.5
1.9375)2.547 - y2y1k23.3752.54695.922
31MATLAB Prog. f. Midpoint
32Plot (Midpoint)
33References
- 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