Here is a more complete VB_POLY class:
class VB_POLY(Function):
nargs = (1, 4)
@classmethod
def eval(cls, X_val, a_val, b_val, c_val):
X,a,b,c = symbols('X a b c')
poly_func = a + b * X + c * X^2
poly_func.subs({X: symFloat(X_val), a: symFloat(a_val), b: symFloat(
b_val), c: symFloat(c_val)})
print "%f %f %f %f" % (X_val, a_val, b_val, c_val)
return poly_func.evalf()
I've also tried using sympify on the expression with evalf():
sym_expr = sympify(self.formula)
observation_variables = sym_expr.free_symbols
mlr_symbols = {}
for obs_var in observation_variables:
if obs_var.name in data:
mlr_symbols[obs_var] = symFloat(data[obs_var.name])
if data[obs_var.name] == wq_defines.NO_DATA:
solved_eq = sym_expr.evalf(subs=mlr_symbols)
After evalf() is called, the solved_eq has not substituted the values for
the Symbols and the VB_POLY class eval functio
--
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/ec50d3d5-8716-4f41-a528-db81a0e9689d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.