I am writing a package of routines to do both algebra and numeric calculations using the generalized hypergeometric function.
If all incoming parameters are numeric, or can be evaluated to numeric, then for some ranges of the parameters, I can return a numeric result.
However, if a parameter is a symbolic, and cannot be evaluated to a numeric result (like an undefined global name, etc.) then I can't return a numeric result, (but I may be able to return a simplified symbolic result).
Here comes the question: What's the best way to validate/evaluate/check/test incoming parameters for "numerosity"? That is, what's the best way to test a parameter to see if it can be resolved to a numeric value?
Is there any kind of built in UserRPL function (or even a SYSEVAL) that does this kind of thing?
Right now I have a long CASE statement that checks various TYPE values, and returns true/false. That works ok, but it's not very fast.
Complications come in because an algebraic expression may be evaluable down to a numeric result, and I would like to handle that case correctly too.
Global names may have a numeric value; need to handle that too. Perhaps a global name refers to another global name, that refers to another global name, that refers to a numeric or an evaluable algebraic; that should count as a numeric parameter too.
Would it be better just to attempt to do an EVAL and/or a ->NUM against a parameter (guarded with IFERR) and see if that results in a numeric? Would that be definitive?
Thanks for any suggestions!