A class which makes possible various elementary polynomial math operations. Included are arithmetic methods like multiplication and division, (complex) root finding and evaluation at a specific point for arbitrary degree polynomials. All methods should work for real as well as complex coefficients.
Part of MathLib, a diverse library of mathematical functions.
/
operation for an example.Creates a new instance of Polynomial. Returned is a polynomial of a degree equal to the number of coefficients minus one.
aCollection 
The coefficients need to be supplied in increasing order: a_0, a_1, a_2 ... a_n1, a_n 
Expands an array of first degree binomial factors.
factors 
Factors to expand. 
Instance a reverse Bessel polynomial of the given degree.^{1}
degree 
Polynomial degree 
Synomyn for Object: class.
Returns the degree of the polynomial.
Returns true
if the polynomial is a monomial.
Returns true
if the polynomial is a binomial.
Calculate the product of two polynomials by convolving the original coefficient sequences.
Divide two polynomials using synthetic division. The degree of the numerator polynomial needs to be greater than or equal to the degree of the denominator polynomial.
An Array containing the remainder in the first slot and the quotient in the second slot, where: P(z) / D(z) = Q(z) + R(z) / D(z)
Calculate the n'th power of a polynomial. Negative, complex or fractional powers are allowed for binomials with the a_0 coefficient equal to one in order to calculate the binomial series which converges for: z < 1
Evaluate the polynomial at the (complex) point x.
Evaluate the polynomial and all of its derivatives at the (complex) point x.
An Array containing the results. Slot zero contains the function value and subsequent slots are filled with the values of all existing derivatives.
Find all the roots of the polynomial.
method 
Root finding method.

Laguerre's method works for polynomials with real as well as complex coefficients.
Another option is to use the Eigenvalue algorithm to form the companion matrix which eigenvalues coincide with the roots of the polynomial. Although this method is more reliable than the first one, it is considerably slower and only works for polynomials with real coefficients.
Michael Dzjaparidze, 2010. Joseph Anderson, 2019.