1
$\begingroup$

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!

$\endgroup$
5
  • 1
    $\begingroup$ Could you tell us more precisely what you mean by "deal with this issue"? $\endgroup$
    – whuber
    Mar 26, 2013 at 1:15
  • $\begingroup$ 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. $\endgroup$
    – user6573
    Mar 26, 2013 at 1:23
  • $\begingroup$ 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. $\endgroup$
    – whuber
    Mar 26, 2013 at 1:47
  • $\begingroup$ 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! $\endgroup$
    – user6573
    Mar 26, 2013 at 2:00
  • $\begingroup$ f0 is evidently independent: 2 D[f0[r], r]/r + D[f0[r], r, r] == 2 A D[f0[r], r]/r^3 $\endgroup$
    – Federico
    Mar 26, 2013 at 23:56

1 Answer 1

1
$\begingroup$

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 =.;
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.