Hi, I've been trying to work with quaternion algebras in SAGE, but with rather mixed results. I'm not sure whether this is due to incomplete implementation or just to the fact that I'm doing things the wrong way.
Anyway, here are some examples: I define the quaternion algebra H over the rationals, ramified at 5 and infinity: >>>>> sage: H.<i,j,k> = QuaternionAlgebra(QQ, -5, -3) sage: H Quaternion algebra with generators (i, j, k) over Rational Field sage: H.ramified_primes() [5] <<<<< So far, so good. Here is one little problem: >>>>> sage: j/2 --------------------------------------------------------------------------- <type 'exceptions.TypeError'> Traceback (most recent call last) /home/ghitza/python/<ipython console> in <module>() /home/ghitza/python/element.pyx in element.RingElement.__div__() /home/ghitza/python/element.pyx in element.bin_op_c() <type 'exceptions.TypeError'>: unsupported operand parent(s) for '/': 'Quaternion algebra with generators (i, j, k) over Rational Field' and 'Integer Ring' <<<<< OK, I guess it's not a big deal; I could use 1/2*j instead and get what I want. Now I wish to define a particular order in H: >>>>> sage: basis = (1, 1/2*(1+j), 1/2*i*(1+j), 1/3*(1+i)*j) sage: QuaternionOrderWithBasis(ZZ, basis) --------------------------------------------------------------------------- <type 'exceptions.TypeError'> Traceback (most recent call last) /home/ghitza/python/<ipython console> in <module>() /opt/sage/local/lib/python2.5/site-packages/sage/algebras/ quaternion_order.py in QuaternionOrderWithBasis(R, B) 38 H = B[0].parent() 39 if not isinstance(H, QuaternionAlgebra_generic): ---> 40 raise TypeError, "Argument B (= %s) must be a sequence of quaternions."%B 41 return QuaternionOrder_generic(H, R, gens=B[1:], basis=B) 42 <type 'exceptions.TypeError'>: not all arguments converted during string formatting <<<<< It looks at the first basis element, in this case 1, and does not recognize it as being in H. Again, not a big deal. Let's try again: >>>>> sage: basis = (H(1), 1/2*(1+j), 1/2*i*(1+j), 1/3*(1+i)*j) sage: basis (1, 1/2 + 1/2*j, 1/2*i + 1/2*k, 1/3*j + 1/3*k) sage: QuaternionOrderWithBasis(ZZ, basis) --------------------------------------------------------------------------- <type 'exceptions.ArithmeticError'> Traceback (most recent call last) /home/ghitza/python/<ipython console> in <module>() /opt/sage/local/lib/python2.5/site-packages/sage/algebras/ quaternion_order.py in QuaternionOrderWithBasis(R, B) 39 if not isinstance(H, QuaternionAlgebra_generic): 40 raise TypeError, "Argument B (= %s) must be a sequence of quaternions."%B ---> 41 return QuaternionOrder_generic(H, R, gens=B[1:], basis=B) 42 43 def QuaternionDefiningOrder(H, R): /opt/sage/local/lib/python2.5/site-packages/sage/algebras/ quaternion_order.py in __init__(self, H, R, gens, basis) 64 An order in a quaternion algebra. 65 """ ---> 66 AlgebraOrder_generic.__init__(self, H, R, gens, basis=basis, rank=4) 67 68 def __call__(self, x, check=True): /opt/sage/local/lib/python2.5/site-packages/sage/algebras/ algebra_order.py in __init__(self, A, R, gens, basis, rank) 52 vecs = [ x.vector() for x in self.__algebra_basis_elements ] 53 # This syntax should change to V.submodule(R,vecs) ---> 54 self.__module = M.submodule(vecs) 55 56 def __repr__(self): /opt/sage/local/lib/python2.5/site-packages/sage/modules/ free_module.py in submodule(self, gens, check, already_echelonized) 1655 if check: 1656 if not V.is_submodule(self): -> 1657 raise ArithmeticError, "gens does not generate a submodule of self" 1658 return V 1659 <type 'exceptions.ArithmeticError'>: gens does not generate a submodule of self <<<<< Shouldn't this have worked? After a bit more experimenting, I notice that the problem seems to come from the fractions in the basis elements. For instance, the basis (H(1), i, j, k) works just fine. But shouldn't I be able to pick any 4 linearly independent elements in H and define the order they generate over Z? That's pretty much it. I'd be happy to try to fix these things (because I do need them), but I want to make sure that they're broken first. Thanks, Alex --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/ -~----------~----~----~----~------~----~------~--~---