The Math_Polynomial class represents simple polynomials of the form: ax^n + bx^(n-1) + cx^(n-2) + ... yx + z
Methods having a Polynomial or mixed type as a parameter should be able to take either a string representation of a polynomial or a Polynomial object as a parameter. Simple algebraic operations on polynomials are supported using the following methods:
add() Add another polynomial to the current polynomial
subtract() Subtract another polynomial from the current polynomial
multiply() Multiply the current polynomial by another polynomial
divide() Divide the current polynomial by another polynomial
mod() Perform the 'mod' function ( get the remainder of poly. division )
Other operations include:
getDerivative(x) Get the nth derivative of the Polynomial
degree() Get the degree ( highest exponent )
evaluate(x) Evaluate the polynomial at a given x value
String representation of the Polynomial object can be retrieved with the toString() method.
Examines each term of the Polynomial and, if any of the terms have equivalent exponents, adds the two terms together ( add coefficients, keep the same exponent ) This is used to simplify the Polynomial for output.