Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Mathematica: Infinite expression error when using NDSolve

  1. Jan 21, 2012 #1
    Dear all,

    If someone could help me solve this mathematica NDSolve problem, that would be really nice. Here is a related, simpler problem to the one I am having. Suppose I want to solve the nonlinear ODE
    \left(2 r + f(r) f'(r) \right) (1 + f'(r)^2) + r f(r) f''(r) = 0
    subject to the initial conditions
    f(R) = f(-R) = 0 \,.
    This problem is simpler than the one I actually want to solve, because in this case I know that the solution is
    f(r) = (R^2 - r^2)^{1/2} \,.

    I would like to try and recreate the above solution by using NDSolve in mathematica. I try using the code
    Code (Text):

    NDSolve[{(2 r + f[r] f'[r]) (1 + f'[r]^2) + r f[r] f''[r] == 0,
      f[1] == 0, f[-1] == 0}, f, {r, -1, 1}]
    but I receive the error message "Power::infy: Infinite expression 1/0. encountered." I would like to recreate the solution f(r) = \sqrt{1 - r^2}.

    Thanks in advance for any help!

    Last edited: Jan 21, 2012
  2. jcsd
  3. Jan 21, 2012 #2
    An interesting question (and well asked). Unfortunately, I don't have a good answer for you.

    If you use Trace[ NDSolve[...], TraceInternals->True], then you can see that NDSolve is trying the shooting method when it all goes wrong. However, I'm not sure what exactly is going wrong nor how to fix it.

    I suggest you contact WRI tech support (http://www.wolfram.com/support/contact/) and see if they can sort it out.
    If they do have a good answer, it would be great if you could post it here.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Similar Threads for Mathematica Infinite expression
Mathematica Storing Mathematica output
Mathematica Mathematica to MATLAB
Mathematica Cannot do the integral of the Hyper-geometric function?
Mathematica Cannot Plot This Function in Mathematica
Mathematica While Loop in Mathematica