#11464: Maximal orders in QuaternionAlgebra of prime discriminant has a bug
-----------------------------------------------------+----------------------
       Reporter:  mmasdeu                            |         Owner:  
craigcitro    
           Type:  defect                             |        Status:  closed   
     
       Priority:  major                              |     Milestone:  sage-5.0 
     
      Component:  modular forms                      |    Resolution:  fixed    
     
       Keywords:  maximal order, quaternion algebra  |   Work issues:           
     
Report Upstream:  N/A                                |     Reviewers:  David 
Loeffler
        Authors:  Marc Masdeu                        |     Merged in:  
sage-5.0.beta9
   Dependencies:                                     |      Stopgaps:           
     
-----------------------------------------------------+----------------------

Old description:

> In Sage 4.7 (and older) the following code enters an infinite loop:
> {{{
> #!python
> A.<i,j,k>=QuaternionAlgebra(17)
> O=A.maximal_order()
> }}}
> The maximal_order() function is essentially a formula, except for when
> the prime (here 17) is 1 mod 8. In that case there is a mistake in how
> the formula ought to be.
>
> It looks like the invariants as returned when starting from a Brandt
> module are in opposite order as when a QuaternionAlgebra is created by
> hand, and the code makes assumptions on that ordering.

New description:

 In Sage 4.7 (and older) the following code enters an infinite loop:
 {{{
 #!python
 A.<i,j,k>=QuaternionAlgebra(17)
 O=A.maximal_order()
 }}}
 The maximal_order() function is essentially a formula, except for when the
 prime (here 17) is 1 mod 8. In that case there is a mistake in how the
 formula ought to be.

 It looks like the invariants as returned when starting from a Brandt
 module are in opposite order as when a QuaternionAlgebra is created by
 hand, and the code makes assumptions on that ordering.

--

Comment (by daniels):

 It looks like the new code can still produce incorrect results if p is 1
 mod 8, e.g.:
 {{{
 sage: A.<i,j,k> = QuaternionAlgebra(17)
 sage: print A.invariants()
 (-3, -17)
 sage: R = A.maximal_order()
 sage: b = R.basis()
 sage: print b
 (1/2 + 1/2*j, 1/2*i + 1/2*k, -1/3*j - 1/3*k, k)
 sage: b[0]*b[1]
 9/2*i
 sage: (b[0]*b[1]).reduced_norm()
 243/4
 }}}
 so the "order" is not actually multiplicatively closed.

 The problem is that Pizer's formulas expect the invariants of the algebra
 to have a certain form, e.g.,
 {{{
 sage: A.<i,j,k> = QuaternionAlgebra(-17,-3)
 sage: print A.maximal_order().basis()
 (1/2 + 1/2*j, 1/2*i + 1/2*k, -1/3*j - 1/3*k, k)
 }}}
 seems to be correct. This could be fixed by simply swapping (i,j) in the
 formula depending on the invariants, but the invariants can deviate from
 the required form in more than one way, again possibly resulting in
 failure of the formula:

 {{{
 sage: A,<i,j,k> = QuaternionAlgebra(-17*9,-3)
 sage: R = A.maximal_order()
 sage: print A.maximal_order().basis()
 (1/2 + 1/2*j, 1/2*i + 1/2*k, -1/3*j - 1/3*k, k)
 sage: print (-1/3*j - 1/3*k).reduced_norm()
 154/3
 }}}

 I'm not sure what the best way is to fix this: Just throw a
 NotImplementedError if the invariants are not of the required form or try
 to compute an isomorphism?

 (PS: I've almost finished implementing a more general algorithm of Voight
 that would also work for non-prime discriminants, so perhaps not too much
 effort should be expended on this)

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11464#comment:4>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to