Say I want to ask Mathematica whether $|x| = x$ for all $x > 0$.
Obviously, if I try TrueQ[Abs[x] == x]
, I get False
, because I haven't specified that I'm talking only about the case where $x > 0$. How would I go about doing that?
Posting this here as community wiki because we answers should not stay only as comments.
You have many options
Resolve
and ForAll
Resolve[ForAll[x, x > 0, Abs[x] == x]]
Refine
Assuming[x > 0, TrueQ[Refine[Abs[x] == x]]]
But assumptions can be placed inside Refine
, as in
Refine[Abs[x] == x, x > 0]
Simplify
Simplify[Abs[x] == x, x > 0]
Actually almost any other function that accept assumptions will do the job.
PiecewiseExpand[Abs[x], x > 0] == x
Resolve[ForAll[x, x > 0, Abs[x] == x]]
$\endgroup$Simplify[Abs[x] == x, x > 0]
orAssuming[x > 0, Abs[x] == x // Simplify]
$\endgroup$