Polynomials Suite

All the scripts of the package deal with real coefficients polynomials in one varaible.
A polynomial is stored in a vector whose the first term is the coefficient of the highest degree term of the polynomial, e.g. ax^3+bx^2+cx+d is stored as {a,b,c,d}.
Even if some terms are null they must be padded with zeros e.g. x^4 + x^2 must be stored as {1,0,1,0,0}
Some scripts allow a optional tolerance term eps for taking care of the roundoff errors in operations
Function Description
Poly Poly(v)

Creates a polynomial with the roots specified in v. The coefficients of the polynomial are returned as a matrix with the coefficient of the highest order term stored in the first element.

Note 1: complex roots must be specified in pairs of conjugate complex numbers
Note 2: this script performs the same operation of the one in the Controls package, using a different algorithm.
PolyVal PolyVal(coeffs,x)

Evaluates the polynomial whose coefficients are in coeffs at the values in x using the Horner's Rule.

Note : this script performs the same operation of the one in the Controls package, using a different algorithm.
PolyQuadrRoots PolyQuadrRoots(p)

Finds the roots of the 2nd degree polynomial p using the quadratic formula.
PolyCubicRoots PolyCubicRoots(p)

Finds all the roots of the 3rd degree polynomial p using the exact formula.
PolyQuartRoots PolyCubicRoots(p)

Finds all the roots of the 4th degree polynomial p using the exact formula.
PolyExactRoots PolyExactRoots(p)

Finds the roots of any polynomial p of degree <= 4 using the appropriate formula.
PolyAdd PolyAdd(p,q,eps)

Sums the 2 given polynomials p and q.
The higher degree coefficients less or equal to the optional value eps are set to 0 and thus removed from the result. The default for eps is 1E-9.
PolyMul PolyMul(p,q,eps)

Multiplies the 2 given polynomials p and q.
The higher degree coefficients less or equal to the optional value eps are set to 0 and thus removed from the result. The default for eps is 1E-9.


Note : this script performs the same operation of Conv.mtw of the Controls package.
PolyDiv PolyDiv(p,q,"rem")

Computes the quotient of the division of p by q.
The remainder is stored in the optional global variable rem.


Note : This script performs the same operations of Deconv.mtw of the Filters package using a different algorithm.
PolyRem PolyRem(p,q)

Computes the remainder from the division of p by q.
PolyPow PolyPow(p,n,eps)

Returns the nth (n positive integer) power of the polynomial p.
The higher degree coefficients less or equal to the optional value eps are set to 0. The default for eps is 1E-9.
PolyGCD PolyGCD(p,q)

Computes the Greatest Common Divisor of the two polynomials p and q.
PolyLCM PolyLCM(p,q)

Computes the Least Common Multiple of the two polynomials p and q.
PolyDer PolyDer(p)

Computes the analytic 1st order derivative of the given polynomial p.
PolyInt PolyInt(p,a,b)

Returns the analytic integral of the given polynomial p.

If only p is given the result is the indefinite integral wirh the constant term = 1.
If a is given it will be the value of the constant term.
If both a and b are given the result will be the definite integral from a to b.

© 2007 Stefano Bertolucci