Re: [sympy] Ternary quadratic forms and Quadratic congruences

2013-08-01 Thread Thilina Rathnayake
Hi Ondrej, I made a commit. Please have a look at it when you are free. PR: https://github.com/sympy/sympy/pull/2303 Regards, Thilina. On Fri, Aug 2, 2013 at 1:35 AM, Thilina Rathnayake wrote: > Hi Ondrej, > > There was a problem with the equation y**2 - 7*x*y + 4*y*z which returned > y = 0

Re: [sympy] Ternary quadratic forms and Quadratic congruences

2013-08-01 Thread Thilina Rathnayake
Hi Ondrej, There was a problem with the equation y**2 - 7*x*y + 4*y*z which returned y = 0 for the parametric solution. Although the parametric representation is not complete, this is ugly. I fixed this by noticing that we can factorize the input equation and solve each factor. By this way, We get

Re: [sympy] Ternary quadratic forms and Quadratic congruences

2013-08-01 Thread Ondřej Čertík
On Thu, Aug 1, 2013 at 11:26 AM, Thilina Rathnayake wrote: > The branch I used to commit code for binary quadratics is already merged. > Currently I am working in the branch "Diophantine_Equation_Module_II" > which I have been using to commit the code for ternary quadratic equations. > It's not me

Re: [sympy] Ternary quadratic forms and Quadratic congruences

2013-08-01 Thread Thilina Rathnayake
The branch I used to commit code for binary quadratics is already merged. Currently I am working in the branch "Diophantine_Equation_Module_II" which I have been using to commit the code for ternary quadratic equations. It's not merged. I need to change some code in the binary quadratic equations.

Re: [sympy] Ternary quadratic forms and Quadratic congruences

2013-08-01 Thread Ondřej Čertík
On Wed, Jul 31, 2013 at 11:13 PM, Thilina Rathnayake wrote: > Hi Ondrej, > > I am planning to improve the algorithms used in solving binary quadratic > equation. > (Pernici pointed out some efficient algorithms). Should I commit these > changes in > a new branch or can I use the current one I used

Re: [sympy] Ternary quadratic forms and Quadratic congruences

2013-07-31 Thread Thilina Rathnayake
Hi Ondrej, I am planning to improve the algorithms used in solving binary quadratic equation. (Pernici pointed out some efficient algorithms). Should I commit these changes in a new branch or can I use the current one I used to implement ternary quadratics? Regards, Thilina On Sat, Jul 27, 20

Re: [sympy] Ternary quadratic forms and Quadratic congruences

2013-07-27 Thread Thilina Rathnayake
Hi Ondrej, Sorry for taking a lot of time to send you updates on the project. I had a little busy time since our university is having a drama festival and I had to practice a drama for it. It ends on upcoming Monday, so I will be as free as before after Monday. I had to find a source for an algor

Re: [sympy] Ternary quadratic forms and Quadratic congruences

2013-07-23 Thread Thilina Rathnayake
Thanks mario for the great job. Let me try your code. Regards, Thilina On Wed, Jul 24, 2013 at 12:47 AM, Ondřej Čertík wrote: > Thanks. Should we integrate it into sympy? > > Ondrej > > On Tue, Jul 23, 2013 at 1:34 AM, mario wrote: > > In the attached file there is a new version of ``descent``

Re: [sympy] Ternary quadratic forms and Quadratic congruences

2013-07-23 Thread Ondřej Čertík
Thanks. Should we integrate it into sympy? Ondrej On Tue, Jul 23, 2013 at 1:34 AM, mario wrote: > In the attached file there is a new version of ``descent``; I followed your > suggestion about > reducing the input to the square free part; in this way the lowest modular > square root is > always

Re: [sympy] Ternary quadratic forms and Quadratic congruences

2013-07-22 Thread mario
In the attached file there is a new version of ``descent``; I followed your suggestion about reducing the input to the square free part; in this way the lowest modular square root is always used; there is no need to use others; so the code in Smart seems to be correct, provided the input is redu

Re: [sympy] Ternary quadratic forms and Quadratic congruences

2013-07-20 Thread Ondřej Čertík
On Sat, Jul 20, 2013 at 11:25 AM, Thilina Rathnayake wrote: > Hi Ondrej, > > I am pleased to say that I managed to implement the solutions for quadratic > ternary forms. > Only thing we have to verify is that whether they are complete. I found one > incident in the > current implementation where i

Re: [sympy] Ternary quadratic forms and Quadratic congruences

2013-07-20 Thread Thilina Rathnayake
Thanks Ondrej for putting the link of the PR. I am sorry I forgot to put it. I am really grateful If other's can play with this and give feedback on how this can be improved, especially reports any bugs in the programme. Thanks in advance. On Sat, Jul 20, 2013 at 11:00 PM, Ondřej Čertík wrote:

Re: [sympy] Ternary quadratic forms and Quadratic congruences

2013-07-20 Thread Thilina Rathnayake
Hi Ondrej, I am pleased to say that I managed to implement the solutions for quadratic ternary forms. Only thing we have to verify is that whether they are complete. I found one incident in the current implementation where it returned a partial solution. I added it as a different test. I plan to i

Re: [sympy] Ternary quadratic forms and Quadratic congruences

2013-07-19 Thread Ondřej Čertík
On Fri, Jul 19, 2013 at 1:48 AM, Thilina Rathnayake wrote: > Ondrej, > > I thought of implementing the sieving method described in the book to verify > the answers > returned by the descent method. It's simple to implement. What actually we > need to check > in descent method is whether it finds a

Re: [sympy] Ternary quadratic forms and Quadratic congruences

2013-07-19 Thread Thilina Rathnayake
Ondrej, I thought of implementing the sieving method described in the book to verify the answers returned by the descent method. It's simple to implement. What actually we need to check in descent method is whether it finds a solution if one exist, base solution returned by different algorithms wi

Re: [sympy] Ternary quadratic forms and Quadratic congruences

2013-07-18 Thread Ondřej Čertík
Thilina, On Thu, Jul 18, 2013 at 1:43 PM, Thilina Rathnayake wrote: > Seems like they haven't implement it anywhere else. I found an algorithm > that > was implemented in MAGMA, but it involves lattice reduction and since I am > almost finished with the descent method, I didn't try to implement t

Re: [sympy] Ternary quadratic forms and Quadratic congruences

2013-07-18 Thread Thilina Rathnayake
Seems like they haven't implement it anywhere else. I found an algorithm that was implemented in MAGMA, but it involves lattice reduction and since I am almost finished with the descent method, I didn't try to implement that. I would try that If I can find some free time or perhaps after completing

Re: [sympy] Ternary quadratic forms and Quadratic congruences

2013-07-18 Thread Ondřej Čertík
Thanks Mario! I really appreciate your help. That's quite amazing that they had few bugs in the algorithm. Do you think they didn't actually implement it in any software? Ondrej On Thu, Jul 18, 2013 at 5:36 AM, mario wrote: > The attached version works in the mentioned cases; the bug is fixed r

Re: [sympy] Ternary quadratic forms and Quadratic congruences

2013-07-18 Thread mario
The attached version works in the mentioned cases; the bug is fixed reducing to the case ``A > 0, B > 0`` On Thursday, July 18, 2013 11:28:22 AM UTC+2, Thilina Rathnayake wrote: > > I should try making input coefficients to be square free. I think the > algorithm in general, > does not work when

Re: [sympy] Ternary quadratic forms and Quadratic congruences

2013-07-18 Thread Thilina Rathnayake
I should try making input coefficients to be square free. I think the algorithm in general, does not work when the coefficients are not square free. On Thu, Jul 18, 2013 at 2:53 PM, Thilina Rathnayake wrote: > We can add descent(23, 616) to the bug list too. It also return (None, > None, None)

Re: [sympy] Ternary quadratic forms and Quadratic congruences

2013-07-18 Thread Thilina Rathnayake
We can add descent(23, 616) to the bug list too. It also return (None, None, None) but (6, 1, 38) is a solution. By finding more and more test cases which fail, I think we can identify a pattern and then the cause for the bug. Regards, Thilina -- You received this message because you are subscri

Re: [sympy] Ternary quadratic forms and Quadratic congruences

2013-07-18 Thread Thilina Rathnayake
Hi, I tried mario's code. Now it solves the equation for almost all the values of A and B. Thank you very much mario for the help given. But I found two bugs. One was, descent (4, -7) returned (None, None, None) instead of the correct solution (1, 0, 2). (signs of the values in the solution tuple

Re: [sympy] Ternary quadratic forms and Quadratic congruences

2013-07-16 Thread Thilina Rathnayake
Thank you very much mario for the trouble taken. I'll let you guys know whether this fix works. On Tue, Jul 16, 2013 at 7:43 PM, Ondřej Čertík wrote: > Thanks Mario! > > Thilina, let us know if that works. I apologize I didn't have time > yesterday. > > Ondrej > > On Tue, Jul 16, 2013 at 5:38 A

Re: [sympy] Ternary quadratic forms and Quadratic congruences

2013-07-16 Thread Ondřej Čertík
Thanks Mario! Thilina, let us know if that works. I apologize I didn't have time yesterday. Ondrej On Tue, Jul 16, 2013 at 5:38 AM, mario wrote: > In the attached file there is my attempt; it seems to work; it seems to me > that there is a bug > in the code in the book; in line 4 it should be >

Re: [sympy] Ternary quadratic forms and Quadratic congruences

2013-07-16 Thread mario
On Tuesday, July 16, 2013 1:38:02 PM UTC+2, mario wrote: > > In the attached file there is my attempt; it seems to work; it seems to me > that there is a bug > in the code in the book; in line 4 it should be > ``Find r in [0,..., ceiling(abs(B)/2] such that r**2 == A mod B`` > > > > On Tuesday,

Re: [sympy] Ternary quadratic forms and Quadratic congruences

2013-07-16 Thread mario
In the attached file there is my attempt; it seems to work; it seems to me that there is a bug in the code in the book; in line 4 it should be ``Find r in [0,..., ceiling(abs(B)/2] such that r**2 == A mod B`` On Tuesday, July 16, 2013 2:13:32 AM UTC+2, Thilina Rathnayake wrote: > > Hi Ondrej, >

Re: [sympy] Ternary quadratic forms and Quadratic congruences

2013-07-15 Thread Thilina Rathnayake
Hi Ondrej, Here is my attempt to debug: http://nbviewer.ipython.org/94ee433a4dca26e3fee1 Regards, Thilina. On Tue, Jul 16, 2013 at 3:01 AM, Thilina Rathnayake wrote: > Hi Ondrej, > > Here is the notebook I created: > http://nbviewer.ipython.org/3dfe97025f06876820b4 > > Please let me know if a

Re: [sympy] Ternary quadratic forms and Quadratic congruences

2013-07-15 Thread Thilina Rathnayake
Hi Ondrej, Here is the notebook I created: http://nbviewer.ipython.org/3dfe97025f06876820b4 Please let me know if anything needs to be changed. Regards, Thilina. On Tue, Jul 16, 2013 at 2:26 AM, Thilina Rathnayake wrote: > Hi Ondrej, > > Thank you very much for the quick response. > > I copie

Re: [sympy] Ternary quadratic forms and Quadratic congruences

2013-07-15 Thread Thilina Rathnayake
Hi Ondrej, Thank you very much for the quick response. I copied these two functions from my current diophantine.py and I forgot to copy the lines containing the imports. Sorry about that. I think both the outputs [2] and [3] are correct. In [3], since we called `descent(2, 1)` the equation is `w

Re: [sympy] Ternary quadratic forms and Quadratic congruences

2013-07-15 Thread Ondřej Čertík
On Mon, Jul 15, 2013 at 2:31 PM, Ondřej Čertík wrote: > Thilina, > > Thanks. You can use ipython notebook for exactly this exploration (let > me know if you have any problems setting it up). Here it is: > > http://nbviewer.ipython.org/6003151 P.S. One has to put from math import floor on top, a

Re: [sympy] Ternary quadratic forms and Quadratic congruences

2013-07-15 Thread Ondřej Čertík
Thilina, Thanks. You can use ipython notebook for exactly this exploration (let me know if you have any problems setting it up). Here it is: http://nbviewer.ipython.org/6003151 So the output [2] is correct, isn't it? But the output [3] seems incorrect to me, isn't it? Let me know which other out

Re: [sympy] Ternary quadratic forms and Quadratic congruences

2013-07-15 Thread Thilina Rathnayake
I attached the code herewith as a .py file so you can easily run it. On Tue, Jul 16, 2013 at 12:47 AM, Thilina Rathnayake wrote: > Hi Ondrej, > > Thank you very much for the words of encouragement. I am implementing the > descent method. > I have used the solver you pointed out to validate ans

Re: [sympy] Ternary quadratic forms and Quadratic congruences

2013-07-15 Thread Thilina Rathnayake
Hi Ondrej, Thank you very much for the words of encouragement. I am implementing the descent method. I have used the solver you pointed out to validate answers for quadratic Diophantine equations. We need something which solve the the ternary quadratic equations. I will continue implementing the

Re: [sympy] Ternary quadratic forms and Quadratic congruences

2013-07-15 Thread Ondřej Čertík
I see, it's the Chapter IV. Are you going to implement the "Sieving method" (IV.3.1)? Or the "descent method"? So, if I take the Pythagorean formula a^2 + b^2 = c^2, your new solver will be able to give me all integer solutions to this? That would be really cool. As far as a solver, I found this

Re: [sympy] Ternary quadratic forms and Quadratic congruences

2013-07-14 Thread Thilina Rathnayake
This is what I use. “The Algorithmic resolution of Diophantine Equations”, Nigel P. Smart, Chapter IV, Quadratic ternary forms. Here is the book: On Mon, Jul 15, 2013 at 2:20 AM, Aaron Meurer wrote: > On Sun, Jul 14, 2013 at 12:09 AM, Thilina Rathn

Re: [sympy] Ternary quadratic forms and Quadratic congruences

2013-07-14 Thread Aaron Meurer
On Sun, Jul 14, 2013 at 12:09 AM, Thilina Rathnayake wrote: > Hi All, > > I am planning to implement ternary quadratic forms, i.e equations of the > form, > a*x**2 + by**2 + cz**2 + fxy + gyz + hzx = 0. It would be better If I can > find > a system which currently implement this so I can validate

[sympy] Ternary quadratic forms and Quadratic congruences

2013-07-13 Thread Thilina Rathnayake
Hi All, I am planning to implement ternary quadratic forms, i.e equations of the form, a*x**2 + by**2 + cz**2 + fxy + gyz + hzx = 0. It would be better If I can find a system which currently implement this so I can validate my results. If you know of any system which solves this or a source