I've reworked the VB_POLY class to use the Poly function:
class VB_POLY(Function):
nargs = (1, 4)
@classmethod
def eval(cls, obs_symbol, a_val, b_val, c_val):
a,b,c = symbols('a b c')
poly_func = poly(a + b * obs_symbol + c * obs_symbol**2)
return poly_func.evalf(subs={a: symFloat(a_val), b: symFloat(b_val), c:
symFloat(c_val)})
I've modify the sympify call as:
sym_expr = sympify(self.formula, {'VB_POLY': VB_POLY})
That seems to call the eval function in the VB_POLY class, however at that
point, I don't have the value for obs_symbol it is defined later.
observation_variables = sym_expr.free_symbols
mlr_symbols = {}
for obs_var in observation_variables:
self.data_used[obs_var.name] = None
if obs_var.name in data:
self.data_used[obs_var.name] = data[obs_var.name]
mlr_symbols[obs_var] = symFloat(data[obs_var.name])
if data[obs_var.name] == wq_defines.NO_DATA:
valid_data = False
else:
valid_data = False
solved_eq = sym_expr.evalf(subs=mlr_symbols)
After evalf() is executed, the equation has not been numerically solved, it
is still the symbolic definition. Is what I am attempting even possible?
--
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/3509d039-0ed7-46fa-b7d8-4da1705d3d84%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.