I'd like to implement the Numerov scheme for solving an ODE (Scroedinger Eq time-independent) with NDSolve. I tried in analogy with the Runge Kutta example in the documentation:

Numerovv[]["Step"[rhs_, h_, t_, x_]] := Module[{},
  -x[t - h] (2 (12 + 5 h^2 rhs[t - h]) )/(-12 + h^2 rhs[t]) + 
   x[t - 2 h] (12 - h^2 rhs[t - 2 h]) /(-12 + h^2 rhs[t])
Numerovv[___]["StepInput"] = {"F"["T"], "H", "T", "X"};
Numerovv[___]["StepOutput"] = "X";
Numerovv[___]["StepMode"] := Fixed;
Numerovv[___]["DifferenceOrder"] := 4;

But when I select Method -> "Numerovv", I get

The value of the option Method -> Numerovv is not a known built-in method, a symbol that could be a user-defined method, or a list with a name followed by method options. >>

Do I miss something?

  • $\begingroup$ This is not the error I get when I use your code. I get an error about the step function not returning an acceptable form. This is the code I use, and the error message I get is ""The Step function for Method -> Numerovv returned {-1.\ \ {1.,0.}[-0.0472329]+2.\ {1.,0.}[-0.0236164],-1.\ \ {1.,0.}[-0.0472329]+1.99944\ {1.,0.}[-0.0236164]}, which is not an \ acceptable form."" $\endgroup$
    – Jason B.
    Mar 3, 2016 at 10:19
  • $\begingroup$ In your specification of "StepInput", you define the function to take one variable, which matches the step function, but you don't define "X" to be a variable with an argument. That is one issue, but fixing it doesn't solve the problem. The documentation on user-defined NDSolve methods is scarce. If someone can find more info than that linked in the question I'd be interested to read it. $\endgroup$
    – Jason B.
    Mar 3, 2016 at 10:23
  • 2
    $\begingroup$ The problem is that the built-in method framework is setup for $\mathbf y^\prime=\mathbf f(x,\mathbf y)$, while Numerov is a method specialized for second order conservative equations, $y^{\prime\prime}=f(x,y)$. An "adapter" would be needed, but I'm drawing a blank on how to write one. $\endgroup$ Mar 3, 2016 at 11:13
  • 1
  • 2
    $\begingroup$ As I said, the sticking point is not that the method is single- or multistep; it's that NDSolve[]'s framework assumes that methods plugged into it are for $\mathbf y^\prime=\mathbf f(x, \mathbf y)$. Numerov is not a method in that format, so adaptation is necessary. That you might need to figure out. $\endgroup$ Mar 14, 2016 at 5:39


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.