# Compact form for domain ranges of many variables

When one sets up an equation to solve one often needs to specify conditions on the variables such as

{ x>0 && y>0 && z>0 }


This is not a problem if only a few variables are involved. However, it is another matter when say, 50 are required. Is there a compact form one can use? Using

(...) && Table[x[[i]], {i,50}] > 0


within Reduce[] or Solve[] will not work.

• Can you please format your question properly? Read this here which you find when you click on the question mark of the editor window. Aug 5 '13 at 22:10
• Try (...) && (And @@ Table[...])
– rm -rf
Aug 5 '13 at 23:52
• The second solution to this answer:How to find lattice points on a line segment? is another example like one can use Solve. Perhaps you could see also this Solve an equation in R+ Aug 6 '13 at 14:09

One approach:

eqs = {x^2 + 4 y^2 + 9 z^2 + 16 t^2 == 354};

vars = Variables @ Level[eqs, -1]

Reduce[eqs ~Join~ Thread[vars > 0], {}, Integers]

{t, x, y, z}

(t == 1 && x == 1 && y == 8 && z == 3) || (t == 1 && x == 7 && y == 4 && z == 5) ||
(t == 2 && x == 1 && y == 4 && z == 5) || (t == 2 && x == 5 && y == 8 && z == 1) ||
(t == 2 && x == 7 && y == 2 && z == 5) || (t == 4 && x == 1 && y == 2 && z == 3) ||
(t == 4 && x == 5 && y == 4 && z == 1)

• This works for me. Thanks. Aug 10 '13 at 22:02
• @TCJones You're welcome. Please consider voting for posts you find helpful and Accepting those that are fully satisfactory. Aug 10 '13 at 23:14