4.4.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):

assign_names,$  $ base_field,$  $ base_ring,$  $ basis,$  $ characteristic,$  $ constants,$  $ gen,$  $ is_atomic_repr,$  $ is_field,$  $ name,$  $ names,$  $ ngens,$  $ random,$  $ set_gens,$  $ vector_space

These methods are defined as follows:

assign_names( s)

base_field( )

base_ring( )

basis( )

characteristic( )

constants( )

gen( i)

is_atomic_repr( )

is_field( )

name( )

names( )

ngens( )

random( [bound=0])

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.

vector_space( )

Instances of class Algebra also have the following special methods:

__call__( x)

__cmp__( other)

__contains__( x)

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