Package InversionTest :: Module PolynomialOperations
[hide private]
[frames] | no frames]

Module PolynomialOperations

Basic univariate polynomial multiplication and division Polynomials are represented as sequences of coefficients, where the highest coefficient of an expression is stored at index=0. So then, [1, 5, 3] = (x^2 + 5x + 3).

This implementation of expansion (multiplication) is more robust than its division counterpart. While expansion should work for any set of expressions, the division will only work for monic polynomials.

Author: Benjamin D. Nye License: Apache License V2.0

Functions [hide private]
list of int
polynomialExpansion(*coefficients)
Expand lists of coefficients for univariate polynomials into a single list of coefficients for the expanded polynomial
list of int or float
removeEmptyTerms(series, removeFromHead=True)
Remove leading (head) or trailing (tail) zeros from an expression.
tuple of (list of int, list of int)
syntheticDivision(numerator, divisor)
Perform a polynomial division using syntethic division Returns the new coefficients in two parts: quotient and remainder WARNING: Only works for monic polynomials
Variables [hide private]
  __loader__ = <zipimporter object "C:\Python27\lib\site-package...
  __package__ = None
Function Details [hide private]

polynomialExpansion(*coefficients)

 

Expand lists of coefficients for univariate polynomials into a single list of coefficients for the expanded polynomial

Parameters:
  • coefficients (list of list of int) - Lists of integer coefficients
Returns: list of int
Single list of coefficients for the expanded polynomial

removeEmptyTerms(series, removeFromHead=True)

 

Remove leading (head) or trailing (tail) zeros from an expression. This is needed to properly evaluate the actual terms in the expression.

Parameters:
  • series (list of int or float) - Series of coefficients
  • removeFromHead (bool) - If True, remove zeroes from start of series; else, remove from tail.
Returns: list of int or float
Series with zero-padding removed

syntheticDivision(numerator, divisor)

 

Perform a polynomial division using syntethic division Returns the new coefficients in two parts: quotient and remainder WARNING: Only works for monic polynomials

Parameters:
  • numerator (list of int) - Coefficients for the numerator
  • divisor (list of int) - Coefficients of the divisor
Returns: tuple of (list of int, list of int)
Quotient (whole part) and remainder of division. Note: remainder contains only the numberator part

Variables Details [hide private]

__loader__

Value:
<zipimporter object "C:\Python27\lib\site-packages\inversiontest-1.1-p\
y2.7.egg\InversionTest\">