Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to check if a symbolic expression is numerically evaluable?

Context: I want to evaluate a symbolic expression numerically; however sometimes this expression still depends on some symbolic parameters not yet assigned a value.

Question: What is the best way to avoid "TypeError: cannot evaluate symbolic expression numerically" in such a situation?

In other words, is there a function (or an equivalent construction) for

 if isThisSymbolicExpressionNumericallyEvaluabel(exp):
     n = exp.n()
 else: 
     print "sorry, no"