Hello, after my failures to force NDSolve to solve any of my PDEs, I decided to try out a supposedly simpler solution of two-point BVPs in 2nd order ODEs by NDSolve. Here again NDSolve fails to solve my BVP directly, but I devised my own shooting procedure that uses NDSolve only to obtain a solution of an initial value problem for a second order ODE. A single call to NDSolve produces quickly and accurately a desired result (without error messages), but if I combine NDSolve with FindRoot to automate the iterations of the shooting algorithm, I get obscure error messages (although the computed numerical result seems correct). Can anybody tell me how to get rid of these messages and why they occur? My code is as follows:
SS0[wm_,g0_,wp_]:=NDSolve[{psi''[v]+2*v*psi'[v]==0,psi[0]==0,psi'[0]==g0},psi,{v,0,wm},WorkingPrecision->wp ];
(* Expected gradient g0 of psi[w] at w=0: *)
N[2/Sqrt[π],20]
1.1283791670955125739
(* Hence, assumed interval of g0 for the Brent method: 1.0 < g0 < 1.2 *)
g0min=1;
g0max=12/10;
(* Assumed maximum w value: *)
wmax = 10;
(* Requested working precision *)
wprec = 40;
(* Numerical solution for psi[w] at w=wmax by the shooting method *)
psiwmax[g_]:=Module[{},sol=g,wprec];Evaluate[psi[wmax]/.sol]];
(* Determination of the gradient at w=0 that makes psiwmax = 1 *)
g0acc=FindRoot[psiwmax[g0]==1,{g0,g0min,g0max},Method->"Brent",WorkingPrecision->wprec]
This produces error messages, plus a correct result for g0:
NDSolve::ndinnt: Initial condition g0 is not a number or a rectangular array of numbers.
ReplaceAll::reps: {NDSolve[{2 v (psi^′)[v]+(psi^′′)[v]==0,psi[0]==0,(psi^′)[0]==g0},psi,{v,0,10},WorkingPrecision->40]} is neither a list of replacement rules nor a valid dispatch table, and so cannot be used for replacing.
NDSolve::ndinnt: Initial condition g0 is not a number or a rectangular array of numbers.
{g0->1.128379167095512573947307418293139931938}