[sage-support] Re: [sage-devel] Re: [sage-support] Re: sage and sudoku

2007-02-05 Thread William Stein
On Mon, 05 Feb 2007 08:33:44 -0700, Alec Mihailovs [EMAIL PROTECTED] wrote: PS It would be interesting if your original code could be modified for producing an animation of the magic square - so that the numbers 1, 2, etc. appear in the matrix with some time interval between them. I wonder if

[sage-support] Re: [sage-devel] Re: [sage-support] Re: sage and sudoku

2007-02-04 Thread Justin C. Walker
On Feb 4, 2007, at 08:56 , Timothy Clemans wrote: Alec is your code suppose to be able to generate any nth normal magic square? sage: print magicsquare_normal(4) [ 9 15 1 7] [14 4 6 12] [ 3 5 11 13] [ 8 10 16 2] I think his code just deals with odd 'n' (witness the terms (1

[sage-support] Re: [sage-devel] Re: [sage-support] Re: sage and sudoku

2007-02-04 Thread Alec Mihailovs
Oh ok then in the code you should write n = 2*n-1 which means if n is 2 then 3 will be used. That's not the right way - the argument of the function should be the size of the square. If you want to avoid the case of even sizes, that could be done by testing the parity - something like if

[sage-support] Re: [sage-devel] Re: [sage-support] Re: sage and sudoku

2007-02-04 Thread Alec Mihailovs
From: Timothy Clemans [EMAIL PROTECTED] My function clearly stated magicsquare_normal_odd by being called that so its fine and I would just call yours that too. In the docstring I would say computes nth odd normal magic square. This function is for a special case of normal magic squares.

[sage-support] Re: [sage-devel] Re: [sage-support] Re: sage and sudoku

2007-02-03 Thread Alec Mihailovs
- Original Message - From: Timothy Clemans [EMAIL PROTECTED] def magicsquare_normal_odd(n): r Generates nth odd normal magic square for n greater than 1 using de la Loubere's method. EXAMPLES: sage: magicsquare_normal_odd(1) [8 1 6] [3 5 7]

[sage-support] Re: [sage-devel] Re: [sage-support] Re: sage and sudoku

2007-02-03 Thread Timothy Clemans
Wow! Now thats cool. I'm going to time test them. Thanks On 2/3/07, Alec Mihailovs [EMAIL PROTECTED] wrote: - Original Message - From: Timothy Clemans [EMAIL PROTECTED] def magicsquare_normal_odd(n): r Generates nth odd normal magic square for n greater than 1 using de

[sage-support] Re: [sage-devel] Re: [sage-support] Re: sage and sudoku

2007-02-03 Thread Alec Mihailovs
From: Timothy Clemans [EMAIL PROTECTED] Wow! Now thats cool. I'm going to time test them. Thanks I had some trouble with copying and pasting your procedure in SAGE (because I use it in Windows through cygwin and rxvt with Unix line endings and my email has Windows line endings and convert it

[sage-support] Re: [sage-devel] Re: [sage-support] Re: sage and sudoku

2007-02-02 Thread Timothy Clemans
OK I just figured out the coding on my own for following Loubere's strictly. I want to get the other 3 cases down then optimize them then make one magicsquare_normal function. def magicsquare_normal_odd(n): r Generates nth odd normal magic square for n greater than 1 using de la