<?xml version="1.0" encoding="utf-8" ?> <!-- for emacs: -*- coding: utf-8 -*- --> <!-- Apache may like this line in the file .htaccess: AddCharset utf-8 .html --> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg-flat.dtd" > <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head><title>factoring polynomials</title> <link rel="stylesheet" type="text/css" href="../../../../Macaulay2/Style/doc.css"/> </head> <body> <table class="buttons"> <tr> <td><div><a href="_fraction_spfields.html">next</a> | <a href="_manipulating_sppolynomials.html">previous</a> | <a href="_fraction_spfields.html">forward</a> | <a href="_manipulating_sppolynomials.html">backward</a> | <a href="_rings.html">up</a> | <a href="index.html">top</a> | <a href="master.html">index</a> | <a href="toc.html">toc</a> | <a href="http://www.math.uiuc.edu/Macaulay2/">Macaulay2 web site</a></div> </td> </tr> </table> <div><a href="index.html" title="">Macaulay2Doc</a> > <a href="_rings.html" title="">rings</a> > <a href="_factoring_sppolynomials.html" title="">factoring polynomials</a></div> <hr/> <div><h1>factoring polynomials</h1> <div>Polynomials can be factored with <a href="_factor.html" title="factor a ring element or a ZZ-module">factor</a>. Factorization works in polynomial rings over prime finite fields, ZZ, or QQ.<table class="examples"><tr><td><pre>i1 : R = ZZ/10007[a,b];</pre> </td></tr> <tr><td><pre>i2 : f = (2*a+3)^4 + 5 4 3 2 o2 = 16a + 96a + 216a + 216a + 86 o2 : R</pre> </td></tr> <tr><td><pre>i3 : g = (2*a+b+1)^3 3 2 2 3 2 2 o3 = 8a + 12a b + 6a*b + b + 12a + 12a*b + 3b + 6a + 3b + 1 o3 : R</pre> </td></tr> <tr><td><pre>i4 : S = factor f 2 o4 = (a - 402)(a + 405)(a + 3a - 2301)(16) o4 : Expression of class Product</pre> </td></tr> <tr><td><pre>i5 : T = factor g 3 o5 = (a - 5003b - 5003) (8) o5 : Expression of class Product</pre> </td></tr> </table> <p/> The results have been packaged for easy viewing. The number of factors is obtained using<table class="examples"><tr><td><pre>i6 : #T o6 = 2</pre> </td></tr> </table> Each factor is represented as a power (exponents equal to 1 don't appear in the display.) The parts can be extracted with <a href="__sh.html" title="length, or access to elements">#</a>.<table class="examples"><tr><td><pre>i7 : T#0 3 o7 = (a - 5003b - 5003) o7 : Expression of class Power</pre> </td></tr> <tr><td><pre>i8 : T#0#0 o8 = a - 5003b - 5003 o8 : R</pre> </td></tr> <tr><td><pre>i9 : T#0#1 o9 = 3</pre> </td></tr> </table> </div> </div> </body> </html>