Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #7912 > unrolled thread

Re: How to easily set up all coefficients to be positive in Solving an integer equation?

Started byDrMajorBob <btreat1@austin.rr.com>
First post2012-01-17 08:38 +0000
Last post2012-01-17 08:38 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Re: How to easily set up all coefficients to be positive in Solving an integer equation? DrMajorBob <btreat1@austin.rr.com> - 2012-01-17 08:38 +0000

#7912 — Re: How to easily set up all coefficients to be positive in Solving an integer equation?

FromDrMajorBob <btreat1@austin.rr.com>
Date2012-01-17 08:38 +0000
SubjectRe: How to easily set up all coefficients to be positive in Solving an integer equation?
Message-ID<jf3c2p$nfd$1@smc.vnet.net>
Either of these should work (if n is known, e.g. 10):

Thread[Array[x, 10] > 0]

{x[1] > 0, x[2] > 0, x[3] > 0, x[4] > 0, x[5] > 0, x[6] > 0, x[7] > 0,
   x[8] > 0, x[9] > 0, x[10] > 0}

And @@ Thread[Array[x, 10] > 0]

x[1] > 0 && x[2] > 0 && x[3] > 0 && x[4] > 0 && x[5] > 0 && x[6] > 0 &&
   x[7] > 0 && x[8] > 0 && x[9] > 0 && x[10] > 0

If n is NOT known, nothing will work.

Bobby

On Mon, 16 Jan 2012 16:11:13 -0600, Rex <aoirex@gmail.com> wrote:

> Given a vector `A==[a_1, a_2, a_3,...,a_n]`, where a_i are integers,
> now
> solving an equation
> `=E2=88=91a_i * x_i==0` with all x_i>==0, and x_i to be integers.
>
> We can write some code like this
> `Solve[A . Table[x[i], {i, n}] ==  0 && Table[x[i] > 0, {i, n}],
> Integers]`
>
> But the conditions above `Table[x[i] > 0` is not rightly coded. That
> should be
> `x[1]>0 && x[2]>0 && x[3]>0 &&...x[n]>0`
> Is there any easy way to write such code?
>


-- 
DrMajorBob@yahoo.com

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web