Results 1 to 6 of 6

Math Help - Numerically Solving a Second Order Nonlinear ODE

  1. #1
    Newbie
    Joined
    Oct 2010
    Posts
    3

    Question Numerically Solving a Second Order Nonlinear ODE

    Hey guys, I am new here so hi.

    Okay, I have this not so pretty 2nd order non-linear ODE I should be able to solve numerically.

    f''(R)+(2/R)f'(R)=(.7/R)((1/sqrt(f))-((0.3)/sqrt(1-f))), f'(0)=1, f(1)=1

    I was thinking of breaking this guy up into a system of two first order ODE's and then solve, but I have no idea how to set this up. What method should I use to set up the system of ODE's so I can solve them numerically? If there is some other way of solving this guy I am more than open to those methods.
    Follow Math Help Forum on Facebook and Google+

  2. #2
    A Plied Mathematician
    Joined
    Jun 2010
    From
    CT, USA
    Posts
    6,318
    Thanks
    4
    Awards
    2
    The usual procedure is to let f_{1}=f, and f_{2}=f_{1}'. Then your DE would translate to the following system:

    f_{1}'=f_{2}

    \displaystyle f_{2}'=-\frac{2f_{2}}{R}+\frac{.7}{R}\left(\frac{1}{\sqrt{  f_{1}}}-\frac{0.3}{\sqrt{1-f_{1}}}\right).

    Question: are the conditions f'(0)=1, f(1)=1 accurate? Because those are mixed boundary conditions, not initial conditions. That will radically change the method of solution. I would probably do some sort of shooting method (pick initial conditions, and try to "hit" the end conditions - keep doing until you get close enough).

    If those conditions are accurate, you could try a combination of Runge-Kutta 4 with a shooting method.

    Make sense?
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Newbie
    Joined
    Oct 2010
    Posts
    3
    Hey Ackbeet, the function f in terms of R and everything else is a constant (i.e. I have already put in the initial conditions). I am trying to replicate one of the solutions (Numerically Solving a Second Order Nonlinear ODE-ice-graph.png) with the constants 0.7 and 0.3.

    From the picture I am pretty sure that the f(1)=1 boundary is okay. But I was not sure about the other one. From the looks of it f is approaching zero as R approaches zero from the positive side.

    The Runge-Kutta 4 method should work anywhere between the asymptotic points. As for the asymptotes is there a method I can use to get as close as I can and still get a pretty good result.
    Follow Math Help Forum on Facebook and Google+

  4. #4
    A Plied Mathematician
    Joined
    Jun 2010
    From
    CT, USA
    Posts
    6,318
    Thanks
    4
    Awards
    2
    The function f in terms of R and everything else is a constant (i.e. I have already put in the initial conditions).
    That makes no sense. The function graphed in your attached png file is not constant. I'm assuming \phi=f?

    From the looks of it f is approaching zero as R approaches zero from the positive side.
    Not to me. It looks as though f is doing something wild near the origin. Is f the solid line plotted, or the dotted line?

    Runge-Kutta 4 does NOT, by itself, solve boundary value problems like what you have here. It solves initial value problems. You can use Runge-Kutta 4 in conjunction with a higher-level algorithm, like a shooting method, to solve a boundary value problem.
    Follow Math Help Forum on Facebook and Google+

  5. #5
    Newbie
    Joined
    Oct 2010
    Posts
    3
    The dotted line is the one I am focused on. Yea you are right, there could be some pretty wild behavior near origin they couldn't numerically solve (this graph is pretty old from 1967). From this I only know what the boundary conditions are at one end.

    By focusing on only one of the solutions (one being the dotted line) am I not solving an initial value problem?
    Follow Math Help Forum on Facebook and Google+

  6. #6
    A Plied Mathematician
    Joined
    Jun 2010
    From
    CT, USA
    Posts
    6,318
    Thanks
    4
    Awards
    2
    If you only know the "boundary conditions" at one end, then you really have initial conditions. It looks like the slope at R=1 is about 1. So you could have f(1) = 1, and f'(1) = 1. Those would be initial conditions. At this point, you could run RK4 backwards towards the origin. I would probably take smaller steps when you get to around 0.3, and 0.05. Corners are often numerically sensitive.

    On second thought, your slope is less than one. You could try "shooting" towards the point (0.3,0), which is on a smooth part of the curve from (1,1). That might allow you to fine-tune the initial slope.

    By focusing on only one of the solutions (one being the dotted line) am I not solving an initial value problem?
    I wouldn't phrase it that way. Boundary versus initial conditions all has to do with the values of the independent variable at which you know something about the function. If you have a second-order DE, for example, and you know the function value and the first derivative at the same value, that's an initial value problem. On the other hand, if you know the function value at two different points, that's a boundary value problem.
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Replies: 0
    Last Post: June 20th 2011, 01:37 PM
  2. Solving a first-order nonlinear ordinary differential equation
    Posted in the Differential Equations Forum
    Replies: 7
    Last Post: May 8th 2011, 02:13 PM
  3. Runge Kutta method - 2nd order numerically
    Posted in the Differential Equations Forum
    Replies: 1
    Last Post: October 30th 2010, 12:19 AM
  4. Problem solving ODE numerically using Maple
    Posted in the Math Software Forum
    Replies: 0
    Last Post: December 16th 2009, 05:03 PM
  5. Solving a system graphically and numerically
    Posted in the Pre-Calculus Forum
    Replies: 3
    Last Post: December 1st 2008, 12:34 PM

Search Tags


/mathhelpforum @mathhelpforum