5
$\begingroup$

The Simplify command is having trouble verifying a compound inequality, even while it correctly handles the two corresponding single inequalities.

I'm starting with some simple global assumptions:

$Assumptions = Element[k, Integers] && i == k + 1;

Under these assumptions, the following uses of Simplify all return True, as expected:

In[2]:= Simplify[i == k + 1]
Out[2]= True

In[3]:= Simplify[k < k + 1 < k + 2]
Out[3]= True

In[4]:= Simplify[k < i && i < k + 2]
Out[4]= True

However, combining the two inequalities from the last input above into one compound inequality does not yield the expected output:

In[5]:= Simplify[k < i < k + 2]
Out[5]= k < i < 2 + k
(*NOT True as expected*)

Why does Simplifynot recognize that this compound inequality is true?

(Note: I realize it seems silly to check if k<i<k+2 since I'm already assuming i=k+1. However, I was having problems while dealing with more complex code, and this behavior of Simplify seemed to be at the root of it.)

$\endgroup$
10
$\begingroup$

Something I've noted about Mathematica, is it is best to be complete in defining variable domains. Also define i as an integer, which you might think it implicitly is from your definition i == k + 1:

$Assumptions = {i, k} ∈ Integers && i == k + 1;

Then try your code

Simplify[k < i < k + 2]
(* True *)

Curious to see if that fixes your bigger problem.

$\endgroup$
1
  • 1
    $\begingroup$ Thanks! That does fix the issue I was having! $\endgroup$ – Tim Wagner Dec 30 '19 at 4:04

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.