Given a function from R into R^n, I'd like to define a new function by precomposition, for example as follows
alpha(x) = [e^x,e^(-x)]
beta(x) = alpha(-x+2)
However attempting to do so in this way throws an error "unable to convert (e^(-x + 2), e^(x - 2)) to a symbolic expression"
Now the similar but simpler version of the code
alpha(x) = e^x
beta(x) = alpha(-x+2)
works perfectly, so the issue arrises from the fact that alpha is multivalued.
The following variant of the original code does exactly what I want
alpha(x) = [e^x,e^(-x)]
beta(x) = [alpha[0](-x+2),alpha[1](-x+2)]
but requires me to assume the length of alpha, which is undesirable. And the obvious solution to that problem
alpha(x) = [e^x,e^(-x)]
for i in range(0,len(alpha)):
beta[i](x) = alpha[i](x)
or any variant thereupon throws the error "can't assign to function call"
My question is as follows:
Is there any way to do this precomposition? In particular without assuming the length of alpha. I control how the functions alpha and beta are defined, so if theres another way of defining them (for example using lambda notation or something like that) that lets me do this, that's acceptable too. But note that I would like to do some equivalent of the following at some point in my code
... + beta.derivative(x).dot_product( ...