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!

Difficult non-linear differential equation

  1. Jun 20, 2012 #1
    1. The problem statement, all variables and given/known data

    I need to solve this differential equation numerically. I hope you can help me, it's not homework!

    2. Relevant equations

    This is the equation to be solved

    [itex]x''=\dfrac{\alpha}{x}-\beta\dfrac{(x'-\gamma x)^2}{x}-\delta x - \dfrac{\varepsilon}{x^2}[/itex]


    3. The attempt at a solution

    I've tried with a simple discretization, but it doesn't seem to be stable.

    [itex]\dfrac{x(i)-2x(i-1)+x(i-2)}{h^2}=\dfrac{\alpha}{x(i-1)}-\beta\dfrac{\left(\dfrac{x(i)-x(i-1)}{h}-\gamma x(i-1)\right)^2}{x(i-1)}-\delta x(i-1) - \dfrac{\varepsilon}{x(i-1)^2}[/itex]

    I think it's better to use Runge-Kutta IV but I have no idea how to apply it on such a complicated equation.
     
  2. jcsd
  3. Jun 20, 2012 #2

    Filip Larsen

    User Avatar
    Gold Member

    You can reduce a second order ODE like that to a set of first order ODE by introducing an extra state variable. For instance, in your case you could set v = x' and get the following first order equations

    v' = α/x - β (v-γx)2/x - δx - ε/x2, and
    x' = v

    Thus, (x,v) is the state of the system and the field that you have to provide to methods like RK4 is given by the right hand side of the equations.
     
  4. Jun 20, 2012 #3
    Thanks that helped but I have still some problem in computing v.

    According to what you wrote and the runge Kutta IV method definition the k should be:

    [itex]k1=hf(t_{i},x_{i})[/itex]
    [itex]k2=hf(t_{i+1/2},x_{i}+k1/2)[/itex]
    [itex]k3=hf(t_{i+1/2},x_{i}+k2/2)[/itex]
    [itex]k4=hf(t_{i+1},x_{i}+k3)[/itex]

    How is v for every k?
     
  5. Jun 20, 2012 #4

    Filip Larsen

    User Avatar
    Gold Member

    No, your state consist of two variables, not just one, meaning that in the context of the RK4 method the state variable (not to be confused with the x in your equations), the field f and the k-values are all two-dimensional. For instance, when applied to your state variables the stage k1 = h f(ti,yi) from the RK4 method (where I used y = (x,v) to denote the complete state) really means k1 = (kx1, kv1) = h f(ti,xi,vi).
     
  6. Jun 20, 2012 #5
    Ah ok, thanks. So in my case, since I don't have an explicit time dependency the ks should be


    [itex]k1=hf(x_{i},v_{i})[/itex]
    [itex]k2=hf(x_{i}+k1/2,v_{i}+k1/2,)[/itex]
    [itex]k3=hf(x_{i}+k2/2,v_{i}+k2/2)[/itex]
    [itex]k4=hfx_{i}+k3,v_{i}+k3)[/itex]

    Is that right?
     
  7. Jun 20, 2012 #6

    Filip Larsen

    User Avatar
    Gold Member

    Correct, but remember as was mentioned, that the field f also evaluates to two values, one for x' and one for v' so you need to treat the k-values as vectors also when you combine them to a new y value.
     
  8. Jun 20, 2012 #7
    Sorry but I don't understand how to compute the Ks considering them as arrays. I tried googling it but I couldn't find anything. Can please you make an example?
     
  9. Jun 20, 2012 #8

    Filip Larsen

    User Avatar
    Gold Member

    You should treat them as vectors with two elements. If we define the field as the (column) vector

    f(x,v) = ( fx(x,v), fv(x,v) )T ,

    that is, a vector with the two elements

    fx(x, v) = v and
    fv(x, v) = α/x - β (v-γx)2/x - δx - ε/x2,

    then from the definition of the RK4 method we have

    k1 = h f(xi, vi) = ( h fx(xi,vi), h fv(xi,vi) )T

    that is, the two elements of k1 is

    h fx(xi, vi) and
    h fv(xi, vi).

    If you are still confused by this I suggest that you read up on vector algebra.
     
  10. Jun 20, 2012 #9
    Ok, now I got it, thanks a lot for you time!
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Difficult non-linear differential equation
Loading...