Re: solve - integer solution
- To: mathgroup at smc.vnet.net
- Subject: [mg34156] Re: [mg34145] solve - integer solution
- From: BobHanlon at aol.com
- Date: Tue, 7 May 2002 03:53:50 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
In a message dated 5/6/02 6:11:49 AM, c.krook at student.tue.nl writes:
>I need to find an instance from the integers that satisfies the following
>equation:
>
>{12 c[1, 0] + 12 c[2, 0] + 25 c[3, 0] - 50 c[3, 1] + 25 c[4, 0] - 50 c[4,
>1],
> 12 c[1, 1] + 12 c[2, 1] + 10 c[3, 0] + 15 c[3, 1] + 10 c[4, 0] + 15 c[4,
>1],
> c[1, 0] + 2 c[2, 0], c[1, 1] + 2 c[2, 1], c[3, 0] - 5 c[4, 1],
> c[3, 1] + c[4, 0] - c[4, 1]}=={0,0,0,0,0,0}
>
>Using Solve doesn't give (explicit) integer solutions; Furthermore, since
>I
>only need an arbitrary integer-instance is there an easier way to obtain
>one? (if not, how can I adjust solve?)
>(this is small example; my actual problem involves much larger lists)
>
eqns = {
12 c[1,0]+12 c[2,0]+25 c[3,0]-50 c[3,1]+
25 c[4,0]-50 c[4,1],
12 c[1,1]+12 c[2,1]+10 c[3,0]+15 c[3,1]+
10 c[4,0]+15 c[4,1],
c[1,0]+2 c[2,0],
c[1,1]+2 c[2,1],
c[3,0]-5 c[4,1],
c[3,1]+c[4,0]-c[4,1]}==
{0,0,0,0,0,0};
vars = Cases[eqns, c[_,_], Infinity]//Union;
Reduce[eqns, vars]
Off[Solve::svars]
This will give nine solution sets
Flatten[
Table[
Join[
Solve[eqns /. (t={c[4,0]->12*m, c[4,1]->12*n}),
vars][[1]],
t],
{m,-1,1}, {n,-1,1}],
1]//ColumnForm
Bob Hanlon
Chantilly, VA USA