[sage-support] Re: Sum of four square

2009-07-10 Thread Marshall Hampton
Want to review it? :) On Jul 10, 6:03 pm, Jaap Spies wrote: > Marshall Hampton wrote: > > In case anyone looked at that in the last few hours, I replaced the > > patch recently with some fixes and minor speedups. > > I noticed! > > Jaap --~--~-~--~~~---~--~~ To p

[sage-support] Re: Sum of four square

2009-07-10 Thread Jaap Spies
Marshall Hampton wrote: > In case anyone looked at that in the last few hours, I replaced the > patch recently with some fixes and minor speedups. > I noticed! Jaap --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsu

[sage-support] Re: Sum of four square

2009-07-10 Thread Marshall Hampton
In case anyone looked at that in the last few hours, I replaced the patch recently with some fixes and minor speedups. -Marshall On Jul 10, 3:22 pm, Marshall Hampton wrote: > A slightly revised effort is now up for review as trac #6509: > > http://trac.sagemath.org/sage_trac/ticket/6509 > > -Ma

[sage-support] Re: Sum of four square

2009-07-10 Thread Marshall Hampton
A slightly revised effort is now up for review as trac #6509: http://trac.sagemath.org/sage_trac/ticket/6509 -Marshall On Jul 10, 2:08 pm, Marshall Hampton wrote: > I have tested this up to 1, seems to work: > > def brute_force_s4(n): > ''' > Brute force search for decomposition in

[sage-support] Re: Sum of four square

2009-07-10 Thread Marshall Hampton
I have tested this up to 1, seems to work: def brute_force_s4(n): ''' Brute force search for decomposition into a sum of four squares, for cases that the main algorithm fails to handle. ''' for i in range(0,int(sqrt(n))+1): for j in range(i,int(sqrt(n-i^2))+1):

[sage-support] Re: Sum of four square

2009-07-10 Thread Jaap Spies
Minh Nguyen wrote: > Hi > > On Sat, Jul 11, 2009 at 12:30 AM, Santanu > Sarkar wrote: >> Is the algorithm for sum of four square i,e every positive integer >> can be expressed as the sum of four square is implemented in >> Sage > > If you're referring to Lagrange's four-square theorem, then Sa

[sage-support] Re: Sum of four square

2009-07-10 Thread Marshall Hampton
Since that was a first stab at it, I doubt it is better than the built- in. In order to handle special cases, I think my code could fall back on some brute-force version like: def brute_force_s4(n): for i in range(0,int(sqrt(n))): for j in range(i,int(sqrt(n-i^2))): for k

[sage-support] Re: Sum of four square

2009-07-10 Thread William Stein
On Fri, Jul 10, 2009 at 10:01 AM, Marshall Hampton wrote: > > I tried to do this for fun, but my code doesn't quite work.  There is > a java applet with quite readable source code available at: > http://www.alpertron.com.ar/FSQUARES.HTM > I was trying to implement the ideas at: http://www.schorn.c

[sage-support] Re: Sum of four square

2009-07-10 Thread Marshall Hampton
I tried to do this for fun, but my code doesn't quite work. There is a java applet with quite readable source code available at: http://www.alpertron.com.ar/FSQUARES.HTM I was trying to implement the ideas at: http://www.schorn.ch/howto.html but I am out of time for now, maybe someone else can fi

[sage-support] Re: Sum of four square

2009-07-10 Thread Taxman
You could try to get the paper through your library or pay for it from Wiley. Here's the citation and link: http://www3.interscience.wiley.com/journal/113400834/abstract?CRETRY=1&SRETRY=0 --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@google

[sage-support] Re: Sum of four square

2009-07-10 Thread Minh Nguyen
Hi On Sat, Jul 11, 2009 at 12:30 AM, Santanu Sarkar wrote: > Is the algorithm for sum of four square i,e every positive integer > can be expressed as the sum of four square is implemented in > Sage If you're referring to Lagrange's four-square theorem, then Sage probably doesn't have it yet: