1. Limited time only! Sign up for a free 30min personal 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!

Runge-Kutta Numerical Integration

  1. Dec 1, 2009 #1
    1. The problem statement, all variables and given/known data
    In brief, I am working on a stellar model.

    We started with these four equations:
    [tex]\delta q/\delta x = px^{2}/t[/tex]
    [tex]\delta p /\delta x = -pq/tx^{2}[/tex]
    [tex]\delta t /\deltax = -Cp^{1.75} / x^{2}t^{8325}[/tex]
    [tex]\delta t /\delta x = -2q/5x^{2}[/tex]

    In the model you switch to the 4th equation instead of the 3rd when the ratio of the 3rd to the 4th is less than 1.

    Because the variables p and t vary over orders of magnitude we switch to logarithmetic variables.

    [tex]g_{1}=log(p)[/tex]
    [tex]g_{2}=log(q)[/tex]
    [tex]g_{3}=log(t)[/tex]
    [tex]y=log(x)[/tex]

    The 4 equations transform to:
    [tex]log[-\delta g_{1}/\delta y] = g_{2} - g_{3} - y[/tex]
    [tex]log[\delta g_{2}/\delta y] = g_{1} + 3y - g_{2} - g_{3}[/tex]
    [tex]log[-\delta g_{3}/\delta y] = log(C) + 1.75g_{1} - y - 9.25g_{3}[/tex]
    [tex]log[-\delta g_{3}/\delta y] = log(2/5) + g_{2} - g_{3} - y[/tex]

    log(C) = -5.51674

    The initial conditions are:
    x = 1, q = 1, t = 0, p = 0

    Since we encounter problems we use:

    [tex]p^{1.75} = 1.75t^{8.25}/8.25C[/tex]
    [tex]t = 1.75/8.25(1/x - 1)[/tex]

    to find these initial values.

    We then work on way inward (from x = 1 to x = 0)

    2. The attempt at a solution
    I worked out
    g1 = -8.37512874
    g2 = 1
    g3 = -2.36361205
    y = -0.00877392431

    to be initial values.

    Now I am having troubles doing the actual numerical integration...for instance if I try to find g1 at a point x-h(where h I have .02) i do this:

    [tex]g_{1 at x-h} = g_{1 at x} + (1/6)(k_{1} + 2k_{2} + 2k_{3} + k_{4})}[/tex]

    Now [tex]k_{1}[/tex] is simply the derivative of [tex]g_{1}[/tex] at x.
    For [tex]k_{2}[/tex] I use [tex]x + .5hk_{1}[/tex] instead of x in the derivative equation(and the same method for k3 and k4).

    Is this correct? Also I don't know what to do about that log outside(meaning, do I raise 10 by the right-hand side to get the actual derivative and not the log of it?).

    Thanks in advance
     
  2. jcsd
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?



Similar Discussions: Runge-Kutta Numerical Integration
  1. Numerical methods (Replies: 0)

  2. Numerical Range (Replies: 0)

Loading...