Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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.

share|improve this question
2  
Can you please format your question properly? Read this here which you find when you click on the question mark of the editor window. –  halirutan 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+ –  Artes Aug 6 '13 at 14:09

1 Answer 1

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)
share|improve this answer
    
This works for me. Thanks. –  TC Jones 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. –  Mr.Wizard Aug 10 '13 at 23:14

Your Answer

 
discard

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.