1

I have a Sturm-Liouville problem on a finite interval $0\leq z \leq 1$. I integrate the one-dimensional ordinary differential equation of the second order (the LoDestro equation) by the shooting method. First, I get the solution of the LoDestro equation with boundary conditions $\psi(0)=1$, $\psi'(0)=0$ on the left boundary $z=0$, using the built-in function ParametricNDValue with free parameters $\beta$ and $\Lambda$.

It returns the value of the derivative $\psi[\beta,\Lambda]'(1)$ on the right boundary as a function of the specified parameters. Next, I try to find $\Lambda $ as the root of the equation $\psi[\beta,\Lambda]'(1)=0$ for a given value of $\beta$ using the built-in function FindRoot and the private function RootSearch by Ted Ersek.

At $\beta=0.99999$ the RootSearch function actually hangs, and the FindRoot function finds the root if the WorkingPrecision->30 option is added:

FindRoot[eqn2[\[Beta]m, \[Lambda]] == 0
 , {\[Lambda], \[Lambda]start, \[Lambda]min, \[Lambda]max}
 , AccuracyGoal -> 4, PrecisionGoal -> 8
 , WorkingPrecision -> 30
 , EvaluationMonitor :> 
  Print[{"FindRoot: ", \[Beta]m, NumberForm[\[Lambda], {20, 18}], 
    eqn2[\[Beta]m, \[Lambda]], monitor++}]
 ]

But the RootSearch function does not have this option.

RootSearch[
 eqn2[\[Beta]m, \[Lambda]] == 
  0, {\[Lambda], \[Lambda]min, \[Lambda]max}
 , InitialSamples -> 10
 , RootTest -> (Abs[#2] < 0.001 &) 
 ]

I tried passing this option to the ParametricNDValue function,

pf2 = ParametricNDSolveValue[{ode2$[z, k, \[Beta], Rm, {q, Km}, 
     1 + \[Lambda]^4] == 0, \[Phi][0] == 1, \[Phi]'[0] == 
    0}, {\[Phi]'[zR$], \[Phi][zR$]}, {z, 0, (1 + 10^-7) zR$}
  , {{\[Beta], 0, 1}, {\[Lambda], 0, 10}}
  , Method -> {"EquationSimplification" -> "Residual"}
  (*,WorkingPrecision\[Rule]30*)
  ]

but got a diagnostic

ParametricNDSolveValue::initf : The initialization of the method NDSolve`StateSpace failed.

Is it possible to teach RootSearch to work with increased accuracy?

Igor Kotelnikov
  • 749
  • 3
  • 12
  • 3
    Would something on the lines of Block[{$MaxExtraPrecision=200,$MinPrecision = 50,$MaxPrecision=Infinity }, (*your code*)] help? – rhermans Jul 01 '22 at 09:21
  • 4
    Isn't this a question for the author of RootSearch? – Daniel Lichtblau Jul 01 '22 at 18:25
  • @rhermans: Thank you for your advice. But for now, I found another solution. First, I made the replacement $\Lambda=1+\lambda^4$, then I interpolate the equation, then RootSearch and FindRoot instantly find its solution. – Igor Kotelnikov Jul 03 '22 at 03:02

0 Answers0