4.5.1.1 Algebra Objects

class Algebra
Algebra( K, a, b, [c=None], [gens=0])

Returns the quaternion algebra over the field K with generators i and j and the following relations:

                i^2 = a       (!= 0)
                j^2 = b       (!= 0)
                i*j + j*i = c
A third generator is set to k = i*j.

Instances of class Algebra have the following methods (in addition to inherited methods and special methods):

set_gens

These methods are defined as follows:

set_gens( g)

Changes the chosen generators of self.

This function is mainly used by other easier-to-use constructors of quaternion algebras.

INPUT:
    g -- list of three elements of self, such that the
         K-vector space spanned by 1, g[0], g[1], g[2] is of
         dimension 4.
          
OUTPUT:
    This function changes self by making the elements of g the
    generators.  Elements are printed in terms of the gi.  The
    names used to represent the gi are same as were used
    before calling set_gens.  To change them, use the
    assign_names function.

sage: A = QuaternionAlgebra(RationalField(), -1,-7)
sage: i,j,k = A.gens()
sage: i
i
sage: j**2
-7
sage: (k+i)**2
-8

The underlying vector that represents j:

sage: j.vector()
(0 0 1 0)

Now if we change generators by swapping i and j, then the 0th generator will have square -7, since it is really what we called j above.

sage: A.set_gens([j,i,k+i])
sage: i
j

It's a good idea to either assign the gens to the your variables, or change the names of your variables.

sage: i,j,k = A.gens()
sage: i**2
-7
sage: i
i
sage: i*j
j - k
sage: k**2
-8

The underlying vector does not change:

sage: i.vector()
(0 0 1 0)

The difference is that now A.gen(0) is j, A.gen(1) is i, and elements are printed in terms of these generators.

See About this document... for information on suggesting changes.