The error occurs, because f[x]
vanishes near x == 0.4976549855466093
. This problem can be overcome by experimenting to obtain a better estimate for Derivative[1][f][xmin]
. To illustrate, supply as the missing constants,
xmin = .01; p = 10^-3; A = 10;
Then,
s = NDSolve[{eqn3[b1, c1, A] == 0, f[xmin] == 1, f[1] == p}, f[x], {x, xmin, 1},
Method -> {"Shooting", "StartingInitialConditions" -> {f[xmin] == 1,
Derivative[1][f][xmin] == -94.81}}];
LogPlot[f[x] /. s, {x, xmin, 1}]
Obtaining smaller p
As noted at the beginning of this answer, the ODE becomes singular at f[x] = 0
. Hence, seeking a solution with p = 0
or very near to zero causes the Shooting Method problems. An automated approach for obtaining very small p
is as follows. First, obtain a numerical solution parameterized in terms of Derivative[1][f][xmin] == bc
.
s = ParametricNDSolveValue[{eqn3[b1, c1, A] == 0, f[xmin] == 1,
Derivative[1][f][xmin] == bc}, f, {x, xmin, 1}, {bc}]
and then Plot
the value of bc
at which f[x] = 0
or the endpoint x = 1
is reached, whichever occurs first.
Plot[(Quiet@s[bc]["Domain"])[[1, 2]], {bc, -100, -90}]
A precise value of the break in the slope of the curve is the desired value of bc
, which can be obtain by
bl = -100; bu = -90; inf = 1;
Do[bt = (bl + bu)/2; If[Quiet@s[bt]["Domain"][[1, 2]] < inf, bl = bt, bu = bt], {i, 30}]
N[bu, 12]
(* -94.8105141707 *)
s[bu][1]
(* 4.96698*10^-8 *)
which is a reasonable approximation of zero. For this approach to work, the initial estimates of bl
and bu
must bracket the desired value of bc
.
xmin
,A
, andp
. Setting them equal to zero causes problems. $\endgroup$