<?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>factor(RingElement) -- factor a ring element</title> <link rel="stylesheet" type="text/css" href="../../../../Macaulay2/Style/doc.css"/> </head> <body> <table class="buttons"> <tr> <td><div><a href="_false.html">next</a> | <a href="_factor_lp__Module_rp.html">previous</a> | <a href="_false.html">forward</a> | <a href="_factor_lp__Module_rp.html">backward</a> | up | <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> <hr/> <div><h1>factor(RingElement) -- factor a ring element</h1> <div class="single"><h2>Synopsis</h2> <ul><li><div class="list"><dl class="element"><dt class="heading">Usage: </dt><dd class="value"><div><tt>factor x</tt></div> </dd></dl> </div> </li> <li><span>Function: <a href="_factor.html" title="factor a ring element or a ZZ-module">factor</a></span></li> <li><div class="single">Inputs:<ul><li><span><tt>x</tt>, <span>a <a href="___Ring__Element.html">ring element</a></span>, or <span>a <a href="___Q__Q.html">rational number</a></span> or <span>an <a href="___Z__Z.html">integer</a></span></span></li> </ul> </div> </li> <li><div class="single">Outputs:<ul><li><span><span>a <a href="___Product.html">product expression</a></span>, the factorization of <tt>x</tt></span></li> </ul> </div> </li> </ul> </div> <div class="single"><h2>Description</h2> <div><p>The result is a <a href="___Product.html" title="the class of all product expressions">Product</a> each of whose factors is a <a href="___Power.html" title="the class of all power expressions">Power</a> whose base is one of the factors found and whose exponent is an integer.</p> <table class="examples"><tr><td><pre>i1 : factor 124744878111332355674003415153753485211381849014286981744945 7 o1 = 3*5*53*2819 10861*10212222054939737109085868749 o1 : Expression of class Product</pre> </td></tr> <tr><td><pre>i2 : y = (2^15-4)/(2^15-5) 32764 o2 = ----- 32763 o2 : QQ</pre> </td></tr> <tr><td><pre>i3 : x = factor y 2 2 8191 o3 = -------- 3*67*163 o3 : Expression of class Divide</pre> </td></tr> <tr><td><pre>i4 : value x 32764 o4 = ----- 32763 o4 : QQ</pre> </td></tr> </table> <p>We may <a href="_peek.html" title="examine contents of an object">peek</a> inside <tt>x</tt> to a high depth to see its true structure as <a href="___Expression.html" title="the class of all expressions">Expression</a>.</p> <table class="examples"><tr><td><pre>i5 : peek'(100,x) o5 = Divide{Product{Power{2, 2}, Power{8191, 1}}, Product{Power{3, 1}, ------------------------------------------------------------------------ Power{67, 1}, Power{163, 1}}}</pre> </td></tr> </table> <p>For integers, factorization is done by <a href="_pari.html" title="">pari</a>, and the factors <i>x</i> are actually just pseudoprimes, as described in the documentation of <a href="_is__Pseudoprime_lp__Z__Z_rp.html" title="whether an integer is a pseudoprime">isPseudoprime</a>.</p> <p>For multivariate polynomials the factorization is done with code of Michael Messollen (see <a href="___Singular-__Libfac.html" title="">Singular-Libfac</a>). For univariate polynomials the factorization is in turn done with code of Gert-Martin Greuel and Ruediger Stobbe (see <a href="___Singular-__Factory.html" title="">Singular-Factory</a>).</p> <table class="examples"><tr><td><pre>i6 : R = ZZ/101[u] o6 = R o6 : PolynomialRing</pre> </td></tr> <tr><td><pre>i7 : factor (u^3-1) 2 o7 = (u - 1)(u + u + 1) o7 : Expression of class Product</pre> </td></tr> </table> The constant term is provided as the last factor, if it's not equal to 1.<table class="examples"><tr><td><pre>i8 : F = frac(ZZ/101[t]) o8 = F o8 : FractionField</pre> </td></tr> <tr><td><pre>i9 : factor ((t^3-1)/(t^3+1)) 2 (t - 1)(t + t + 1) o9 = ------------------- 2 (t + 1)(t - t + 1) o9 : Expression of class Divide</pre> </td></tr> </table> </div> </div> </div> </body> </html>