Closed ketch closed 2 years ago
You should use SymFunction
: import SymPy; SymPy.SymFunction("q")
.
Function
is one of Julia's datatypes.
To elaborate, you need "
not '
for quoting in Julia. If you call sympy.Function("q")
you will get a pyobject, as the implicit conversion does not work. Calling SymFunction
, as @mzaffalon describes does this conversion. For convenience, you also have @syms q()
for surface syntax.
Thank you!
The following code raises an error:
I get
This code runs fine in Sympy in Python.
I'm aware that I can first create
f
as a Sympy symbol and then assign it to a function, but this does not accomplish what I need (see e.g. https://stackoverflow.com/questions/51547474/replacing-composed-functions-in-sympy).