]>
The domain constructor UnivariatePolynomial (abbreviated UP) creates domains of univariate polynomials in a specified variable. For example, the domain UP(a1,POLY FRAC INT) provides polynomials in the single variable a1 whose coefficients are general polynomials with rational number coefficients.
Restriction:
Axiom does not allow you to create types where UnivariatePolynomial is contained in the coefficient type of Polynomial. Therefore, UP(x,POLY INT) is legal but POLY UP(x,INT) is not.
.
UP(x,INT) is the domain of polynomials in the single variable x with integer coefficients.
The usual arithmetic operations are available for univariate polynomials.
The operation leadingCoefficientleadingCoefficientUnivariatePolynomial extracts the coefficient of the term of highest degree.
The operation degreedegreeUnivariatePolynomial returns the degree of the polynomial. Since the polynomial has only one variable, the variable is not supplied to operations like degreedegreeUnivariatePolynomial.
The reductum of the polynomial, the polynomial obtained by subtracting the term of highest order, is returned by reductumreductumUnivariatePolynomial.
The operation gcdgcdUnivariatePolynomial computes the greatest common divisor of two polynomials.
The operation lcmlcmUnivariatePolynomial computes the least common multiple.
The operation resultantresultantUnivariatePolynomial computes the resultant of two univariate polynomials. In the case of p and q, the resultant is 0 because they share a common root.
To compute the derivative of a univariate polynomial with respect to its variable, use DDUnivariatePolynomial.
Univariate polynomials can also be used as if they were functions. To evaluate a univariate polynomial at some point, apply the polynomial to the point.
The same syntax is used for composing two univariate polynomials, i.e. substituting one polynomial for the variable in another. This substitutes q for the variable in p.
This substitutes p for the variable in q.
To obtain a list of coefficients of the polynomial, use coefficientscoefficientsUnivariatePolynomial.
From this you can use gcdgcdUnivariatePolynomial and reducereduceList to compute the content of the polynomial.
Alternatively (and more easily), you can just call contentcontentUnivariatePolynomial.
Note that the operation coefficientscoefficientsUnivariatePolynomial omits the zero coefficients from the list. Sometimes it is useful to convert a univariate polynomial to a vector whose -th position contains the degree i-1 coefficient of the polynomial.
To get a complete vector of coefficients, use the operation vectorisevectoriseUnivariatePolynomial, which takes a univariate polynomial and an integer denoting the length of the desired vector.
It is common to want to do something to every term of a polynomial, creating a new polynomial in the process.
This is a function for iterating across the terms of a polynomial, squaring each term.
Recall what p looked like.
We can demonstrate squareTerms on p.
When the coefficients of the univariate polynomial belong to a field,For example, when the coefficients are rational numbers, as opposed to integers. The important property of a field is that non-zero elements can be divided and produce another element. The quotient of the integers 2 and 3 is not another integer. it is possible to compute quotients and remainders.
When the coefficients are rational numbers or rational expressions, the operation quoquoUnivariatePolynomial computes the quotient of two polynomials.
The operation remremUnivariatePolynomial computes the remainder.
The operation dividedivideUnivariatePolynomial can be used to return a record of both components.
Now we check the arithmetic!
It is also possible to integrate univariate polynomials when the coefficients belong to a field.
One application of univariate polynomials is to see expressions in terms of a specific variable.
We start with a polynomial in a1 whose coefficients are quotients of polynomials in b1 and b2.
Since in this case we are not talking about using multivariate polynomials in only two variables, we use Polynomial. We also use Fraction because we want fractions.
We push all the variables into a single quotient of polynomials.
Alternatively, we can view this as a polynomial in the variable This is a mode-directed conversion: you indicate as much of the structure as you care about and let Axiom decide on the full type and how to do the transformation.
See ugProblemFactorPage in Section ugProblemFactorNumber for a discussion of the factorization facilities in Axiom for univariate polynomials. For more information on related topics, see ugIntroVariablesPage in Section ugIntroVariablesNumber , ugTypesConvertPage in Section ugTypesConvertNumber , PolynomialXmpPage , MultivariatePolynomialXmpPage , and DistributedMultivariatePolynomialXmpPage .