Group Abstract Group Abstract

Message Boards Message Boards

Why I get obscure error messages in NDSolve?

Posted 1 year ago
POSTED BY: Leslaw Bieniasz
2 Replies

This is also why Compile supports RuntimeOptions->{"EvaluateSymbolically"->False}. That way compiled numerical functions don't run when presented with symbolic arguments, avoiding errors.

It's because FindRoot evaluates psiwmax[g0] first with symbolic g0 and analyzes the result. This causes the error message. Then FindRoot evaluates psiwmax[g0] with numeric values substituted for g0, and everything works fine after that.

The standard way to prevent the error message is to define numerical functions using NumericQ to prevent evaluation on nonnumeric arguments. Wolfram has a Knowledgebase article on this.

Example coding paradigm:

ClearAll[psiwmax];
psiwmax[g0_?NumericQ] := ....
POSTED BY: Michael Rogers
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard