Bug introduced in 12.0 or earlier, persisting through 12.2.

Consider the following call to NDSolveValue for a system of ODEs with 2 dependent variables, where we may choose the first dependent variable, symbol, to be any symbol except y or t:

solver[symbol : Except[y | t, _Symbol]] :=
    {symbol'[t] == 1, y'[t] == 1, symbol[0] == 0, y[0] == 0}
    , {symbol, y}
    , {t, 0, 1}

(* 12.0.0 for Linux x86 (64-bit) (April 7, 2019) *)

If we choose ordinary Latin symbols, ordinary Greek symbols, or Formal Latin symbols, this works fine:

(* OK *)

But if we choose any Formal Greek symbol, we get errors:


Transpose::nmtx: The first two levels of {\[FormalAlpha], NDSolve`xs$2814} cannot be transposed.
Part::partw: Part 2 of Transpose[{\[FormalAlpha], NDSolve`xs$2814}] does not exist.

What is it about Greek Formal symbols which causes things to break?

Interestingly, multi-character symbols containing Formal Greek are OK:

(* OK *)

Also note that the error does not occur if there is only 1 dependent variable in NDSolveValue.

  • 1
    $\begingroup$ Interesting. v12.2 spits out ndode warning. Looks like a bug. Have you reported it to WRI? $\endgroup$ – xzczd Dec 18 '20 at 11:56
  • $\begingroup$ @xzczd Reporting now, wanted to see if others could reproduce $\endgroup$ – yawnoc Dec 18 '20 at 12:37
  • $\begingroup$ Reported, assigned ID [CASE:4742880] $\endgroup$ – yawnoc Dec 18 '20 at 12:49

v12.2 spits out ndode warning. This seems to be a bug related to the undocumented function Internal`ProcessEquations`FindDependentVariables (I know it from this post BTW):

 Internal`ProcessEquations`FindDependentVariables[{symbol'[t] == 1, y'[t] == 1, 
   symbol[0] == 0, y[0] == 0}, t], {symbol, {\[FormalAlpha], a\[FormalAlpha]}}]
(* {{y}, {a\[FormalAlpha], y}} *)

As we can see, it fails to find the single \[FormalAlpha]. But this function doesn't show up in Trace[NDSolveValue[………], TraceInternal->True], and I've no idea why NDSolve succeeds in handling the 1 dependent variable case.

Luckily, the problem is easy to circumvent. Just set the DependentVariables option:

With[{symbol = \[FormalAlpha]}, 
 NDSolveValue[{symbol'[t] == 1, y'[t] == 1, symbol[0] == 0, y[0] == 0}, {symbol, y}, 
   {t, 0, 1}, DependentVariables -> {symbol, y}]]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.