I have a function defined as


where $f(0)\neq const$.

How do I evaluate $a(x)$ such that I just get $f(x)$ without having to put in a specific x value greater than 0? I've tried things like $/;$, Assumptions and Assuming, but haven't been able to do it. This seems like it should be a simple thing, any ideas?

  • 1
    $\begingroup$ This answer sheds some light on why this might not be as simply as it first seems. $\endgroup$ Jun 8, 2017 at 16:00

1 Answer 1


You can use TrueQ:

a[x_] := If[TrueQ[x == 0], const, f[x]]

Or the fourth parameter of If:

a[x_] := If[x == 0, const, f[x], f[x]]

Or formulate your function in two definitions:

a[x_] /; x == 0 = const;
a[x_] := f[x]

Recommended reading:

  • $\begingroup$ Or If[x === 0, ...] which is what I usually do. $\endgroup$
    – Carl Woll
    Jun 8, 2017 at 16:13
  • 1
    $\begingroup$ @CarlWoll ...and what I expressly warn about in the final link in my answer ;^) $\endgroup$
    – Mr.Wizard
    Jun 8, 2017 at 16:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.