11.1.18 Factoring
The collect command factors
polynomials over their coefficient fields or extensions of the fields.
-
collect takes one mandatory and one optional argument:
-
P, a polynomial or a list of polynomials.
- Optionally, α, a number, such as √n,
determining an extension field to the field of coefficients of
P.
- collect(P ⟨,α⟩) returns
the factored form of the polynomial (or list of polynomials), where
the factorization is done over the field of coefficients (such as
ℚ) or the smallest extension field containing α
(e.g. ℚ[α]). In complex mode (see Section 2.5.7),
the field is complexified.
The factor command (see 9.1.10) will also factor
polynomials over their coefficient fields (or extensions of it), but
will further factor each factor of degree 2 if the sqrt box is
checked in the CAS configuration.
Examples
Factor x2−4 over the integers.
Output (in real mode):
Factor x2+4 over the integers.
Output (in real mode):
Output (in complex mode):
Factor x2−2 over the rationals.
Output (in real mode):
But if you input:
you get:
|
| √ | | | ⎛
⎜
⎝ | x− | √ | | ⎞
⎟
⎠ | ⎛
⎜
⎝ | x+ | √ | | ⎞
⎟
⎠ |
| | | | | | | | | | |
|
Factor x3−2x2+1 and x2−x over the rationals.
collect([x^3-2*x^2+1,x^2-x]) |
|
| ⎡
⎣ | ⎛
⎝ | x−1 | ⎞
⎠ | ⎛
⎝ | x2−x−1 | ⎞
⎠ | ,x | ⎛
⎝ | x−1 | ⎞
⎠ | ⎤
⎦ |
| | | | | | | | | | |
|
but:
collect((x^3-2*x^2+1)*sqrt(5)) |
|
| √ | | | ⎛
⎜
⎜
⎝ | x+ | | ⎞
⎟
⎟
⎠ | ⎛
⎝ | x−1 | ⎞
⎠ | ⎛
⎜
⎜
⎝ | x+ | | ⎞
⎟
⎟
⎠ |
| | | | | | | | | | |
|
or:
collect(x^3-2*x^2+1,sqrt(5)) |
|
| ⎛
⎜
⎜
⎝ | x+ | | ⎞
⎟
⎟
⎠ | ⎛
⎝ | x−1 | ⎞
⎠ | ⎛
⎜
⎜
⎝ | x+ | | ⎞
⎟
⎟
⎠ |
| | | | | | | | | | |
|