2
$\begingroup$

I have a two lists $LHS$ and $RHS$, both of size $n$. I want to solve a system of inequalities of the form:

$$LHS[1] \leq RHS[1]$$

$$LHS[2] \leq RHS[2]$$

$$LHS[3] \leq RHS[3]$$

$$\vdots$$

$$LHS[n] \leq RHS[n]$$

We assume that:

Each $LHS[i]$ is a linear equation in $m$ variables, say: $\alpha_{1}, \dots, \alpha_{m}$ and each $RHS[i]$ is a linear equation in $m$ variables, say: $\beta_{1}, \dots, \beta_{m}$.

We need to solve for $\alpha_{1}, \dots, \alpha_{m}$, $\beta_{1}, \dots, \beta_{m}$, which are positive integers.

Take m=2. To solve a single inequality (for some $i$ between $1$ and $n$) I know that I need to enter:

Reduce[LHS[[i]]<=RHS[[i]],{[\alpha]0,[\alpha]1,[\beta]0,[\beta]1}]

(I haven't put the constrains to make the code simpler)

But, if I need to solve all the inequalities, how do I input a list in 'Reduce' ?

Thanks a lot in advance.

$\endgroup$
2
  • $\begingroup$ Have you checked the documentation? From the doc one example which should help you: Reduce[x^2 + y z == 1 && x + 2 y <= 3 z + 1 && x y z > 7, {x, y, z}, Reals]. If this does not help you, can you post a minimal specific example, not the general problem? $\endgroup$
    – halirutan
    Commented Oct 16, 2012 at 23:42
  • 1
    $\begingroup$ Do you just need something like And @@ Thread[lhs <= rhs]? $\endgroup$
    – wxffles
    Commented Oct 16, 2012 at 23:50

1 Answer 1

5
$\begingroup$

You could use Inner to build the system of inequalities:

Reduce[ Inner[ LessEqual, lhs, rhs, And], Variables[{lhs,rhs}], Reals ]
$\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.