- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 574
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adapt Mathics interface to SymPy upgrade from 1.8 to 1.10 (resp.1.9) #33584
Comments
This comment has been minimized.
This comment has been minimized.
comment:2
No additional tests needed, since they are already there! |
Commit: |
Author: Sebastian Oehms |
Reviewer: Matthias Koeppe |
comment:3
LGTM |
comment:4
Thanks! |
comment:5
I use this patch --- a/sage/interfaces/sympy.py
+++ b/sage/interfaces/sympy.py
@@ -259,6 +259,12 @@
return SR.var(str(self))
+def _sympysage_mathics_expression(self):
+ from sage.interfaces.mathics import reduce_load
+ return [reduce_load(x)._sage_()
+ for x in self.expr.to_python()]
+
+
def _sympysage_Subs(self):
"""
EXAMPLES::
@@ -302,7 +308,7 @@
else:
# the function defined in sympy is not known in sage
- raise AttributeError
+ raise AttributeError(fname)
return func
# the convoluted class structure with metaclasses and stuff sympy uses
@@ -941,6 +947,8 @@
from sympy.polys.rootoftools import CRootOf
from sympy.series.order import Order
from sympy.matrices import ImmutableMatrix, ImmutableSparseMatrix, Matrix, SparseMatrix
+ from mathics.core.convert import SympyExpression
+ SympyExpression._sage_ = _sympysage_mathics_expression
Float._sage_ = _sympysage_float
Integer._sage_ = _sympysage_integer but I am not saying that it's correct so I couldn't show it to anybody |
comment:6
Replying to @sheerluck:
I agree that this fixes the issue, as well. Probably you know better about Mathics than I do, but it seems to be more restrictive, since it converts each instance of SympyExpression to a list. Furthermore, the import statement may fail, since Mathics is an optional package. Thus, it has to be checked that the feature is present. Anyway, you are welcome to contribute to the code. But I would prefer to do that on a separate ticket, to have the issue fixed, as soon as possible. |
comment:7
I agree that my patch is a dirty hack :) I agree that proper work with SympyExpression should be on on a separate ticket. I agree that this ticket should be merged ASAP. |
Changed branch from u/soehms/mathics_sympy_upgr_33584 to |
Since this upgrade of SymPy (especially by this commit) the Mathics interface is broken:
Here we implement a fix of that.
Component: interfaces
Keywords: Mathics inteface SymPy
Author: Sebastian Oehms
Branch/Commit:
4302109
Reviewer: Matthias Koeppe
Issue created by migration from https://trac.sagemath.org/ticket/33584
The text was updated successfully, but these errors were encountered: