## `polylib::sqrfree` -- square-free factorization of polynomials

#### Introduction

`polylib::sqrfree``(f)` returns the square-free factorization of `f`, that is, a factorization of f in the form f = u * p1^e1 * ... * pr^er with primitive and pairwise different square-free divisors pi.

#### Call(s)

`polylib::sqrfree(f <, recollect>)`

#### Parameters

`f` | - | a polynomial or an arithmetical expression
`recollect` | - | `TRUE` or `FALSE`

#### Returns

a factored object, i.e., an object of the domain type `Factored`.

#### Related Functions

`content`, `factor`, `Factored`, `irreducible`, `polylib::primpart`

#### Details

- `polylib::sqrfree``(f)` returns the square-free factorization of the polynomial f, that is, a factorization of f in the form f = u * f1^e1 * ... * fr^er with primitive and pairwise different square-free divisors fi (i.e., gcd(fi,fj) = 1 for i <> j). u

  is a unit of the coefficient ring of f, and ei are positive integers.

- The result of `polylib::sqrfree` is an object of the domain type `Factored`. Let `g:= polylib::sqrfree(f)` be such an object. It is represented internally as the list `[u, f1, e1, ..., fr, er]` of odd length (= r+1).

  You may extract the unit u, the factors fi as well as the exponents ei] by the ordinary index operator `[ ]`, i.e., `g[1] = u, g[2] = f1, g[3] = e1, ...`.

  For example, to extract all square-free divisors of f, enter `g[2*i] $ i = 1..nops(g) div 2`. The same can be achieved with the call `Factored::factors( g )`, and `Factored::exponents( g )` returns a list of the exponents ei (1<=i<=r) of the square-free factorization of f.

  The call `convert( g,DOM_LIST )` gives the internal representation of a factored object, i.e., the list as described above.

  Note that the result of `polylib::sqrfree` is printed as an expression and behaves like that. As an example, the result of `polylib::sqrfree( x^2+2*x+1 )` is the object printed as `(x+1)^2` which is of type `"_power"`.

  Please read the help page of `Factored` for details.

- The call `polylib::sqrfree``(f, FALSE)` returns a square-free factorization of `f`, where the exponents ei need not be pairwise different.
- `polylib::sqrfree` can handle univariate and multivariate polynomials over `Expr`, residue class rings `IntMod(p)` with prime modulus `p`, domains representing a unique factorization domain of characteristic zero, and finite fields.
- If the argument of `polylib::sqrfree` is an expression, its numerator and denominator are converted into polynomials in all occurring indeterminates.

  These polynomials are regarded as polynomials over some extension of the rational numbers (i.e., over `Expr`, see `poly`). The choice of that extension follows the same rules as in the case of the function `factor`.

  Factors of the denominator of an expression are indicated by negative multiplicities.

#### Example 1

The factors in a squarefree factorization are pairwise relatively prime, but they need not be irreducible:

    >> polylib::sqrfree(
         2 - 2*x - 6*x^4 + 6*x^5 + 6*x^8 - 6*x^9 -2*x^12 + 2*x^13
       )

                                    4       2    3     3
                           2 (x - 1)  (x + x  + x  + 1)

#### Example 2

Even if a factorization into irreducibles has been found, irreducible factors with the same multiplicity are collected again:

    >> polylib::sqrfree( x^6 + x^4*y*6 + x^2*y^2*9 )

                                             2  2
                                  (x (3 y + x ))

You can avoid this by giving a second argument:

    >> polylib::sqrfree( x^6 + x^4*y*6 + x^2*y^2*9, FALSE)

                                   2         2 2
                                  x  (3 y + x )

#### Example 3

`polylib::sqrfree` works also for polynomials:

    >> polylib::sqrfree( poly(2 + 5*x + 4*x^2 + x^3) )

                                        2
                        poly(x + 1, [x])  poly(x + 2, [x])

#### Changes

- used to be called `sqrfree`
- the return value of `polylib::sqrfree` is an object of the domain `Factored`.

Do you have questions or comments?
Copyright © SciFace Software GmbH & Co. KG 2000