Re: [sage-support] Matrices and Cyclotomics

2012-04-26 Thread Alastair Irving

On 25/04/2012 16:45, Graham Gerrard wrote:

Finding occasional inconsistencies when using matrices with cyclotomic
entries, though works well most of the time...

sage: s=CyclotomicField(24,'s').gen()
sage: (8*s^6-1)^10
-1098715216*s^6 - 372960063
sage: xb=matrix(1,1,[8*s^6-1])
sage: xb^10
[1036922553*s^6 - 372960063]

I can confirm this behaviour.


Above example is trivial computation, though problem recurs in several
contexts. I believe that scalar multiplication is correct and xb^10
incorrect.

Yes, I've checked with Magma and you're right.


Any suggestions?
Sage has a special algorithm for multiplying matrices over cyclotomic 
fields which works modulo primes and then does a Chinese remainder to 
put the answer together.  There is presumably a problem somewhere in 
this algorithm but I don't know where.  A rather unpleasant workaround 
is to do

xb.sparse_matrix()^10
Sage just uses a generic algorithm for multiplying the sparse matrices 
so this gives the correct answer.  However, the performance probably 
won't be as good.


Alastair

--
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] Matrices and Cyclotomics

2012-04-26 Thread Keshav Kini
On Friday, April 27, 2012 6:38:50 AM UTC+8, William Stein wrote:

 E.g., in sage-5.0-pre15: 

 sage: sage: s=CyclotomicField(24,'s').gen() 
 sage: sage: (8*s^6-1)^10 
 -1098715216*s^6 - 372960063 
 sage: sage: xb=matrix(1,1,[8*s^6-1]) 
 sage: sage: xb^10 
 [-1098715216*s^6 - 372960063] 


This statement may become false in the future, because 5.0.beta15 is still 
under construction.

-Keshav


Join us in #sagemath on irc.freenode.net !

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Matrices and Cyclotomics

2012-04-25 Thread Graham Gerrard
Finding occasional inconsistencies when using matrices with cyclotomic 
entries, though works well most of the time...

sage: s=CyclotomicField(24,'s').gen()
sage: (8*s^6-1)^10   
-1098715216*s^6 - 372960063
sage: xb=matrix(1,1,[8*s^6-1])   
sage: xb^10
[1036922553*s^6 - 372960063]

Above example is trivial computation, though problem recurs in several 
contexts.  I believe that scalar multiplication is correct and xb^10 
incorrect. Above example works OK when powers10.  

Any suggestions?

Graham

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org