Consider the built-in function FunctionDomain to find a domain of a composite function f(f(x)) where f(x)=1/x.
f[x_]:=1/x
FunctionDomain[Composition[f, f][x], x]
FunctionDomain[1/(1/x), x]
The output is True in both cases.
Apparently Mathematica simplifies the argument before applying the FunctionDomain. That's why it gives mathematically incorrect output (x=0 should be excluded). Composition[f,f][x]=f(f(x)) = 1/(1/x)= x. And the domain of x is all real numbers.
In case when Hold function is applied to 1/(1/x) the output is x < 0 || x > 0 as it should be.
FunctionDomain[Hold[1/(1/x)], x]
Output: x < 0 || x > 0
But when Hold is applied to Composition[f, f][x] The result is completely different. FunctionDomain[Hold[Composition[f, f][x]], x] returns the input as output.
Why doesn't it work? What am I missing?
FunctionDomainbut functions likeReduceandReplaceAllreturn mathematically incorrect results.f[x_] := 1/x; {Reduce[1/(1/x) == 0, x, Reals],Reduce[f[f[x]] == 0, x, Reals],Solve[1/(1/x) == 0, x, Reals],Solve[1/(1/x) == 0, x, Reals],FunctionDomain[1/(1/x), x],FunctionDomain[f[f[x]], x],1/(1/x) /. x -> 0,f[f[x]] /. x -> 0}How can I prevent (partial) evaluation of the first argument? – user45937 Jan 18 '17 at 14:25