Previous Up Next

11.1.18  Factoring

The collect command factors polynomials over their coefficient fields or extensions of the fields.

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.

collect(x^2-4)

Output (in real mode):

     

x−2

x+2
          

Factor x2+4 over the integers.

collect(x^2+4)

Output (in real mode):

     
x2+4           

Output (in complex mode):

     

x+2i

x−2i
          

Factor x2−2 over the rationals.

collect(x^2-2)

Output (in real mode):

     
x2−2           

But if you input:

collect(sqrt(2)*(x^2-2))

you get:

     
2
 

x
2




x+
2


          

Factor x3−2x2+1 and x2x over the rationals.

collect([x^3-2*x^2+1,x^2-x])
     


x−1

x2x−1
,x 
x−1

          

but:

collect((x^3-2*x^2+1)*sqrt(5))
     
5
 


x+
5
−1
2




x−1



x+
5
−1
2



          

or:

collect(x^3-2*x^2+1,sqrt(5))
     



x+
5
−1
2




x−1



x+
5
−1
2



          

Previous Up Next