Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to simplify a set of solutions of a system, say for example:

A := (a[1] == 3 && a[2] <= 1 && b[1] <= 5) || (a[1] == 3 && a[2] == 1 && b[1] == -7)

I care only about a[1] and a[2] but I can not use Eliminate since I have inequalities. So one solution is:

Simplify[Reduce[Exists[{b[1]}, A]]]

a[1] == 3 && a[2] <= 1

It works! But since I have a large system (many b's) I need to automate this. Since:

Array[b, 1]


I tried:


a[1] == 3 && a[2] <= 1 && b[1] <= 5

The second method yields the wrong outcome! What am I doing wrong here?

share|improve this question
I just noticed you deleted your other question... did you get an answer? I was midway through writing one... – R. M. Mar 28 '13 at 23:59
sorry for wasting your time! after digging more I found this… which solves my other problem. thanks. – Sergio Parreiras Mar 29 '13 at 1:24
Ok, no problem. In any case, what you had was mostly fine; you just needed to use HoldPattern. For example, HoldPattern[a@# == _] -> True & /@ Range@5 will generate replacement rules for a[1] through a[5] – R. M. Mar 29 '13 at 1:38
up vote 4 down vote accepted

Exists has attribute HoldAll:

(* {HoldAll, Protected, ReadProtected} *)

You need to do

Simplify@Reduce@Exists[Evaluate@Array[b, 1], A]
(* a[1] == 3 && a[2] <= 1 *)
share|improve this answer
Heh, guess you beat me to it. Didn't see your answer until I entered mine. – VF1 Mar 27 '13 at 0:43

Exists has the attribute HoldAll:

(* {HoldAll, Protected, ReadProtected} *)

As such, specifying Exists[Array[b, 1], A] in your argument for Reduce is the same thing as telling that there is exists a value for the symbol of the form Array[b,1], verbatim, which makes A true.

Using Evaluate to make sure that Array is expanded into its appropriate set of values, you can achieve the desired result:

Simplify[Reduce[Exists[Evaluate[Array[b, 1]], A]]]
(* a[1] == 3 && a[2] <= 1 *)
share|improve this answer
LOL! Our answers are identical! :D – Federico Mar 27 '13 at 0:43
We also adopted the same style for posting code: code followed by (* return value *). You just wrote a little more explanation. I'm tired instead, 2AM here... Good night! – Federico Mar 27 '13 at 0:47

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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