Ok, with help from this thread:
https://groups.google.com/forum/#!searchin/sympy/sympify$20function/sympy/dKiX0QHIFB4/pVFvdoDVlJwJ,
I was able to answer my own question.
class VB_POLY(Function):
nargs = (1, 4)
def _eval_evalf(self, nprec):
obs_symbol,a,b,c = symbols('obs_symbol a b c')
poly_func = poly(a + b * obs_symbol + c * obs_symbol**2)
result = poly_func.evalf(subs={obs_symbol: symFloat(self.args[0]), a:
symFloat(self.args[1]), b: symFloat(self.args[2]), c: symFloat(self.args[3
])})
return result
The key is implementing the _eval_evalf function. I tried to set the
evaluate flag to False to prevent my previous version that used eval to not
evaluate immediately, but had no success.
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit
https://groups.google.com/d/msgid/sympy/89f64909-6876-4ee1-8684-59f991346489%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.