MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

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


Hi,

may be this helps:

In[1]:= Array[x, 5] // # > 0 & /@ # & // And @@ # &

Out[1]= x[1] > 0 && x[2] > 0 && x[3] > 0 && x[4] > 0 && x[5] > 0


On 16 Jan., 13:01, Rex <aoi... at 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?



  • Prev by Date: Re: How to remove the Null character in a Table?
  • Next by Date: Re: how can one use mathematica get the approximate derivative of {x,y} data points?
  • Previous by thread: How to easily set up all coefficients to be positive in Solving an integer equation?
  • Next by thread: Re: How to easily set up all coefficients to be positive in Solving an integer equation?