3
$\begingroup$

I have a set of assumptions, say, $x > 0$ and $y > 0$. So I specified the $Assumptions = x > 0 && y > 0 Now the inequality $x - y/2 > 0$ does not provide a truth value.

The function Simplify[x-y/2>0] produces output 2x>y, while the function Simplify[x+y/2>0] produces output True.

I actually want a truth value for expressions. But when a truth value doesn't exist, i.e., it may be either true or false, I want to know that the said inequality can take either.

Then I can just proceed with assuming $x-y/2>0$ and $x-y/2\leq 0$ as two cases.

Is there a way to figure out that the inequality is undetermined in Mathematica?

$\endgroup$
3
  • 1
    $\begingroup$ Think of the FindInstance command. $\endgroup$ – user64494 Sep 7 '18 at 7:36
  • $\begingroup$ It's just telling you in the first instance that x-y/2 is true when 2x>y. It will be False otherwise. Since MMA doesn't know whether 2x>y, it can't give you a straight True or False answer. The second case is obviously True and MMA tells you that. $\endgroup$ – Bill Watts Sep 7 '18 at 7:49
  • $\begingroup$ Do you mean to ask if such values for x and y exist that make x - y/2 > 0 when x > 0 and y > 0? Simplify is not the way to go here, but using Exists and Reduce is a very obvious solution when you actually get to know its existence. Reduce[Exists[{x, y}, x > 0 && y > 0, x + y/2 > 0], Reals] returns True, which indicates that such values of x and y exist. What your Simplify query for x + y/2 > 0 with these assumptions tells is that all values under these conditions fulfil the requirement. (You can also check ForAll usage with Reduce). $\endgroup$ – kirma Sep 7 '18 at 9:56
3
$\begingroup$

I split the result to four alternatives: value is true for all variable values under assumptions, it's false for all such values, it is neither true nor false for all values (Both), or it is not a Boolean value (Unresolved):

ClearAll@eqnTrueFalseBothUnresolved;
eqnTrueFalseBothUnresolved[var_, eqn_, assum_, dom_:Reals] :=
 If[Reduce[ForAll[var, assum, eqn], dom], True,
  If[Reduce[ForAll[var, assum, !eqn], dom], False, Both, Unresolved],
  Unresolved];

Both outcomes are possible:

eqnTrueFalseBothUnresolved[{x, y}, x - y/2 > 0, x > 0 && y > 0]

Both

Always true:

eqnTrueFalseBothUnresolved[{x, y}, x + y/2 > 0, x > 0 && y > 0]

True

When we don't know the value of a we can't be certain of the outcome (if a is positive, it'd be Both, otherwise True):

eqnTrueFalseBothUnresolved[{x, y}, x + y/2 > a, x > 0 && y > 0]

Unresolved

$\endgroup$
1
  • $\begingroup$ Thanks for the solution. I think I was missing the command ForAll. Since it checks for all instances in the domain, it can indicate whether there exists a solution to the inequality. $\endgroup$ – drdebmath Sep 7 '18 at 12:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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