Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2003
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2003

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

Search the Archive

Re: Limiting the results

  • To: mathgroup at smc.vnet.net
  • Subject: [mg40047] Re: Limiting the results
  • From: bobhanlon at aol.com (Bob Hanlon)
  • Date: Mon, 17 Mar 2003 03:34:31 -0500 (EST)
  • References: <b51a67$336$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

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