algfield.py

BasicAlgNumber

The class is for algebraic number represented by coefficient of standard basis.

Initialize

BasicAlgNumber(valuelist, polynomial)

polynomial must be a monic irreducible polynomial defining the number field. type of polynomial must be a list. valuelist is made from integer coefficient and denominator for standard basis.

Ex.1

>>> a = algfield.BasicAlgNumber([[1, 1], 1], [-3, 0, 1])
>>> print a
BasicAlgNumber([[1, 1], 1], [-3, 0, 1])

Ex.2

>>> b = algfield.BasicAlgNumber([[0, 1, 1], 2], [-2, 0, 0, 1])
>>> print b
BasicAlgNumber([[0, 1, 1], 2], [-2, 0, 0, 1])

Attribute

value

integer coefficient and denominator.

coeff

integer coefficient of the algebraic number.

denom

denominator of the algebraic number.

polynomial

defining polynomial of the field including the algebraic number.

degree

degree of the polynomial.

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.

isAlgInteger()

Determine whether the algebraic number is an algebraic integer or not.

ch_matrix()

Change class to MatAlgNumber.

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.