Results 1 to 6 of 6

Math Help - Runge Kutta on second order differential

  1. #1
    Newbie
    Joined
    Oct 2009
    Posts
    6

    Runge Kutta on second order differential

    Hi, As part of my project I have been asked to code a program that peforms the runge kutta 4th order algoritm on a equation of form:
    ax'' + bx' + c = 0

    The way I have been told to do this is use x_1 and x_2 and use them like this:
    ax'' + bx' + c = ax_1 +bx_2 +c
    and then perform the runge Kutta algoritm on x_1 and x_2 serperately.

    I haven't done anything on second order differentials for awhile now, could someone tell me how to set this up? Also is an initial condition needed? I think the solution is something like f(x) =e^(Ax).
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4
    Quote Originally Posted by kenny View Post
    Hi, As part of my project I have been asked to code a program that peforms the runge kutta 4th order algoritm on a equation of form:
    ax'' + bx' + c = 0

    The way I have been told to do this is use x_1 and x_2 and use them like this:
    ax'' + bx' + c = ax_1 +bx_2 +c
    and then perform the runge Kutta algoritm on x_1 and x_2 serperately.

    I haven't done anything on second order differentials for awhile now, could someone tell me how to set this up? Also is an initial condition needed? I think the solution is something like f(x) =e^(Ax).
    What you do is reduce the second order ODE to a first order system or vector ODE, then use RK4 on that.

    You proceed by introducing the state vector:

    \bold{X}=\left[\begin{array}{c}x_1\\x_2\end{array}\right]

    where x_1=x and x_2=x', then your ODE becomes:

     <br />
\bold{X}'=\left[\begin{array}{c}x_1'\\x_2'\end{array}\right]=\left[\begin{array}{c}x_2\\-\frac{bx_2+c}{a}\end{array}\right]<br />

    CB
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Newbie
    Joined
    Oct 2009
    Posts
    6
    Thanks for your fast response.

    I'm still not quite sure how I am going to set it up. I have found the piece of paper with my supervisors hints. He does this:
    x'' + 5x' + 6x = 0
    x_1 = x, x_2 = x'
    x_1' = x_2, x_2' = x'' = -5x_2 -6x_1 (which is what you said basically)
    and sets up x' = Ax, which has solution e^(At)x_0

    This is the analytical solution and I understand it, but I'm kind of confused on the numerical methods way of doing it.

    I think its meant to be RK4 on x_1' = x_2 and then on x_2' = -5x_2 -6x_1, but what do I do with these two outputs?

    I'm fairly sure the original equation is only meant to have 1 output.
    Follow Math Help Forum on Facebook and Google+

  4. #4
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4
    Quote Originally Posted by kenny View Post
    Thanks for your fast response.

    I'm still not quite sure how I am going to set it up. I have found the piece of paper with my supervisors hints. He does this:
    x'' + 5x' + 6x = 0
    x_1 = x, x_2 = x'
    x_1' = x_2, x_2' = x'' = -5x_2 -6x_1 (which is what you said basically)
    and sets up x' = Ax, which has solution e^(At)x_0

    This is the analytical solution and I understand it, but I'm kind of confused on the numerical methods way of doing it.

    I think its meant to be RK4 on x_1' = x_2 and then on x_2' = -5x_2 -6x_1, but what do I do with these two outputs?

    I'm fairly sure the original equation is only meant to have 1 output.
    Have you used RK4 on a first order scalar ODE? You really need to have numerically integrated one of these before moving to the vector case.

    CB
    Follow Math Help Forum on Facebook and Google+

  5. #5
    Newbie
    Joined
    Oct 2009
    Posts
    6
    Yes I managed to code RK4 for a 1st order ODE (dx/dt = 5x) to run on my GPU and generate the answers fairly accurately.
    Follow Math Help Forum on Facebook and Google+

  6. #6
    Newbie
    Joined
    Oct 2009
    Posts
    6
    Could anyone please tell step by step what my program needs to do? I'm still not really sure what it is meant to do.
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Replies: 0
    Last Post: July 20th 2011, 03:04 PM
  2. Solving Second Order Differential Equations using Runge Kutta
    Posted in the Differential Equations Forum
    Replies: 5
    Last Post: December 22nd 2010, 12:33 PM
  3. Runge Kutta - Second order differential again.
    Posted in the Differential Equations Forum
    Replies: 0
    Last Post: January 13th 2010, 06:41 AM
  4. Runge-Kutta of Order 4
    Posted in the Advanced Applied Math Forum
    Replies: 8
    Last Post: March 10th 2009, 12:53 PM
  5. 4th Order Runge Kutta help
    Posted in the Calculus Forum
    Replies: 0
    Last Post: April 2nd 2008, 08:12 AM

Search Tags


/mathhelpforum @mathhelpforum