MathGroup Archive 2003

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

Search the Archive

Re: Limiting the results


Needs["Algebra`InequalitySolve`"];

InequalitySolve[{x==y/3, 0<=x<=9, 0<=y<=9}, {x, y}]

	0â?¤xâ?¤3&&y==3 x

Using only 0 <= x <= 3,

Table[{x, y /.Solve[x==y/3, y][[1]]}, {x, 0, 3}]

	{{0,0},{1,3},{2,6},{3,9}}

Using both,

Table[{x, 3x}, {x, 0, 3}]

	{{0,0},{1,3},{2,6},{3,9}}

Brute force method:

Select[Flatten[
    Outer[List,Range[0,3], Range[0,9,3]],1],
  #[[1]]==#[[2]]/3&]

	{{0,0},{1,3},{2,6},{3,9}}


Bob Hanlon

In article <b51a67$336$1 at smc.vnet.net>, GeRaLt <mistrzpc at spam.pl> wrote:

<< 
Subject:	Limiting the results
From:		GeRaLt <mistrzpc at spam.pl>
To: mathgroup at smc.vnet.net
Date:		Sun, 16 Mar 2003 07:47:19 +0000 (UTC)

Equation: x=y/3
and i want both variables to be for example digits (integers 0,1...9)
How to solve it? (so that it returns pairs (0,0),(1,3),(2,6),(3,9)) >>



  • Prev by Date: Re: silver-pohlig-hellman ... please improve
  • Next by Date: Increase in efficiency with Module
  • Previous by thread: Re: silver-pohlig-hellman ... please improve
  • Next by thread: Re: Limiting the results