I was not sure whether your question was mathematical or computational. Usually "Pell equation" means the +1 equation and ones says "negative Pell equation" for the -1 version. (I once wrote a paper "On the negative Pell equation"!). As Vincent says if you have a solution x+y*sqrt(d) to the negative equation, square it to get a solution to the positive equation.
But perhaps you just meant that the instructions were confusing? John Cremona On 1 November 2014 21:40, Vincent Delecroix <[email protected]> wrote: > Hello, > > First of all, I was not able to run your code. It fails on the line > > sage: L = [list(u^i) for i in [0..3]] > > Hopefully, with list(K(u^i)) instead of list(u^i) it works fine. > > I did not check the reference but the units of a quadratic number > fields are the solution of Pell equation with either 1 or -1 (which > are the invertible elements in Z). And actually, the subgroup of > solutions which corresponds to 1 always form a subgroup (which is > either the whole group or a subgroup of index 2). As you can see with > the same example, taking the square of a solution with -1 you get 1 > because the norm is multiplicative > > sage: x,y = K(u) > sage: x^2-1621*y^2 > -1 > sage: K(u).norm() > -1 > > sage: x,y = K(u)**2 > sage: x^2-1621*y^2 > 1 > sage: K(u**2).norm() > 1 > > I am not sure it solves the issue from the reference. > > Vincent > > 2014-10-31 10:14 UTC−06:00, Michael Beeson <[email protected]>: >> Here I attempt to solve Pell's equation with d = 1621 following the method >> on page 93 of Stein's book. >> But the solution produced is instead a solution of the negative Pell >> equation x^2-y^2 = -1 (instead of 1). >> Actually, the example on page 93 (after correcting the typo "v" to "u") has >> >> the same problem: it claims >> that [-2,1] solves Pell's equation with d=5, whereas, it really solves >> the negative Pell equation. >> >> sage: K.<a> = QuadraticField(1621) >> sage: G = K.unit_group() >> sage: u = G.1 >> sage: L = [list(u^i) for i in [0..3]] >> sage: L >> [[1, 0], [4823622127875/2, 119806883557/2], [23267330432525342852015627/2, >> 577903134597288688851375/2], [56116404965454319198851772383057215250, >> 1393793173905903098261469193463230841]] >> sage: x = L[2][0]; >> sage: y = L[2][1]; >> sage: x >> 23267330432525342852015627/2 >> sage: x = L[3][0]; >> sage: y = L[3][1]; >> sage: x >> 56116404965454319198851772383057215250 >> sage: y >> 1393793173905903098261469193463230841 >> sage: x^2-1621*y^2 >> -1 >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "sage-support" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To post to this group, send email to [email protected]. >> Visit this group at http://groups.google.com/group/sage-support. >> For more options, visit https://groups.google.com/d/optout. >> > > -- > You received this message because you are subscribed to the Google Groups > "sage-support" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/sage-support. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
