1

I am using Mathematica to numercially solve the following equations:

2 D[f0[r], r]/r + D[f0[r], r, r] == -2 A f1[r]/r^4 +  2 A D[f1[r], 
r]/r^3 -2 f1[r]/r^2 + 2 D[f1[r], r]/r + D[f1[r], r, r] == 2 A D[f0[r], r]/r^3

And my boundary condition is

f0[10] == 0.01, f1[10] == 0.01, 
(D[f0[r], r] /. r -> 1) == 10^-3 A, 
(D[f1[r], r] /. r -> 1) == 0

When I take A to be small, say 1, everything is fine. However, if I take A to be large, e.g. 100, Mathematica complains and gives me crazy results. Here are the error message I get:

NDSolve::bvluc: The equations derived from the boundary conditions are numerically ill-conditioned. The boundary conditions may not be sufficient to uniquely define a solution. The computed solution may match the boundary conditions poorly. >>

NDSolve::berr: There are significant errors {-5.55116*10^6,-7.26312*10^6,0., 0.} in the boundary value residuals. Returning the best solution found. >>

Can anyone help me to deal with this issue? I appreciate your help!

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574
user6573
  • 11
  • 1
  • 1
    Could you tell us more precisely what you mean by "deal with this issue"? – whuber Mar 26 '13 at 01:15
  • Thanks for the reply! The equations I am trying to solve are well defined, Mathematica has already provided the correct answer when A is small. However, it seems that Mathematica has some technical issue when I increase A. For example when A is 100, the result blows up at r=10, which is not consistent with the boundary conditions. My question is whether there is a way (option), for example the steps of iterations, which I can play with to make Mathematica solve the equations properly when A is large. – user6573 Mar 26 '13 at 01:23
  • Exactly how are you using Mathematica to solve these equations? NDSolve does a fine job if you solve for f0 first and then for f1 in terms of it. – whuber Mar 26 '13 at 01:47
  • I combine equations and boundary conditions into a larger set of equations, and use NDSolve for the problem. NDSolve[{equations, boundary conditions}, {f0[r], f1[r]}, {r, 1, 10}] What do you mean by solving f0 first and then for f1 in terms of it? They are coupled to each other, how do you separate them off? Thanks a lot for your help! – user6573 Mar 26 '13 at 02:00
  • f0 is evidently independent: 2 D[f0[r], r]/r + D[f0[r], r, r] == 2 A D[f0[r], r]/r^3 – Federico Mar 26 '13 at 23:56

1 Answers1

1

You may solve this by increasing the WorkingPrecision like so:

eqn = {2 D[f0[r], r]/r + D[f0[r], r, r] == -2 A f1[r]/r^4 + 
     2 A D[f1[r], r]/r^3,
   -2 f1[r]/r^2 + 2 D[f1[r], r]/r + D[f1[r], r, r] == 
    2 A D[f0[r], r]/r^3};
bc = {f0[10] == 1/100, 
   f1[10] == 1/100, (D[f0[r], r] /. r -> 1) == 
    10^-3 A, (D[f1[r], r] /. r -> 1) == 0};

A = 80
NDSolve[{eqn, bc}, {f0, f1}, {r, 1, 10}, WorkingPrecision -> 60, 
 MaxSteps -> Infinity]
A =.;