I'm trying to use the simplify methods from Mathics in my Python program. The problem is, even I read the documentation of Mathics (https://mathics-development-guide.readthedocs.io/en/latest/extending/developing-code/calling-mathics-library-from-within-python-code.html) , I can't figure out how to use the "Simplify" method. I also tried to use the exemple one their documentation :
# This is the same as before
from mathics.session import MathicsSession
session = MathicsSession(catch_interrupt=True)
# These are Mathics classes we are going to use.
from mathics.core.expression import Expression, Integer
# Compute 20!
x = Expression("Factorial", Integer(10)
).evaluate(session.evaluation).to_python()
print(x) # 2432902008176640000
But it raised an error :
Traceback (most recent call last):
File "c:\Users\ASUS TUF\Documents\ESEO\Stage
Technique\Dev\geneticSolver\mathics_test.py", line 10, in <module>
).evaluate(session.evaluation).to_python()
File "C:\Users\ASUS TUF\AppData\Local\Programs\Python\Python310\lib\site-
packages\mathics\core\expression.py", line 441, in evaluate
names.add(expr.get_lookup_name())
File "C:\Users\ASUS TUF\AppData\Local\Programs\Python\Python310\lib\site-
packages\mathics\core\expression.py", line 636, in get_lookup_name
lookup_symbol = lookup_symbol._head
AttributeError: 'str' object has no attribute '_head'
Does anyone has already worked with Mathics on Python and can explain me how to deal with it ?