我想根据 Sagemath 中的特定基找到四元数顺序中元素的特定表示。我可以检查该元素是否包含在顺序中,但我不知道如何在不写出矩阵然后要求 Sage 求解整数上的线性系统的情况下找到具体的表示。显然,这并不理想,而且重现性不太好。下面是一个示例(在这种情况下,表达式确实微不足道,但我希望能够在它不微不足道的情况下动态地执行此操作):
sage: Bpinf.<i,j,k> = QuaternionAlgebra(-39, -53)
sage: O = Bpinf.maximal_order()
sage: j in O
True
sage: O.basis()
(1, 1/2 + 1/2*i, j, 1/2 + 31/78*i + 1/2*j + 1/78*k)
sage: O(j).coefficients()
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In [105], line 1
----> 1 O(j).coefficients()
File ~/sage/sage/src/sage/structure/element.pyx:494, in sage.structure.element.Element.__getattr__()
492 AttributeError: 'LeftZeroSemigroup_with_category.element_class' object has no attribute 'blah_blah'
493 """
--> 494 return self.getattr_from_category(name)
495
496 cdef getattr_from_category(self, name):
File ~/sage/sage/src/sage/structure/element.pyx:507, in sage.structure.element.Element.getattr_from_category()
505 else:
506 cls = P._abstract_element_class
--> 507 return getattr_from_other_class(self, cls, name)
508
509 def __dir__(self):
File ~/sage/sage/src/sage/cpython/getattr.pyx:361, in sage.cpython.getattr.getattr_from_other_class()
359 dummy_error_message.cls = type(self)
360 dummy_error_message.name = name
--> 361 raise AttributeError(dummy_error_message)
362 attribute = <object>attr
363 # Check for a descriptor (__get__ in Python)
AttributeError: 'sage.algebras.quatalg.quaternion_algebra_element.QuaternionAlgebraElement_rational_field' object has no attribute 'coefficients'
我尝试在这里使用
.coefficients()
,因为该方法出现在 Modules with Basis 类别中,并且可以执行我想要的操作,但四元数顺序似乎不是从该类别继承的。有谁知道一个内置的方法来做到这一点?
这并不完全是“内置的”,但我认为它可以满足您的需求:
sage: Bpinf.<i,j,k> = QuaternionAlgebra(-39, -53)
sage: O = Bpinf.maximal_order()
sage: B = [vector(v) for v in O.basis()]
sage: V = QQ**4
现在定义一个具有指定基础的“子模块”(实际上只是
V
),以在确定系数时强制使用该基础:
sage: W = V.submodule_with_basis(B)
sage: W.coordinate_vector(i.coefficient_tuple())
(-1, 2, 0, 0)
sage: W.coordinate_vector(j.coefficient_tuple())
(0, 0, 1, 0)
sage: W.coordinate_vector(k.coefficient_tuple())
(-8, -62, -39, 78)