algfield.py

ApproxAlgNumber

The class is for algebraic number represented by characteristic polynomial and approximation value.

Initialize

ApproxAlgNumber(coefficient, approx,polynomial)

polynomial must be a monic irreducible polynomial defining the number field. coefficient must be a rational number list or an integer list . approx must be one of roots of polynomial.

Ex.1

>>> a = algfield.ApproxAlgNumber([1, 2], 1.4142, [-2, 0, 1])
>>> print a
ApproxAlgNumber(3.8284, [-7, -2, 1])

Attribute

coeff

integer coefficient of the algebraic number.

polynomial

defining polynomial of the number field.

degree

degree of the polynomial.

conj

roots of defined polynomial.

base_approx

given approximation value of roots of defined polynomial.

approx

approximation value of the algebraic number.

charpoly

characteristic polynomial of the algebraic number.

field

field defined by the polynomial.

Methods

trace()

Compute the trace of the algebraic number.

norm()

Compute the norm of the algebraic number.

ch_basic()

Change class to BasicAlgNumber.

ch_matrix()

Change class to MatAlgNumber.

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 be integer.