Why `unable to convert (sin(h(x)), cos(h(x))) to a symbolic expression`?
f(x) = (sin(x), cos(x))
h = function('h', nargs=1)
f(h(x))
works fine and produces (sin(h(x)), cos(h(x))). However, if I try to assign that to a function:
g(x) = f(h(x))
TypeError: unable to convert (sin(h(x)), cos(h(x))) to a symbolic expression
How can I compose functions like this?
symbolic_expression(f(h(x))) fails, but symbolic_expression( (sin(h(x)), cos(h(x))) ) succeeds.
SageMath version 9.1, Release Date: 2020-05-20
Using Python 3.7.3.
Hello! By carefully checking the code for
symbolic_expression()
, I can see that the problem actually happens when that command sends its output toSR
. Here is a simpler example:If $f$ is a $\mathbb{R}\rightarrow\mathbb{R}$, instead of $\mathbb{R}\rightarrow\mathbb{R}^2$, there is no error message.
I hope this helps to pinpoint the location of the problem!
A similar example, but using vector: