1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

4th order RK to solve 2nd order ODE

  1. Dec 2, 2016 #1
    1. The problem statement, all variables and given/known data
    Consider the initial value problem x" + x′ t+ 3x = t; x(0) = 1, x′(0) = 2 Convert this problem to a system of two first order equations and determine approximate values of the solution at t=0.5 and t=1.0 using the 4th Order Runge-Kutta Method with h=0.1.
    2. Relevant equations
    yn+1 = yn + 1/6 ( k1 + 2k2 + 2k3 + k4)
    k1 = h* f(xn, yn)
    k2 = h* f(xn + 1/2 h, yn + 1/2 k1)
    k3 = h* f(xn + 1/2 h, yn + 1/2 k2)
    k4 = h* f(xn+1, yn+k3)
    3. The attempt at a solution
    I tried to convert the equation into two linear ODEs:

    x = x1
    x′= x1' = x2
    x′′= x1'' = x2'

    x2' = -x2 t + t - 3x1 (first linear ODE)
    x1' = x2 (second linear ODE)

    I do not know what to do from here.
    From 4th Order RK equations, I do not know what f(xn, yn) is.
     
    Last edited by a moderator: Dec 2, 2016
  2. jcsd
  3. Dec 2, 2016 #2
    The Runge-Kutta method give the solution to the differential equation:
    $$x'(t)=f(x,t)$$

    This can also be generalized to several equations by allowing ##x(t)## and ##f(x,t)## being vectors, i.e. ##x=(x_1,x_2,...,x_n)## and ##f=(f_1,f_2,...,f_n)##. So, in your case ##f=(f_1,f_2)## is a two-dimensional array containing the right-hand side of each equation.

    By the way, I recommend that you use Latex to write your equations. In your post it is difficult to read them.
     
  4. Dec 2, 2016 #3

    Ray Vickson

    User Avatar
    Science Advisor
    Homework Helper

    See
    http://math.stackexchange.com/quest...-order-method-on-a-system-of-2-first-order-od
    for a detailed explanation plus worked example.

    BTW: I do not agree that your work is difficult to read; in fact, it reads surprisingly well and looks quite good. However, post #2 is correct in suggesting the use of LaTeX; you would find it much easier and faster than constantly using the [ S U B] ... [/ S U B] construction, and it wold look even better than what you have already.
     
  5. Dec 2, 2016 #4

    epenguin

    User Avatar
    Homework Helper
    Gold Member

    Some of the ' need to be outside of the [ SUB] ' [/SUB]
     
  6. Dec 2, 2016 #5

    Mark44

    Staff: Mentor

    I moved them, so it should be OK now.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted



Similar Discussions: 4th order RK to solve 2nd order ODE
Loading...