File r37/lisp/csl/html/r37_0151.html artifact 4748e38061 part of check-in 955d0a90a7



<A NAME=FACTORIZE>

<TITLE>FACTORIZE</TITLE></A>
<b><a href=r37_idx.html>INDEX</a></b><p><p>



<B>FACTORIZE</B> _ _ _  _ _ _  _ _ _  _ _ _ <B>operator</B><P>
<P>
 
 <P>
<P>
The <em>factorize</em> operator factors a given expression into a list of 
{factor,power} pairs. 
 <P> <H3> 
syntax: </H3>
<P>
<P>
<em>factorize</em>(&lt;expression&gt;) 
<P>
<P>
<P>
&lt;expression&gt; should be a polynomial, otherwise an error will result. 
<P>
<P>
 <P> <H3> 
examples: </H3>
<P><PRE><TT>

fff := factorize(x^3 - y^3); 

         2          2
  		  {{X  + X*Y + Y ,1},{X - Y,1}} 


fac1 := first fff; 

             2          2
  FAC1 := {{X  + X*Y + Y ,1} 


factorize(x^15 - 1); 

       8    7    6    5    4
   {{ X  - X  + X  - X  + X  - X + 1,1},
     4    3    2
   {X  + X  + X  + X + 1,1},
     2
   {X  + X + 1,1},
   {X - 1,1}}


lastone := part(ws,length ws); 

  	LASTONE := {X - 1,1} 


setmod 2; 

  1 


on modular; 

factorize(x^15 - 1); 

     4    3    2
  {{X  + X  + X  + X + 1,1},
     4    3
   {X  + X  + 1,1},
     4
   {X  + X + 1,1},
      2
   { X  + X + 1,1},
   {X + 1,1}}

</TT></PRE><P>The <em>factorize</em> command returns the factor,power pairs as a
 
<A HREF=r37_0053.html>list</A>. 
You can therefore use the usual list access methods (
<A HREF=r37_0046.html>first</A>, 

<A HREF=r37_0063.html>second</A>, 
<A HREF=r37_0066.html>third</A>, 
<A HREF=r37_0057.html>rest</A>, 
<A HREF=r37_0157.html>length</A> and 

<A HREF=r37_0169.html>part</A>) to extract these pairs. 
<P>
<P>
If the &lt;expression&gt; given to <em>factorize</em> is an integer, it will be 

factored into its prime components. To factor any integer factor of a 
non-numerical expression, the switch 
<A HREF=r37_0296.html>ifactor</A> should be turned on. 
Its default is off. 
<A HREF=r37_0296.html>ifactor</A> has effect only when factoring is 
explicitly done by <em>factorize</em>, not when factoring is automatically 
done with the 
<A HREF=r37_0287.html>factor</A> switch. If full factorization is not 
needed the switch 
<A HREF=r37_0301.html>limitedfactors</A> allows you to reduce the 
computing time of calls to <em>factorize</em>. 
<P>
<P>
Factoring can be done in a modular domain by calling <em>factorize</em> when 

<A HREF=r37_0305.html>modular</A> is on. You can set the modulus with the 
<A HREF=r37_0104.html>setmod</A> 
command. The last example above shows factoring modulo 2. 
<P>
<P>
For general comments on factoring, see comments under the switch 

<A HREF=r37_0287.html>factor</A>. 
<P>
<P>
<P>


REDUCE Historical
REDUCE Sourceforge Project | Historical SVN Repository | GitHub Mirror | SourceHut Mirror | NotABug Mirror | Chisel Mirror | Chisel RSS ]