Results 1 to 9 of 9

Math Help - Runge-Kutta of Order 4

  1. #1
    Newbie
    Joined
    Jan 2009
    Posts
    10

    Unhappy Runge-Kutta of Order 4

    Good day everyone,

    Until now I cannot move on with these two problems. I don't even know where to start . Anywhere, here goes:

    1.) At time t, a pendulum makes an angle x(t) with the vertical axis. Assuming there is no friction, the equation of motion is

    mlx''(t)=-mg sin(x(t))


    where m is the mass and l is the length of the string. Use the Runge-Kutta method to solve the differential equation over the interval [0, 2] using M = 40 steps and h = 0.05 if g = 32 ft/secē and
    (a) l= 3.2 ft and x(0) = 0.3 and x'(0) = 0
    (a) l= 0.8 ft and x(0) = 0.3 and x'(0) = 0

    My concerns for this problem are that
    (1) Am i supposed to integrate
    mlx''(t)=-mg sin(x(x)) so that x'' becomes x' and then proceed with the iteration process?
    (2) I am having a hard time trying to figure out the iteration for this problem since x(t) is not represented as an equation.



    2.) Predator-Prey model. An example of a system of nonlinear differential equations is the predator-prey problem. Let x(t) and
    y(t) denote the population of rabbits and foxes, respectively at time t. The predator-prey model asserts that x(t) and y(t) satisfy


    x'(t)=Ax(t) - Bx(t)y(t)

    y'(t)=Cx(t)y(t) - Dy(t)

    A typical computer simulation might use the coefficients
    A = 2, B = 0.02, C = 0.0002, D = 0.8.
    Use the Runge-Kutta method to solve the differential equation over the interval [0, 5] using M = 50 steps and h = 0.1 if
    (a) x(0) = 3,000 rabbits and y(0) = 120 foxes
    (b) x(0) = 5,000 rabbits and y(0) = 100 foxes

    I basically have the same concern as the first problem. Both x(t) and y(t) are not represented as equations, but as functions alone.

    I just need someone to help me start with the two problems .
    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 zeugma View Post
    Good day everyone,

    Until now I cannot move on with these two problems. I don't even know where to start . Anywhere, here goes:

    1.) At time t, a pendulum makes an angle x(t) with the vertical axis. Assuming there is no friction, the equation of motion is

    mlx''(t)=-mg sin(x(t))



    where m is the mass and l is the length of the string. Use the Runge-Kutta method to solve the differential equation over the interval [0, 2] using M = 40 steps and h = 0.05 if g = 32 ft/secē and


    (a) l= 3.2 ft and x(0) = 0.3 and x'(0) = 0


    (a) l= 0.8 ft and x(0) = 0.3 and x'(0) = 0



    My concerns for this problem are that


    (1) Am i supposed to integrate mlx''(t)=-mg sin(x(x)) so that x'' becomes x' and then proceed with the iteration process?


    (2) I am having a hard time trying to figure out the iteration for this problem since x(t) is not represented as an equation.

    Numerical ODE solvers usually work on ODE's of the form:

    x'(t)=f(t,x)

    The way you get them to operate on higher order ODE's is to turn the ODE into a system of first order ODE's.

    Here you have:

    x''(t)=f(x) ,

    so we put \bold{x}={\bold{x}_1 \brack \bold{x}_2}={x \brack x'}

    Then:

     <br />
\bold{x}'={x' \brack x''}={x' \brack f(x)}={\bold{x}_2 \brack f(\bold{x}_1)}<br />

    Now you can use RK4 on this equation.

    CB
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4
    Quote Originally Posted by zeugma View Post
    2.) Predator-Prey model. An example of a system of nonlinear differential equations is the predator-prey problem. Let x(t) and y(t) denote the population of rabbits and foxes, respectively at time t. The predator-prey model asserts that x(t) and y(t) satisfy





    x'(t)=Ax(t) - Bx(t)y(t)





    y'(t)=Cx(t)y(t) - Dy(t)





    A typical computer simulation might use the coefficients





    A = 2, B = 0.02, C = 0.0002, D = 0.8.


    Use the Runge-Kutta method to solve the differential equation over the interval [0, 5] using M = 50 steps and h = 0.1 if


    (a) x(0) = 3,000 rabbits and y(0) = 120 foxes


    (b) x(0) = 5,000 rabbits and y(0) = 100 foxes





    I basically have the same concern as the first problem. Both x(t) and y(t) are not represented as equations, but as functions alone.





    I just need someone to help me start with the two problems .









    Same idea here:

     <br />
\bold{x}={\bold{x}_1 \brack \bold{x}_2}={x \brack y}<br />

    Then:

    \bold{x}'={A \bold{x}_1 - B \bold{x}_1 \bold{x}_2 \brack C \bold{x}_1 \bold{x}_2 -D \bold{x}_2}

    CB
    Follow Math Help Forum on Facebook and Google+

  4. #4
    Newbie
    Joined
    Jan 2009
    Posts
    10
    Quote Originally Posted by CaptainBlack View Post
    Numerical ODE solvers usually work on ODE's of the form:

    x'(t)=f(t,x)

    The way you get them to operate on higher order ODE's is to turn the ODE into a system of first order ODE's.

    Here you have:

    x''(t)=f(x) ,

    so we put \bold{x}={\bold{x}_1 \brack \bold{x}_2}={x \brack x'}

    Then:

     <br />
\bold{x}'={x' \brack x''}={x' \brack f(x)}={\bold{x}_2 \brack f(\bold{x}_1)}<br />

    Now you can use RK4 on this equation.

    CB
    Hi CaptainBlack,

    Thank you so much for replying. I just have one concern though. Call me stupid, but I just don't know how to do it.
    Anyways, how do I plug in the Runge-Kutta equation?

    f_{n+1}=f_n+\frac{h(f_1+2f_2+2f_3+f_4)}{6}

    where

    f_1=f(t_n,y_n)

    f_2=f(t_n+\frac{h}{2},y_n+\frac{h}{2}f_1)

    f_3=f(t_n+\frac{h}{2},y_n+\frac{h}{2}f_2)

    f_4=f(t_n+h,y_n+hf_3)

    I'm sure I can solve for #2 if I just know how to do it in #1
    Follow Math Help Forum on Facebook and Google+

  5. #5
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4
    Quote Originally Posted by zeugma View Post
    Hi CaptainBlack,

    Thank you so much for replying. I just have one concern though. Call me stupid, but I just don't know how to do it.
    Anyways, how do I plug in the Runge-Kutta equation?

    f_{n+1}=f_n+\frac{h(f_1+2f_2+2f_3+f_4)}{6}

    where

    f_1=f(t_n,y_n)

    f_2=f(t_n+\frac{h}{2},y_n+\frac{h}{2}f_1)

    f_3=f(t_n+\frac{h}{2},y_n+\frac{h}{2}f_2)

    f_4=f(t_n+h,y_n+hf_3)

    I'm sure I can solve for #2 if I just know how to do it in #1
    Write the ODE as the vector first order vector ODE:

    \bold{y}'=\bold{f}(t,\bold{y})

    Then the 4th order RK stepping algorithm is:

    \bold{y}_{n+1}=\bold{y}_n+\frac{h(\bold{k}_1+2\bol  d{k}_2+2\bold{k}_3+\bold{k}_4)}{6}

    where

    \bold{k}_1=\bold{f}(t_n,\bold{y}_n)

    \bold{k}_2=\bold{f}(t_n+\frac{h}{2},\bold{y}_n+\fr  ac{h}{2}\bold{k}_1)

    \bold{k}_3=\bold{f}(t_n+\frac{h}{2},\bold{y}_n+\fr  ac{h}{2}\bold{k}_2)

    \bold{k}_4=\bold{f}(t_n+h,\bold{y}_n+h\bold{k}_3)

    Here a bold charater denotes a vector quantity, and the starting value of \bold{y}_0 is given by the initial conditions.

    From here it is just (vector) arithmetic.

    CB
    Follow Math Help Forum on Facebook and Google+

  6. #6
    Newbie
    Joined
    Jan 2009
    Posts
    10
    By the way, I just would like to confirm regarding the given equation in #1,

    mlx''(t)=-mg sin(x(t))


    Am I right in canceling the "m" in both sides of the equation
    ? I am also assuming that the x'' would be isolated at the left-hand side of the equation,

    x''=-\frac{g sinx(t))}{l}
    Follow Math Help Forum on Facebook and Google+

  7. #7
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4
    Quote Originally Posted by zeugma View Post
    By the way, I just would like to confirm regarding the given equation in #1,

    mlx''(t)=-mg sin(x(t))


    Am I right in canceling the "m" in both sides of the equation? I am also assuming that the x'' would be isolated at the left-hand side of the equation,

    x''=-\frac{g sinx(t))}{l}
    Other that the mismatch in opening and closing brackets, that looks OK

    x''=-\frac{g\ \sin(x(t))}{l}



    CB
    Follow Math Help Forum on Facebook and Google+

  8. #8
    Newbie
    Joined
    Jan 2009
    Posts
    10
    From the RK4 equation, I'm supposed to solve for k_1,k_2,k_3, and k_4 to use the equation below:


    y_{n+1}=y_n+\frac{h(k_1+2k_2+2k_3+k_4)}{6}

    I understand that k_1 is solved by getting f(t_n,y_n) and that
    f(t_n,y_n)=-\frac{gsin(x(t))}{l}. From here I don't know how to proceed since I don't know what values to fill in for x(t). Just looking at the equations make me so confused.


    Follow Math Help Forum on Facebook and Google+

  9. #9
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4
    Quote Originally Posted by zeugma View Post
    From the RK4 equation, I'm supposed to solve for k_1,k_2,k_3, and k_4 to use the equation below:


    y_{n+1}=y_n+\frac{h(k_1+2k_2+2k_3+k_4)}{6}

    I understand that k_1 is solved by getting f(t_n,y_n) and that
    f(t_n,y_n)=-\frac{gsin(x(t))}{l}. From here I don't know how to proceed since I don't know what values to fill in for x(t). Just looking at the equations make me so confused.

    Go back and read the second post in this thread.

    CB
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Runge Kutta method - 2nd order numerically
    Posted in the Differential Equations Forum
    Replies: 1
    Last Post: October 30th 2010, 12:19 AM
  2. How to derive the Runge Kutta 2nd Order Method?
    Posted in the Differential Equations Forum
    Replies: 0
    Last Post: October 10th 2010, 02: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 on second order differential
    Posted in the Differential Equations Forum
    Replies: 5
    Last Post: January 12th 2010, 07:55 AM
  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