Symbolic Computation with SymPy in Python and SageMath

preview_player
Показать описание
SymPy is a pure Python package for symbolic computation, which is also incorporated in SageMath. In this lecture we illustrate some of the features of SymPy in a Jupyter notebook with a SageMath kernel.
Рекомендации по теме
Комментарии
Автор

After this:

reset()
from sympy import Function, rsolve
from sympy.abc import n
f = Function('f')

I obtain this error:

Error in lines 4-4
Traceback (most recent call last):
File "/ext/sage/9.8/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/sympy/core/function.py", line 525, in class_key
i = funcs[name]

KeyError: 'f'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/cocalc/lib/python3.10/site-packages/smc_sagews/sage_server.py", line 1244, in execute
exec(
File "", line 1, in <module>
File "/ext/sage/9.8/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/sympy/core/cache.py", line 70, in wrapper
retval = cfunc(*args, **kwargs)

File "/ext/sage/9.8/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/sympy/core/function.py", line 449, in __new__
return UndefinedFunction(*args, **options)

File "/ext/sage/9.8/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/sympy/core/function.py", line 197, in __init__
super().__init__(*args, **kwargs)
File "/ext/sage/9.8/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/sympy/core/assumptions.py", line 597, in __init__
BasicMeta.__init__(cls, *args, **kws)
File "/ext/sage/9.8/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/sympy/core/core.py", line 70, in __init__
all_classes.add(cls)
File "/ext/sage/9.8/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/sympy/core/function.py", line 919, in __hash__
return hash((self.class_key(),

File "/ext/sage/9.8/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/sympy/core/function.py", line 527, in class_key
i = 0 if isinstance(cls.nargs, Naturals0) else 10000

File "/ext/sage/9.8/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/sympy/core/function.py", line 263, in nargs
return FiniteSet(*self._nargs) if self._nargs else S.Naturals0

AttributeError: 'NewSymbolicFunction' object has no attribute 'Naturals0'

I am using the Sage Notebook in Cocalc. Thank you!

hellencolman