In a code base that is difficult to change for unrelated issues, I have many invocations of NDSolve that look like the following:

NDSolve[equations, variables, {t, 0, 100}, 
 Method -> {"ExplicitRungeKutta", "StiffnessTest" -> False}]

This has stopped working with Mathematica 9.0, because something is timing out (our problem appears similar to the one described here). The fix is to change the invocation to look like this:

NDSolve[eqns, vars, {t, 0, 100},
  Method -> 
    "StiffnessTest" -> False, 

I would like to be able to change the part of the Method option involving "EquationsSimplification" to "Solve" globally, in such a way that it won't be clobbered when a call leaves that option alone, but sets other options (like using the "ExplicitRungeKutta" method, or turning off "StiffnessTest"). This will allow me to fix things in an init.m file once and for all.

(Yes, I'm aware this is ugly and hacky, but the other approaches are probably less appealing.)

  • $\begingroup$ FWIW, this (unlike e.g. "StiffnessTest") is not an option for any function in the NDSolve` context. So, it looks like you have to insert it at the top level. $\endgroup$ Jul 8, 2013 at 18:11

1 Answer 1


So far, it's looking like we'll have to fall back on the common yet awful, fragile and hard-to-maintain solution of putting the following in our init.m files:

   (Method -> meth_), after___] :=
    (Method ->
       {meth, "EquationSimplification" -> "Solve"},
       Append[meth, "EquationSimplification" -> "Solve"]
    after] /;
   ! FreeQ[meth, "ExplicitRungeKutta"] && 
    FreeQ[meth, "EquationSimplification" -> _];

I'd really like to be able to solve this problem in almost any other way. At the risk of editorializing a little, I'm pretty displeased that the switch to Mathematica 9 has put us in the position of having to consider doing things like this, by breaking perfectly good, working code.

EDIT to improve the function a little based on @Teake Nutma's suggestion, so it's a little more robust.

  • $\begingroup$ I think this is the best way to go. You might improve robustness by throwing eqns_,ivars_,dvar_,before_ into a single before___, and throw in an If[$VersionNumber >= 9., ...] statement, but otherwise I don't see much room for improvement. $\endgroup$ Jul 8, 2013 at 14:28

Your Answer

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

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