2
$\begingroup$

I try (in Mathematica 10)

FullSimplify[l >= l1 + l2, {l <= l1 + l2, Element[l | l1 | l2, Integers]}]

But that gives back

l >= l1 + l2

Whereas I expected

l == l1 + l2

However, (as stated in the comments)

FullSimplify[l >= l1 + l2 && l <= l1 + l2]

yields

l == l1 + l2

Superficially these two variants (inequality as assumption, or as equation) look equivalent. What is the technical difference between the two?

To counter the claim that my question is easily answered with the documentation or that it is a simple mistake, the documentation for FullSimplify reads

Assumptions can consist of equations, inequalities, domain specifications such as x[Element]Integers, and logical combinations of these.

which led me to believe my initial attempt should be equivalent to the solution given in the comments.

$\endgroup$
7
  • 1
    $\begingroup$ FullSimplify[l >= l1 + l2 && l <= l1 + l2] $\endgroup$
    – ciao
    Commented Jun 23, 2016 at 9:16
  • 2
    $\begingroup$ Not even full...Simplify[l>=l1+l2&&l<=l1+l2] $\endgroup$
    – Ymareth
    Commented Jun 23, 2016 at 9:18
  • 1
    $\begingroup$ Or Reduce[{l >= l1 + l2, l <= l1 + l2}, l]... $\endgroup$
    – ciao
    Commented Jun 23, 2016 at 9:23
  • 1
    $\begingroup$ The technical difference is that l == l1 + l2 is simpler than l >= l1 + l2 && l <= l1 + l2 but not simpler than l >= l1 + l2 (as measured by Simplify`SimplifyCount[expr]). Note: a SimplifyCount function is given in the docs for ComplexityFunction. See also (26172). $\endgroup$
    – Michael E2
    Commented Jun 27, 2016 at 14:25
  • 1
    $\begingroup$ Another reason is that there does not seem to be a transformation in the default TransformationFunctions that will transform l >= l1 + l2. under the assumption l <= l1 + l2. (AFAIR, I couldn't find one a couple of days ago. I should have though ciao's first comment would be tried internally. Maybe it is, but a custom ComplexityFunction that prefers == to >= didn't work.) $\endgroup$
    – Michael E2
    Commented Jun 27, 2016 at 14:39

1 Answer 1

2
$\begingroup$

Try this:

Reduce[l >= l1 + l2 && l <= l1 + l2 && 
  Element[l | l1 | l2, Integers], l]

(*  (C[1] | C[2]) ∈ Integers && l1 == C[1] && l2 == C[2] && 
 l == C[1] + C[2]   *)
$\endgroup$

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.