Skip to content
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

More on sympy #890

Draft
wants to merge 4 commits into
base: split_to_sympy
Choose a base branch
from
Draft

More on sympy #890

wants to merge 4 commits into from

Conversation

mmatera
Copy link
Contributor

@mmatera mmatera commented Jul 24, 2023

@rocky, this PR completes #888 by rewriting from_sympy in the form of a dispatch table instead of a very long if/elif routine. Also, I tried to implement a way to avoid the conversions back-and-forth.
Finally, I included some code to implement eval_Plus and eval_Times fully based on Sympy.

@@ -49,6 +49,8 @@
RealOne = Real(1.0)


use_sympy_for_arithmetic = False
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting this variable to True we use a eval_Times and eval_Plus implementation based on sympy. Notice that it fails to pass several tests.

from mathics.session import MathicsSession

import_and_load_builtins()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to add this line on each test that I want to run individually. Maybe it should be added in mathics.session.

@@ -402,18 +401,6 @@ def __new__(cls, name: str, sympy_dummy=None):
# For example, this can happen with String constants.

self.hash = hash((cls, name))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dummy symbols are something related to sympy and not with the basic Mathics data structures. It is not needed anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant