I have a conditional expression
f[x_] := x /; x ∈ Reals
This works fine for normal numbers and symbols, e.g. {f[1], f[Sin[4]], f[I], f[a]}
evaluates to {1, Sin[4], f[I], f[a]}
as expected.
However, if I have an unknown number $b$ which I know to be real, I cannot get Mathematica to give $f(b)=b$. I have tried
Simplify[f[b], Assumptions -> {b ∈ Reals}]
but this evaluates to f[b]
.
;
is a programming construct: it just influences evaluation. It is not meant o be used this way andSimplify
won't (and shouldn't) operate on it. I tried to write an answer but then I realized that the real question is: what do you want to do here? You can take a look atConditionalExpression
which is meant for representing a mathematical concept, but whether it is of use to you depends on what you are trying to do. $\endgroup${f[1], f[Sin[4]], f[I], f[a]}
evaluates to{1, Sin[4], f[I], f[a]}
? $\endgroup$f[x_] /; Simplify[x \[Element] Reals] := "success!"
and thenAssuming[x \[Element] Reals, Simplify[f[x]]]
which should yield"success!"
. Does this work for you? $\endgroup$