I'm just starting to work with Mathematica and this is simplified version of the problem I have: seems that
Sqrt[x]^2 simplifies to just
x without any restrictions on domain:
In:= FunctionDomain[Sqrt[x]^2, x] Out:= True
I can't restrict
x>=0 globally because negative
x is necessary in other parts of my calculation.
Is there a (preferably automatic) way to propagate domain during function composition?
So far I tried
Sqrt, entering square root using Ctrl+2, and explicitly creating composition like this:
In:= f[x_] := Sqrt[x] g[a_] := a^2 z[p_] := Composition[g, f] FunctionDomain[z[x], x] Out:= True