Package Scientific :: Package Functions :: Module Polynomial :: Class Polynomial
[frames] | no frames]

Class Polynomial

Multivariate polynomial

Instances of this class represent polynomials of any order and in any number of variables. The coefficients and thus the values can be real or complex. Polynomials can be evaluated like functions.

Instance Methods
 
__add__(self, other)
number
__call__(self, *args)
Returns: the value of the polynomial at the given point
 
__coerce__(self, other)
 
__div__(self, other)
 
__init__(self, coefficients)
 
__mul__(self, other)
 
__rdiv__(self, other)
 
__repr__(self)
Polynomial
derivative(self, variable=0)
Returns: a polynomial of reduced order in one variable
Polynomial
integral(self, variable=0)
Returns: a polynomial of higher order in one variable
Numeric.array
zeros(self)
Find the zeros (roots) of the polynomial by diagonalization of the associated Frobenius matrix.
Class Variables
  is_polynomial = 1
Method Details

__call__(self, *args)
(Call operator)

 
Parameters:
  • args (tuple of numbers) - tuple of values, one for each variable of the polynomial
Returns: number
the value of the polynomial at the given point
Raises:
  • TypeError - if the number of arguments is not equal to the number of variable of the polynomial

__init__(self, coefficients)
(Constructor)

 
Parameters:
  • coefficients (Numeric.array or nested list of numbers) - an N-dimnesional array for a polynomial in N variables. coeffcients[i, j, ...] is the coefficient of x_1^i x_2^j ...

derivative(self, variable=0)

 
Parameters:
  • variable (int) - the index of the variable with respect to which the derivative is taken
Returns: Polynomial
a polynomial of reduced order in one variable

integral(self, variable=0)

 
Parameters:
  • variable (int) - the index of the variable with respect to which the integral is computed
Returns: Polynomial
a polynomial of higher order in one variable

zeros(self)

 

Find the zeros (roots) of the polynomial by diagonalization of the associated Frobenius matrix.

Returns: Numeric.array
an array containing the zeros
Raises:
  • ValueError - is the polynomial has more than one variable

Note: this is defined only for polynomials in one variable