I am trying to solve a nonlinear ODE BY applying a NDsolve and using StiffnessSwitching method, but when I try to find the root of my equation it gives me a error message. The same code is working well in Mathematica version 9, but in M.version 11.3 that I just upgraded is not working I do not know why this happened.
Would anyone help me please?
Here is my code
Z=800;
g= 0.023800000000000000000;
k2= 0.000194519;
R= 1.5472;
ytest0= -13.911917694213733`;
? = $MachineEpsilon ;
y1[ytest_?NumericQ] :=
NDSolve[
{y''[r] + 2 y'[r]/r == ?2 Sinh[y[r]] , y[1] == ytest,
y'[?] == 0}, y, {r, ?, 1},
Method -> {"StiffnessSwitching", "NonstiffTest" -> False}];
y2[ytest_?NumericQ] :=
NDSolve[
{y''[r] + 2 y'[r]/r == ?2 Sinh[y[r]],
y[1] == ytest, y'[R] == 0}, y, {r, 1, R},
Method -> {"StiffnessSwitching", "NonstiffTest" -> False}];
y1Try[ytest_?NumericQ] := y'[1] /. y1[ytest];
y2Try[ytest_?NumericQ] := y'[1] /. y2[ytest];
f = ytest /. FindRoot[y1Try[ytest] - y2Try[ytest]==-Zg, {ytest, ytest0}]