polylib::divisors -- divisors
of a polynomial, polynomial expression, or Factored
element
Introductionpolylib::divisors(p) computes the set of
all monic divisors of the polynomial or polynomial expression
p.
Call(s)polylib::divisors(p)
polylib::divisors(f)
polylib::divisors(e)
Parametersp |
- | a polynomial or polynomial expression |
f |
- | Factored (return value of
factor) |
e |
- | element of a domain of category Cat::Polynomial |
Returnspolylib::divisors returns a set of polynomials. The
polynomials are from the same type as the polynomials in the
argument.
Related
FunctionsCat::Polynomial,
DOM_POLY, Dom::Polynomial, Dom::MultivariatePolynomial,
Dom::UnivariatePolynomial,
factor, irreducible, numlib::divisors, polylib::sqrfree
Detailspolylib::divisors(f) returns all monic
divisors of a pre-factored polynomial. Cf. example 3.polylib::divisors works on polynomials of category
Cat::Polynomial as
well. Cf. example 4.
Example
1If the argument is a polynomial, a set of polynomials is returned:
>> polylib::divisors(poly(x^2 - 2*x + 1))
2
{poly(1, [x]), poly(x - 1, [x]), poly(x - 2 x + 1, [x])}
Example
2If the argument is a polynomial expression, a set of polynomial expressions is returned:
>> polylib::divisors(x^2 - 1)
2
{1, x - 1, x + 1, x - 1}
Example
3If the argument is of type Factored (a factor return value) a set of
polynomials is returned:
>> p := factor(poly(x^2 - 1)); polylib::divisors(p)
poly(x - 1, [x]) poly(x + 1, [x])
{poly(1, [x]), poly(x - 1, [x]), poly(x + 1, [x]),
2
poly(x - 1, [x])}
The polynomials in the resulting set have the same type
as the polynomials in the Factored element:
>> p := factor(x^2 - 1); polylib::divisors(p)
(x - 1) (x + 1)
2
{1, x - 1, x + 1, x - 1}
Example
4polylib::divisors works on polynomials from
category Cat::Polynomial as well:
>> P := Dom::Polynomial(Dom::IntegerMod(7)): polylib::divisors(P(x^3 + 2*x^2 + 1))
3 2
{1 mod 7, (1 mod 7) x + (2 mod 7) x + (1 mod 7)}