algfield.py

MatAlgNumber

The class is for algebraic number represented by matrix.

Initialize

MatAlgNumber(coefficient, polynomial)

polynomial must be a monic irreducible polynomial over Z defining the number field. coefficient must be a rational number list or an integer list.

Ex.1

>>> a=algfield.MatAlgNumber([1, 2], [-2, 0, 1])
>>> print a
MatAlgNumber([1, 2]+[4, 1], [-2, 0, 1])

Ex.2

>>> b=algfield.MatAlgNumber([Rational(1, 2), Rational(3, 2)], [-2, 0, 1])
>>> print b
MatAlgNumber([Rational(1, 2), Rational(3, 2)]+[Rational(3, 1),Rational(1, 2)], [-2, 0, 1])

Attribute

coeff

coefficient of the algebraic number.

degree

degree of the defining polynomial.

matrix

represent matrix of the algebraic number.

polynomial

defining polynomial of the field including the algebraic number.

field

field defined by the polynomial.

Methods

inverse()

Return the inverse of the algebraic number.

trace()

Compute the trace of the algebraic number.

norm()

Compute the norm of the algebraic number.

getRing()

Return the algebraic number field contained the algebraic number.

ch_basic()

Change class to BasicAlgNumber.

ch_approx(approx)

Change class to ApproxAlgNuber with approx.

Operations

operatorexplanation
a + bReturn a + b.
a - bReturn a - b.
a * bReturn a * b. a must be algebraic number or integer.
a / bReturn a / b. b must not be zero unit.
a ** bReturn a ** b. b must be integer.