MathGroup Archive 2002

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

Search the Archive

Re: Re: Diophantic equations

  • To: mathgroup at smc.vnet.net
  • Subject: [mg32788] Re: [mg32771] Re: [mg32746] Diophantic equations
  • From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
  • Date: Sat, 9 Feb 2002 23:39:34 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

In my original reply I failed to notice you only wanted non-negative 
solutions. One can of course obtain them from the solution below by 
trying various values for m, but if you prefer to do it more 
automatically here is one way:

First load the InequalitySolve package:
In[1]:=
<< "Algebra`InequalitySolve`"

since a and b have to be >=0 we must have:

In[2]:=
InequalitySolve[{6300 + m*19 >= 0, -16200 - m*49 >= 0}, {m}]

Out[2]=
-(6300/19) <= m <= -(16200/49)

In other words:

In[3]:=
N[%]

Out[3]=
-331.57894736842104 <= m <= -330.61224489795916

There is only one such integer

In[4]:=
m = -331;

thus

In[5]:=
a = 6300 + m*19

Out[5]=
11

In[6]:=
b = -16200 - m*49

Out[6]=
19

In[7]:=
c = 100 - 5*a - 2*b

Out[7]=
7

Andrzej Kozlowski
Toyama International University
JAPAN
http://platon.c.u-tokyo.ac.jp/andrzej/


On Saturday, February 9, 2002, at 07:11  PM, Andrzej Kozlowski wrote:

> Here is how to do it in your case. You can use this method to solve more
> general linear cases.
>
> First eliminate one variable from the equations:
>
> In[1]:=
> eqs={a+b+10 c==100,5 a+2 b+c==100}
>
> In[2]:=
> Eliminate[eqs,{c}]
>
> Out[2]=
> 900-19 b==49 a
>
> Clearly we only need to find all integer solutions of the equation  49
> a + 19 b == 900, since c will then be given by c=100-a-2b.
>
> The next step is to find just a single integer solution. The general way
> to do this is to use the Euclidean algorithm.
>
> In[3]:=
> ExtendedGCD[49,19]
>
> Out[3]=
> {1,{7,-18}}
>
> This tells us that:
>
> In[4]:=
> 7*49-18*19
>
> Out[4]=
> 1
>
>  From this we see at once that a solution will be given by:
>
> In[7]:=
> a=900*7
>
> Out[7]=
> 6300
>
> In[8]:=
> b=900*-18
>
> Out[8]=
> -16200
>
> indeed
>
> In[9]:=
> 49 a+19 b
>
> Out[9]=
> 900
>
> Now that we have one solution (a,b) all the other solutions are given by
> (a+m 19,b-m 49) = (6300+ m*19,-16200-m*49) where m is  any integer.
> Indeed:
>
> In[11]:=
> {6300+m*19,-16200-m*49}.{49,19}//Simplify
>
> Out[11]=
> 900
>
>
>
> On Friday, February 8, 2002, at 05:49  PM, Max Ulbrich wrote:
>
>> Hi,
>>
>> I try to solve equations where only integers are allowed, like
>>
>> a + b + 10 c = 100
>> 5 a + 2 b + c = 100
>>
>> a, b, c should be integers and positve.
>>
>> How can I do this?
>>
>> Max
>>
>>
>>
>>
>>
>
>
>



  • Prev by Date: Re: finite fields
  • Next by Date: Ailing Palette Buttons
  • Previous by thread: Re: Diophantic equations
  • Next by thread: FullSimplify doesn't simplify