Register to reply 
Solving Second Order Differential Equations using Runge Kutta 
Share this thread: 
#1
Dec2010, 04:05 PM

P: 3

1. The problem statement, all variables and given/known data
In aerodynamics, one encounters the following initial value problem for Airy’s equations: y''(x) + xy = 0, y(0) = 1, y'(0) = 0 Using the RungeKutta method with h=0.005 and determine values between x=0 and x=10 sufficient to sketch the relationship. 2. Relevant equations y''(x) + xy = 0, y(0) = 1, y'(0) = 0 I think, k1 = h*f(Xn, Yn) k2 = h*f(Xn+h/2, Yn+k1/2) k3 = h*f(Xn+h/2, Yn+k2/2) k4 = h*f(Xn + h, Yn + k3) 3. The attempt at a solution From what I have read you cant do second order ODE using runge kutta without breaking it into a system of first order ODEs so thats what I tried. I tried: d2y/dx2 + xy = 0 dy/dx = z, y(0) = 1 dz/dx + xy = 0 dz/dx = xy, z(0) = 0 I dont know if that is right or not and if it is I have no idea where to go from here. Thanks for any help. 


#2
Dec2110, 03:22 AM

P: 51

Have you ever used mathcad? It has a very easy to use RK function. First, however, you do need to reduce the order and define your system of DE's.



#3
Dec2110, 07:17 AM

Math
Emeritus
Sci Advisor
Thanks
PF Gold
P: 39,353




#4
Dec2110, 09:41 AM

Mentor
P: 15,067

Solving Second Order Differential Equations using Runge Kutta
[tex]\frac{d\vec x}{dt} = A \vec x\,, \quad\vec x(0) = \vec x_0[/tex] where [itex]\vec x[/itex] is some nvector, A is a constant nbyn matrix, and x_{0} is the initial (vectorial) value. The Runge Kutta equations can be used to numerically this problem. Back to your problem: Create a 2vector, I'll call it u, that comprises your y and its derivative: [tex]\begin{aligned} z &\equiv \frac{dy}{dx} \\[6 pt] \vec u &= \bmatrix y \\ z\endbmatrix \end{aligned}[/tex] You have already derived that [itex]dy/dx = z, y(0) = 1[/itex] and [itex]dz/dx = xy, z(0) = 0[/itex]. From these, can you come up with an expression for the initial value of the vector u and the derivative of the vector u with respect to x? 


#5
Dec2110, 04:16 PM

P: 3

I am doing this all in MATLAB, This is what I have come up with but I am not sure if this is correct or not.
Attached are my MATLAB code, a Graph of the results, and an excel sheet of all results. It is zipped because it was to big otherwise. the matlab code can be opened in notepad. Thanks for any help. 


#6
Jun311, 06:55 AM

P: 6

Yes, your approach is right.
d2y/dx2 + xy = 0 dy/dx = z (1) dz/dx = xy (2) y' = z, then define y(n+1) = y(n) + (h/6)*(k1 + 2*k2 + 2*k3 +k4) and for, z' = xy, define, z(n+1) = z(n) + (h/6)*(j1 + 2*j2 + 2*j3 +j4) now define k1 , k2 , k3 , k4 and j1 , j2 , j3 , j4 k1 = z j1 = x*y k2 = z + 0.5 * j1 j2 = ( x + 0 .5 * h ) *(y + 0.5 * k1) k3 = z + 0.5 * j2 j3 = ( x + 0 .5 * h ) *(y + 0.5 * k2) k4 = z + j2 j4 = ( x + h ) *(y + k2) 


#7
Nov1112, 10:10 PM

P: 2

I have a similar problem with Runge Kutta with y''+2xy'=0 given boundary conditions are y=1 at x=0 and y=0 at x=infinity. I am not able to understand how to transform the second boundary condition (i.e.y=0 at x=infinity) to find a definitive value of y' at x=0.



Register to reply 
Related Discussions  
2nd Order RungeKutta: 2nd Order Coupled Differential Equations  Calculus & Beyond Homework  3  
Runge Kutta for solving 2nd order ODE  Introductory Physics Homework  0  
Reducing third order ODE to a system of first order equs + 4th order rungekutta  Differential Equations  1  
Reducing third order ODE to a system of first order equs + 4th order rungekutta  Calculus & Beyond Homework  0  
Runge kutta method for solving PDE  Differential Equations  0 