I have two functions $f,g:\mathbb{R}^2 \to \mathbb{R}^2$ and I define a third one $h:\mathbb{R}^2 \to \mathbb{R}^2$ as the composition $$h(x,y) = g(f(x,y))$$
I'm trying to get this function into Mathematica
as a composition because I still want the functions $f,g$ and I don't want to have to manually update $h$ when I change $f$ or $g$.
So here is what I'm currently doing :
1. Define f[x_, y_] := {E^x + y, Sin[2 x]}
2. Define g[x_, y_] := {2 x + Cos[y], E^(x + y)}
3. Try the obvious definition of h[x_, y_] := g[f[x, y]].
This doesn't seem to work. I'll just get things like h[0, 0]
returning g[{1, 0}]
. I could write $h$ using the projection of $f$ onto the standard basis for $\mathbb{R}^2$ with the Projection function but this seems needlessly cumbersome and adds conjugate statements everywhere. Can anybody point out a better direction for defining $h$ as a composition?
Also I have tried the Mathematica
function Composition
and it behaved the same way.