solving Diophantine equations in Sage

2,666 views
Skip to first unread message

Robert Dodier

unread,
Dec 8, 2012, 12:46:00 PM12/8/12
to sage-s...@googlegroups.com
Hello, is there a way to solve Diophantine equations in Sage? If not a
general method, perhaps at least some special cases.

There is some interest in solving such equations in Maxima -- I am
daydreaming about porting whatever implementation Sage has. Is there a
generally-accepted more-or-less best method these days? (Whether it is
implemented in Sage or not.)

There is this web page, http://www.alpertron.com.ar/METHODS.HTM, which
describes a method, and this one, http://www.alpertron.com.ar/JQUAD.HTM,
which has a calculator. Would anyone care to comment on the suitability
of either one as the basis for an implementation? Pointers to any other
resources would be interesting.

best

Robert Dodier

Christophe BAL

unread,
Dec 8, 2012, 12:52:54 PM12/8/12
to sage-s...@googlegroups.com
Hello.

There is no general method : see this page 

C.


2012/12/8 Robert Dodier <robert...@gmail.com>

Robert Dodier

--
You received this message because you are subscribed to the Google Groups "sage-support" group.
To post to this group, send email to sage-s...@googlegroups.com.
To unsubscribe from this group, send email to sage-support...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support?hl=en.



Volker Braun

unread,
Dec 8, 2012, 1:27:22 PM12/8/12
to sage-s...@googlegroups.com
Solving a linear diophantine equation is an application of the Smith form.

A quadratic diophantine equation can be solved with the Hasse-Minkowski theorem, though thats is definitely more advanced (http://en.wikipedia.org/wiki/Hasse%E2%80%93Minkowski_theorem)

If its not one of these cases then you are pretty much out of luck ;-)

Robert Dodier

unread,
Dec 8, 2012, 1:48:03 PM12/8/12
to sage-s...@googlegroups.com
On 2012-12-08, Volker Braun <vbrau...@gmail.com> wrote:

> Solving a linear diophantine equation is an application of the Smith form.
>
> A quadratic diophantine equation can be solved with the Hasse-Minkowski
> theorem, though thats is definitely more advanced

Thanks for the info. Are there implementations of these approaches in
Sage or any upstream project? (e.g. PARI/GP, Singular, I don't know.)

best,

Robert Dodier

Ivan Andrus

unread,
Dec 8, 2012, 2:03:48 PM12/8/12
to sage-s...@googlegroups.com
On Dec 8, 2012, at 7:27 PM, Volker Braun <vbrau...@gmail.com> wrote:

> Solving a linear diophantine equation is an application of the Smith form.
>
> A quadratic diophantine equation can be solved with the Hasse-Minkowski theorem, though thats is definitely more advanced (http://en.wikipedia.org/wiki/Hasse%E2%80%93Minkowski_theorem)
>
> If its not one of these cases then you are pretty much out of luck ;-)

I know basically nothing about Diophantine equations, but they have come up in my research a few times. Is there some sort of database of which equations have been solved (or not). I'm thinking something along the lines of the OEIS that would allow you to search for an equation to find out what could be said about it. I couldn't find any such thing on google, but it seems nearly inconceivable to me that such a thing wouldn't exist. Or are number theorists just born knowing this stuff. :-)

-Ivan

Volker Braun

unread,
Dec 8, 2012, 3:20:51 PM12/8/12
to sage-s...@googlegroups.com
On Saturday, December 8, 2012 7:03:48 PM UTC, Ivan Andrus wrote:
Or are number theorists just born knowing this stuff.  :-)

Beats me, I'm just a physicist dabbling in computer programming ;-) 

William Stein

unread,
Dec 8, 2012, 4:06:17 PM12/8/12
to sage-support support


On Dec 8, 2012 10:27 AM, "Volker Braun" <vbrau...@gmail.com> wrote:
>
> Solving a linear diophantine equation is an application of the Smith form.
>
> A quadratic diophantine equation can be solved with the Hasse-Minkowski theorem, though thats is definitely more advanced (http://en.wikipedia.org/wiki/Hasse%E2%80%93Minkowski_theorem)
>
> If its not one of these cases then you are pretty much out of luck ;-)
>
>

Elliptic curves (cubic plane curves) are another major case with a developed theory.

This stuff basically *is* number theory...  and as such, Sage and Magma are pretty powerful for this, far ahead of anything else...

> On Saturday, December 8, 2012 5:46:00 PM UTC, Robert Dodier wrote:
>>
>> Hello, is there a way to solve Diophantine equations in Sage?
>

Georgi Guninski

unread,
Dec 9, 2012, 1:43:41 AM12/9/12
to Robert Dodier, sage-s...@googlegroups.com
pari/gp which is included in sage can solve the special case
of Thue equations.

In pari console:
th=thueinit(x^5-2,1);\\x^5-2*y^5, ",1" is for unconditional result
t=thue(th,65)\\x^5-2*y^5=65
%7 = [[1, -2]]


If you want to work from sage the above example is:
sage: AA.<x>=QQ[]
sage: th=gp.thueinit(x^5-2,1)
sage: gp.thue(th,65)
[[1, -2]]

NN

unread,
May 28, 2013, 10:21:22 AM5/28/13
to sage-s...@googlegroups.com, Robert Dodier, guni...@guninski.com
Hi,

Although it seems that this thread has not been active for a while, I venture to post a related question:

Is it possible to find all solutions to a linear Diophantine equation modulo some integer m i.e. find all solutions (x,y) to the equation: a x + b y = c (mod m) for fixed integers a,b,c?

Thanks!
 
Reply all
Reply to author
Forward
0 new messages