Re: A question about numerically solving differential equations

*To*: mathgroup at smc.vnet.net*Subject*: [mg130329] Re: A question about numerically solving differential equations*From*: Peter Pein <petsie at dordos.net>*Date*: Wed, 3 Apr 2013 04:09:42 -0400 (EDT)*Delivered-to*: l-mathgroup@mail-archive0.wolfram.com*Delivered-to*: l-mathgroup@wolfram.com*Delivered-to*: mathgroup-newout@smc.vnet.net*Delivered-to*: mathgroup-newsend@smc.vnet.net*References*: <kirks3$at8$1@smc.vnet.net>

Am 26.03.2013 09:05, schrieb Yue Zhao: > Hi, > > 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! > > Thanks! > > YZ > > One might be lucky when increasing WorkingPrecision in cases like these. With eqns and cond holding the sets of equations and conditions respectively: Block[{A = 100}, soln = NDSolve[Join[eqns, cond], {f0[r], f1[r]}, {r, 1, 10}, Method -> "StiffnessSwitching", WorkingPrecision -> 80]] leads to a seemingly usable solution Plot[Through[{f0, f1}[r]] /. soln // Evaluate, {r, 1, 10}] hth, Peter