You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current implementation of numerical_approx has
x = x = x._convert(kwds)
if is_a_numeric(x._gobj):
res = py_object_from_numeric(x._gobj)
elif is_a_constant(x._gobj):
res = x.pyobject()
else:
raise TypeError("cannot evaluate symbolic expression numerically")
If x is a n number with units (example in ticket) then it would go to the else block, So can you suggest a check for expression which are numbers attached with units?
As suggested in the description of this ticket, and specifically stated in the sage-support discussion that is mentioned there, the _convert() method can deal with the example in this ticket:
sage: cm = units.length.centimeter;
sage: x = 1e-6*cm;
sage: x._convert({'parent':RealField(10)})
(1.0e-6)*centimeter
So this problem will be solved if #12577 is merged. And the case here (or something similar) could be added to the docstring as an example.
However, I don't think that would be a complete solution to the issue that is raised here, because attempting to evaluate sin(x)*cm numerically (when x is a variable) should give a TypeError: cannot evaluate symbolic expression numerically, but we have:
From https://groups.google.com/forum/#!topic/sage-support/3eCHzmJ1MXY:
Simply call
_convert()
with the parent keyword.Component: symbolics
Issue created by migration from https://trac.sagemath.org/ticket/24850
The text was updated successfully, but these errors were encountered: