MathGroup Archive 2002

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

Search the Archive

Re: Intersection of sets of results

  • To: mathgroup at smc.vnet.net
  • Subject: [mg37105] Re: [mg37099] Intersection of sets of results
  • From: BobHanlon at aol.com
  • Date: Thu, 10 Oct 2002 03:20:32 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

In a message dated 10/9/2002 6:22:03 AM, flip_alpha at safebunch.com writes:

>I have two equations that I have solved for:
>
>x[n_]  := 2331 + 8 n
>y[n_] :=  -3108 - 11n
>
>I want to include only solutions which are non-negative, that is x >= 0
>and
>y >= 0.
>
>In this example we can do 2331 + 8n > = 0 and solve for n, n >= -291.375
>and -3108 - 11 n >= 0 and solve for n, n <= -282.545
>
>So we have -291.375 <= n <= -282.545.
>
>The "integer solution set here is for n =
>{-290, -289, -288, -287, -286, -285, -284, -283}.
>
>So in this case we have 8 non-negative solutions.
>
>Given that I can supply x[n] and y[n], how do I go about finding the set
>n?
>

Needs["Algebra`InequalitySolve`"];

x[n_] := 2331 + 8n;
y[n_] := -3108 - 11n;

rng = InequalitySolve[{x[n] >= 0, y[n] >= 0}, n];
soln = Range[Ceiling[rng[[1]]], rng[[-1]]]

{-291, -290, -289, -288, -287, -286, -285, -284, -283}

Length[soln]

9


Bob Hanlon


  • Prev by Date: Re: Is {d,e,f}[a] meaningful or useful?
  • Next by Date: RE: Intersection of sets of results
  • Previous by thread: Intersection of sets of results
  • Next by thread: RE: Intersection of sets of results