MathGroup Archive 2002

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

Search the Archive

Re: Diophantic equations

  • To: mathgroup at smc.vnet.net
  • Subject: [mg32785] Re: [mg32746] Diophantic equations
  • From: BobHanlon at aol.com
  • Date: Sat, 9 Feb 2002 23:39:30 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

This is an improvement to my earlier post.  This looks 
for a lower bound in addition to an upper bound prior 
to using brute force.


Bob Hanlon
Chantilly, VA  USA
_______________________________

Needs["Algebra`InequalitySolve`"];

eqn={a+b+10 c==100, 5 a+2 b+c==100};

var = Union[Cases[eqn,
 
        _Symbol?(!NumericQ[#]&), Infinity]];

upper = (InequalitySolve[
            (eqn /. Equal -> LessEqual) /.
 
              Thread[ Rest[#]->1], First[#]] /.
 
          x_?NumberQ -> Floor[x])& /@
 
    NestList[RotateLeft[#,1]& , var, Length[var]-1]

{a <= 19, b <= 47, c <= 9}

lower = (InequalitySolve[
            (eqn /. Equal -> GreaterEqual) /. Rest[#],
 
            #[[1,1]]] /.
 
          x_?NumberQ -> Max[1,Ceiling[x]])& /@
 
    NestList[RotateLeft[#,1]& ,
 
      upper /. LessEqual -> Rule, Length[var]-1]

{a >= 1, b >= 1, c >= 4}

Off[Thread::tdlen];
rng = Thread[Range[Last /@ lower, Last /@ upper]];

soln = Thread[var->#]& /@
 
    Select[Flatten[Outer[List,Sequence@@rng], 2],
 
      And@@(eqn /. Thread[var->#])&]

{{a -> 11, b -> 19, c -> 7}}


  • Prev by Date: Re: Transforming Mathematica-files into PDF-files
  • Next by Date: Re: FullSimplify doesn't simplify
  • Previous by thread: Re: Diophantic equations
  • Next by thread: Re: Re: Diophantic equations