=================================================================== RCS file: /home/cvs/OpenXM/src/asir-doc/parts/algnum.texi,v retrieving revision 1.1.1.1 retrieving revision 1.8 diff -u -p -r1.1.1.1 -r1.8 --- OpenXM/src/asir-doc/parts/algnum.texi 1999/12/08 05:47:44 1.1.1.1 +++ OpenXM/src/asir-doc/parts/algnum.texi 2007/02/15 02:41:38 1.8 @@ -1,17 +1,41 @@ +@comment $OpenXM: OpenXM/src/asir-doc/parts/algnum.texi,v 1.7 2003/04/20 08:01:24 noro Exp $ +\BJP @node $BBe?tE*?t$K4X$9$k1i;;(B,,, Top @chapter $BBe?tE*?t$K4X$9$k1i;;(B +\E +\BEG +@node Algebraic numbers,,, Top +@chapter Algebraic numbers +\E @menu +\BJP * $BBe?tE*?t$NI=8=(B:: +* $BJ,;6B?9`<0$K$h$kBe?tE*?t$NI=8=(B:: * $BBe?tE*?t$N1i;;(B:: * $BBe?tBN>e$G$N(B 1 $BJQ?tB?9`<0$N1i;;(B:: * $BBe?tE*?t$K4X$9$kH!?t$N$^$H$a(B:: +\E +\BEG +* Representation of algebraic numbers:: +* Representation of algebraic numbers by distributed polynomials:: +* Operations over algebraic numbers:: +* Operations for uni-variate polynomials over an algebraic number field:: +* Summary of functions for algebraic numbers:: +\E @end menu +\BJP @node $BBe?tE*?t$NI=8=(B,,, $BBe?tE*?t$K4X$9$k1i;;(B @section $BBe?tE*?t$NI=8=(B +\E +\BEG +@node Representation of algebraic numbers,,, Algebraic numbers +@section Representation of algebraic numbers +\E @noindent +\BJP @b{Asir} $B$K$*$$$F$O(B, $BBe?tBN$H$$$&BP>]$ODj5A$5$l$J$$(B. $BFHN)$7$?BP>]$H$7$FDj5A$5$l$k$N$O(B, $BBe?tE*?t$G$"$k(B. $BBe?tBN$O(B, $BM-M}?tBN$K(B, $BBe?tE*?t$rM-8B8D(B @@ -19,6 +43,23 @@ $B$3$l$^$GDj5A$5$l$?Be?tE*?t$NB?9`<0$r78?t$H$9$k(B 1 $BJQ?tB?9`<0(B $B$rDj5AB?9`<0$H$7$FDj5A$5$l$k(B. $B0J2<(B, $B$"$kDj5AB?9`<0$N:,$H$7$F(B $BDj5A$5$l$?Be?tE*?t$r(B, @code{root} $B$H8F$V$3$H$K$9$k(B. +\E +\BEG +In @b{Asir} algebraic number fields are not defined +as independent objects. +Instead, individual algebraic numbers are defined by some +means. In @b{Asir} an algebraic number field is +defined virtually as a number field obtained by adjoining a finite number +of algebraic numbers to the rational number field. + +A new algebraic number is introduced in @b{Asir} in such a way where +it is defined as a root of an uni-variate polynomial +whose coefficients include already defined algebraic numbers +as well as rational numbers. +We shall call such a newly defined algebraic number a @b{root}. +Also, we call such an uni-variate polynomial the defining polynomial +of that @b{root}. +\E @example [0] A0=newalg(x^2+1); @@ -30,42 +71,100 @@ @end example @noindent +\BJP $B$3$NNc$G$O(B, @code{A0} $B$O(B @code{x^2+1=0} $B$N:,(B, @code{A1} $B$O(B, $B$=$N(B @code{A0} $B$r78?t$K4^$`(B @code{x^3+A0*x+A0=0} $B$N:,$H$7$FDj5A$5$l$F$$$k(B. +\E +\BEG +In this example, the algebraic number assigned to @code{A0} is defined +as a @b{root} of a polynomial @code{x^2+1}; +that of @code{A1} is defined as a @b{root} of a polynomial +@code{x^3+A0*x+A0}, which you see contains the previously defined +@b{root} (@code{A0}) in its coefficients. +\E @noindent -@code{newalg()} $B$N0z?t$9$J$o$ADj5AB?9`<0$K$Oe$G4{Ls$G$J$1$l$P$J$i$J$$(B. +\E +\BEG +A defining polynomial must be irreducible over the field that is obtained +by adjoining all @b{root}'s contained in its coefficients +to the rational number field. +\E @end enumerate @noindent +\BJP @code{newalg()} $B$,9T$&0z?t%A%'%C%/$O(B, 1 $B$*$h$S(B 2 $B$N$_$G$"$k(B. $BFC$K(B, $B0z?t$NDj5AB?9`<0$N4{Ls@-$OA4$/%A%'%C%/$5$l$J$$(B. $B$3$l$O(B $B4{Ls@-$N%A%'%C%/$,B?Bg$J7W;;NL$rI,MW$H$9$k$?$a$G(B, $B$3$NE@$K4X$7$F$O(B, $B%f!<%6$N@UG$$KG$$5$l$F$$$k(B. +\E +\BEG +Only the first two conditions (1 and 2) are checked +by function @code{newalg()}. +Among all, it should be emphasized that no check is done for the +irreducibility at all. +The reason is that the irreducibility test requires enormously much +computation time. You are trusted whether to check it at your own risk. +\E @noindent +\BJP $B0lC6(B @code{newalg()} $B$K$h$C$FDj5A$5$l$?Be?tE*?t$O(B, $B?t$H$7$F$N<1JL;R$r;}$A(B, $B$^$?(B, $B?t$NCf$G$OBe?tE*?t$H$7$F$N<1JL;R$r;}$D(B. (@code{type()}, @code{vtype()} $B;2>H(B.) $B$5$i$K(B, $BM-M}?t$H(B, @code{root} $B$NM-M}<0$bF1MM$KBe?tE*?t$H$J$k(B. +\E +\BEG +Once a @b{root} has been defined by @code{newalg()} function, +it is given the type identifier for a number, and furthermore, +the sub-type identifier for an algebraic number. +(@xref{type}, @ref{ntype}.) +Also, any rational combination of rational numbers and @b{root}'s +is an algebraic number. +\E @example [87] N=(A0^2+A1)/(A1^2-A0-1); @@ -75,12 +174,25 @@ @end example @noindent +\BJP $BNc$+$i$o$+$k$h$&$K(B, @code{root}$B$O(B @code{#@var{n}} $B$HI=<($5$l$k(B. $B$7$+$7(B, $B%f!<%6$O$3$N7A$G$OF~NO$G$-$J$$(B. @code{root} $B$O(B $BJQ?t$K3JG<$7$FMQ$$$k$+(B, $B$"$k$$$O(B @code{alg(@var{n})} $B$K$h$j$l(B @code{#0}, @code{#1} $B$K(B $BBP1~$9$kITDj85$G$"$k(B. $B$3$l$i$b%f!<%6$,F~NO$9$k$3$H$O$G$-$J$$(B. @code{var()} $B$G/?t$G(B, $BBgItJ,$O%f!<%6Dj5AH!?t$K$h$jo$KMQ$$$k$J$i$P(B, @samp{$HOME/.asirrc} $B$K=q$$$F$*$/$N$b$h$$(B. +\JP $B$"$k$$$O(B, $B>o$KMQ$$$k$J$i$P(B, @samp{$HOME/.asirrc} $B$K=q$$$F$*$/$N$b$h$$(B. +\BEG +Or if you always need them, it is more convenient to include the +@code{load} commands in @samp{$HOME/.asirrc}. +\E @noindent +\BJP @code{root} $B$O(B $B$=$NB>$N?t$HF1MM(B, $B;MB'1i;;$,2DG=$H$J$k(B. $B$7$+$7(B, $BDj5AB?(B $B9`<0$K$h$k4JC12=$O<+F0E*$K$O9T$o$l$J$$$N$G(B, $B%f!<%6$NH=CG$GE,599T$o(B $B$J$1$l$P$J$i$J$$(B. $BFC$K(B, $BJ,Jl$,(B 0 $B$K$J$k>l9g$KCWL?E*$J%(%i!<$H$J$k$?$a(B, $Bl9g$K$O:Y?4$NCm0U$,I,MW$H$J$k(B. +\E +\BEG +Like the other numbers, algebraic numbers can get arithmetic operations +applied. Simplification, however, by defining polynomials are +not automatically performed. It is left to users to simplify their +expressions. A fatal error shall result if the denominator expression +will be simplified to 0. Therefore, be careful enough when you +will create and deal with algebraic numbers which may denominators +in their expressions. +\E -@noindent -$BBe?tE*?t$N(B, $BDj5AB?9`<0$K$h$k4JC12=$O(B, @code{simpalg()} $B$G9T$&(B. +\JP $BBe?tE*?t$N(B, $BDj5AB?9`<0$K$h$k4JC12=$O(B, @code{simpalg()} $B$G9T$&(B. +\BEG +Use @code{simpalg()} function for simplification of algebraic numbers +by defining polynomials. +\E @example [49] T=A0^2+1; @@ -147,7 +313,11 @@ t#0 @end example @noindent -@code{simpalg()} $B$OM-M}<0$N7A$r$7$?Be?tE*?t$r(B, $BB?9`<0$N7A$K4JC12=$9$k(B. +\JP @code{simpalg()} $B$OM-M}<0$N7A$r$7$?Be?tE*?t$r(B, $BB?9`<0$N7A$K4JC12=$9$k(B. +\BEG +Function @code{simpalg()} simplifies algebraic numbers which have +the same structures as rational expressions in their appearances. +\E @example [39] A0=newalg(x^2+1); @@ -166,21 +336,42 @@ stopped in invalgp at line 258 in file "/usr/local/lib @end example @noindent +\BJP $B$3$NNc$G$O(B, $BJ,Jl$,(B 0 $B$NBe?tE*?t$r4JC12=$7$h$&$H$7$F(B 0 $B$K$h$k=|;;$,@8$8(B $B$?$?$a(B, $B%f!<%6Dj5AH!?t$G$"$k(B @code{simpalg()} $B$NCf$G%G%P%C%,$,8F$P$l$?(B $B$3$H$r<($9(B. @code{simpalg()} $B$O(B, $BBe?tE*?t$r78?t$H$9$kB?9`<0$N(B $B3F78?t$r4JC12=$G$-$k(B. +\E +\BEG +This example shows an error caused by zero division in the course of +program execution of @code{simpalg()}, which attempted to simplify +an algebraic number expression of which the denominator is 0. +Function @code{simpalg()} also can take a polynomial as its argument +and simplifies algebraic numbers in its coefficients. +\E + @example [43] simpalg(1/A0*x+1/(A0+1)); (-#0)*x+(-1/2*#0+1/2) @end example @noindent +\BJP $BBe?tE*?t$r78?t$H$9$kB?9`<0$N4pK\1i;;$O(B, $BE,59(B @code{simpalg()} $B$r8F$V$3$H$r(B $B=|$1$PDL>o$N>l9g$HF1MM$G$"$k$,(B, $B0x?tJ,2r$J$I$GIQHK$KMQ$$$i$l$k%N%k%`$N(B $B7W;;$J$I$K$*$$$F$O(B, @code{root} $B$rITDj85$KCV$-49$($kI,MW$,=P$F$/$k(B. $B$3$N>l9g(B, @code{algptorat()} $B$rMQ$$$k(B. +\E +\BEG +Thus, you can operate in polynomials which contain algebraic numbers +as you do usually in ordinary polynomials, +except for proper simplification by @code{simpalg()}. +You may sometimes feel needs to convert @b{root}'s into indeterminates, +especially when you are working for norm computation in algorithms for +algebraic factorization. +Function @code{algptorat()} is used for such cases. +\E @example [83] A0=newalg(x^2+1); @@ -196,25 +387,44 @@ t#1^2+t#0*t#1+2*t#0 @end example @noindent +\BJP $B$3$N$h$&$K(B, @code{algptorat()} $B$O(B, $BB?9`<0(B, $B?t$K4^$^$l$k(B @code{root} $B$r(B, $BBP1~$9$kITDj85(B, $B$9$J$o$A(B @code{#@var{n}} $B$KBP$9$k(B @code{t#@var{n}} $B$KCV$-49$($k(B. $B4{$K=R$Y$?$h$&$K(B, $B$3$NITDj85$O%f!<%6$,F~NO$9$k$3$H$O$G$-$J$$(B. $B$3$l$O(B, $B%f!<%6$NF~NO$7$?ITDj85$H(B, @code{root} $B$KBP1~$9$kITDj85$,0lCW(B $B$7$J$$$h$&$K$9$k$?$a$G$"$k(B. +\E +\BEG +As you see by the example, +function @code{algptorat()} converts @b{root}'s, @code{#@var{n}}, +in polynomials and numbers into its associated indeterminates, +@code{t#@var{n}}. As was already mentioned those indeterminates cannot +be directly input in their immediate form. +The restriction is adopted to avoid the confusion that might happen +if the user could input such internally generatable indeterminates. +\E @noindent +\BJP $B5U$K(B, @code{root} $B$KBP1~$9$kITDj85$r(B, $BBP1~$9$k(B @code{root} $B$KCV$-49$($k(B $B$?$a$K$O(B @code{rattoalgp()} $B$rMQ$$$k(B. +\E +\BEG +The associated indeterminate to a @b{root} is reversely converted +into the @b{root} by @code{rattoalgp()} function. +\E @example [88] rattoalgp(S,[alg(0)]); -(((#0+2)/(#0+2))*t#1^2+((#0^2+2*#0)/(#0+2))*t#1+((2*#0^2+4*#0)/(#0+2)))*x -+((1)/(#0+2))*t#1+((1)/(#0+2)) +(((#0+2)/(#0+2))*t#1^2+((#0^2+2*#0)/(#0+2))*t#1 ++((2*#0^2+4*#0)/(#0+2)))*x+((1)/(#0+2))*t#1+((1)/(#0+2)) [89] rattoalgp(S,[alg(0),alg(1)]); -(((#0^3+6*#0^2+12*#0+8)*#1^2+(#0^4+6*#0^3+12*#0^2+8*#0)*#1+2*#0^4+12*#0^3 -+24*#0^2+16*#0)/(#0^3+6*#0^2+12*#0+8))*x+(((#0+2)*#1+#0+2)/(#0^2+4*#0+4)) +(((#0^3+6*#0^2+12*#0+8)*#1^2+(#0^4+6*#0^3+12*#0^2+8*#0)*#1 ++2*#0^4+12*#0^3+24*#0^2+16*#0)/(#0^3+6*#0^2+12*#0+8))*x ++(((#0+2)*#1+#0+2)/(#0^2+4*#0+4)) [90] rattoalgp(S,[alg(1),alg(0)]); -(((#0+2)*#1^2+(#0^2+2*#0)*#1+2*#0^2+4*#0)/(#0+2))*x+((#1+1)/(#0+2)) +(((#0+2)*#1^2+(#0^2+2*#0)*#1+2*#0^2+4*#0)/(#0+2))*x ++((#1+1)/(#0+2)) [91] simpalg(@@89); (#1^2+#0*#1+2*#0)*x+((-1/5*#0+2/5)*#1-1/5*#0+2/5) [92] simpalg(@@90); @@ -222,73 +432,228 @@ t#1^2+t#0*t#1+2*t#0 @end example @noindent +\BJP @code{rattoalgp()} $B$O(B, $BCV49$NBP>]$H$J$k(B @code{root} $B$N%j%9%H$rBh(B 2 $B0z?t(B $B$K$H$j(B, $B:8$+$i=g$K(B, $BBP1~$9$kITDj85$rCV$-49$($F9T$/(B. $B$3$NNc$O(B, $BCV49$9$k=g=x$r49$($k$H4JC12=$r9T$o$J$$$3$H$K$h$j7k2L$,0l8+0[$J$k$,(B, $B4JC12=$K$h$jl9g$J$I$K$b(B $BMQ$$$k$3$H$,$G$-$k(B. +\E +\BEG +Function @code{rattoalgp()} takes as the second argument +a list consisting of @b{root}'s that you want to convert, +and converts them successively from the left. +This example shows that apparent difference of the results due to +the order of such conversion will vanish by simplification yielding +the same result. +Functions @code{algptorat()} and @code{rattoalgp()} can be conveniently +used for your own simplification. +\E +\BJP +@node $BJ,;6B?9`<0$K$h$kBe?tE*?t$NI=8=(B,,, $BBe?tE*?t$K4X$9$k1i;;(B +@section $BJ,;6B?9`<0$K$h$kBe?tE*?t$NI=8=(B +\E +\BEG +@node Representation of algebraic numbers by distributed polynomials,,, Algebraic numbers +@section Representation of algebraic numbers by distributed polynomials +\E + +@noindent +\BJP +$BA0@a$G=R$Y$?$h$&$K(B, @code{root} $B$r4^$`Be?tE*?t$KBP$9$k4JC12=$O(B +$B%f!<%6$NH=CG$G9T$&I,MW$,$"$k(B. $B$3$l$KBP$7(B, $B$3$3$G2r@b$9$k$b$&0l$D$NBe?tE*?t$N(B +$BI=8=$K$D$$$F$O(B, $B2C8:>h=|(B, $B%Y%-$J$I$r9T$C$?$"$H<+F0E*$K4JC12=$,9T$o$l$k(B. +$B$3$NI=8=$O(B, $BC`l9g$KFC$K8zN($h$/7W;;$,9T$o$l$k$h$&@_7W$5$l$F$*$j(B, +$B%0%l%V%J!<4pDl4X78$N4X?t$K$*$1$k78?tBN$H$7$FMQ$$$k$3$H$,$G$-$k(B. $B$3$NI=8=$O(B +$BFbItE*$K$O(B, @code{DAlg} $B$H8F$P$l$k%*%V%8%'%/%H$H$7$FDj5A$5$l$F$$$k(B. +@code{DAlg} $B$OJ,?t<0$N7A$GJ];}$5$l$k(B. $BJ,Jl$O@0?t(B, $BJ,;R$O@0?t78?t$NJ,;6B?9`<0$G$"$k(B. +\E +\BEG +Simplification of algebraic numbers containing @code{root} +is not done automatically and should be done by users. +There is another representation of algebraic numbers, for which the +results of fundamental operations are automatically simplified. +This representations are designed so that operations are efficiently +performed especially when the field is a successive extension and +it can be used as a ground field for Groebner basis related functions. +Internally an algebraic number of this type is defined as an object +called @code{DAlg}. A @code{DAlg} is represented as a fraction. The +denominator is an integer and the numerator is a distributed polynomial +with integral coefficients. +\E + +\BJP +@code{DAlg} $B$O!$(B@code{set_field()} $B$K$h$j$"$i$+$8$a@_Dj$5$l$?Be?tBN$N(B +$B85$H$7$F@8@.$5$l$k(B. $B@8@.J}K!$O(B, @code{newalg()} $B$G@8@.$5$l$?Be?tE*?t$r(B +$B4^$`?t$+$i(B @code{algtodalg()} $B$GJQ49$9$k(B, $B$"$k$$$OJ,;6B?9`<0$+$iD>@\(B +@code{dptodalg()} $B$GJQ49$9$k!$$N(B 2 $BDL$j$"$k(B. +$B0lC6(B @code{DAlg} $B7A<0$KJQ49$5$l$l$P(B, $B1i;;8e$K<+F0E*$K4JC12=$5$l$k(B. +\E +\BEG +@code{DAlg} is generated as an element of an algebraic number field +set by @code{set_field()}. There are two methods to generate a @code{DAlg}. +@code{algtodalg()} converts an algebraic number containing @code{root} +to @code{DAlg}. @code{dptodalg()} directly converts a distributed polynomial to +@code{DAlg}. +\E +@example +[0] A=newalg(x^2+1); +(#0) +[1] B=newalg(x^3+A*x+A); +(#1) +[2] set_field([B,A]); +0 +[3] C=algtodalg(A+B); +((1)*<<1,0>>+(1)*<<0,1>>) +[4] C^5; +((-11)*<<2,1>>+(5)*<<2,0>>+(10)*<<1,1>>+(9)*<<1,0>>+(11)*<<0,1>> ++(-1)*<<0,0>>) +[5] 1/C; +((2)*<<2,1>>+(-1)*<<2,0>>+(1)*<<1,1>>+(2)*<<1,0>>+(-3)*<<0,1>> ++(-1)*<<0,0>>)/5 +@end example +\BJP +$B$3$NNc$G$O(B, Q(a,b) (a^2+1=0, b^3+ab+b=0) $B$K$*$$$F(B, (a+b)^5 $B$*$h$S(B 1/(a+b) $B$r(B +$B7W;;(B ($B4JC12=(B) $B$7$F$$$k(B. $BJ,;R$G$"$kJ,;6B?9`<0$NI=<($O(B, $BJ,;6B?9`<0$NI=<($r$=$N$^$^N.MQ$7$F$$$k(B. +\E +\BEG +In this example Q(a,b) (a^2+1=0, b^3+ab+b=0) is set as the current ground field, +and (a+b)^5 and 1/(a+b) are simplified in the field. The numerators of the results +are printed as distributed polynomials. +\E + +\BJP @node $BBe?tBN>e$G$N(B 1 $BJQ?tB?9`<0$N1i;;(B,,, $BBe?tE*?t$K4X$9$k1i;;(B @section $BBe?tBN>e$G$N(B 1 $BJQ?tB?9`<0$N1i;;(B +\E +\BEG +@node Operations for uni-variate polynomials over an algebraic number field,,, Algebraic numbers +@section Operations for uni-variate polynomials over an algebraic number field +\E @noindent +\BJP @samp{sp} $B$G$O(B, 1 $BJQ?tB?9`<0$K8B$j(B, GCD, $B0x?tJ,2r$*$h$S$=$l$i$N1~MQ$H$7$F(B $B:G>.J,2rBN$r5a$a$kH!?t$rDs6!$7$F$$$k(B. +\E +\BEG +In the file @samp{sp} are provided functions for uni-variate polynomial +factorization and uni-variate polynomial GCD computation +over algebraic numbers, +and furthermore, as an application of them, +functions to compute splitting fields of univariate polynomials. +\E @menu * GCD:: +\BJP * $BL5J?J}J,2r(B $B0x?tJ,2r(B:: * $B:G>.J,2rBN(B:: +\E +\BEG +* Square-free factorization and Factorization:: +* Splitting fields:: +\E @end menu -@node GCD,,, $BBe?tBN>e$G$N(B 1 $BJQ?tB?9`<0$N1i;;(B +\JP @node GCD,,, $BBe?tBN>e$G$N(B 1 $BJQ?tB?9`<0$N1i;;(B +\EG @node GCD,,, Operations for uni-variate polynomials over an algebraic number field @subsection GCD @noindent -$BBe?tBN>e$G$N(B GCD $B$O(B @code{gcda()} $B$K$h$j7W;;$5$l$k(B. +\BJP +$BBe?tBN>e$G$N(B GCD $B$O(B @code{cr_gcda()} $B$K$h$j7W;;$5$l$k(B. $B$3$NH!?t$O%b%8%e%i1i;;$*$h$SCf9q>jM>DjM}$K$h$jBe?tBN>e$N(B GCD $B$r(B $B7W;;$9$k$b$N$G(B, $BC`e$G$N(B 1 $BJQ?tB?9`<0$N1i;;(B @subsection $BL5J?J}J,2r(B, $B0x?tJ,2r(B +\E +\BEG +@node Square-free factorization and Factorization,,, Operations for uni-variate polynomials over an algebraic number field +@subsection Square-free factorization and Factorization +\E @noindent +\BJP $BL5J?J}J,2r$O(B, $BB?9`<0$H$=$NHyJ,$H$N(B GCD $B$N7W;;$+$i;O$^$k$b$C$H$b0lHLE*$J(B $B%"%k%4%j%:%`$r:NMQ$7$F$$$k(B. $BH!?t$O(B @code{asq()} $B$G$"$k(B. +\E +\BEG +For square-free factorization (of uni-variate polynomials over algebraic +number fields), we employ the most fundamental algorithm which begins +first to compute GCD of a polynomial and its derivative. +The function to do this factorization is @code{asq()}. +\E @example [116] A=newalg(x^2+x+1); (#4) [117] T=simpalg((x+A+1)*(x^2-2*A-3)^2*(x^3-x-A)^2); -x^11+(#4+1)*x^10+(-4*#4-8)*x^9+(-10*#4-4)*x^8+(16*#4+20)*x^7+(24*#4-6)*x^6 -+(-29*#4-31)*x^5+(-15*#4+28)*x^4+(38*#4+29)*x^3+(#4-23)*x^2+(-21*#4-7)*x -+(3*#4+8) +x^11+(#4+1)*x^10+(-4*#4-8)*x^9+(-10*#4-4)*x^8+(16*#4+20)*x^7 ++(24*#4-6)*x^6+(-29*#4-31)*x^5+(-15*#4+28)*x^4+(38*#4+29)*x^3 ++(#4-23)*x^2+(-21*#4-7)*x+(3*#4+8) [118] asq(T); [[x^5+(-2*#4-4)*x^3+(-#4)*x^2+(2*#4+3)*x+(#4-2),2],[x+(#4+1),1]] @end example @noindent +\BJP $B7k2L$ODL>o$HF1MM$K(B, [@b{$B0x;R(B}, @b{$B=EJ#EY(B}] $B$N%j%9%H$H$J$k$,(B, $BA4$F$N0x;R(B $B$N@Q$O(B, $B$b$H$NB?9`<0$HDj?tG\$N:9$O$"$jF@$k(B. $B$3$l$O(B, $B0x;R$r@0?t78?t$K$7(B $B$F8+$d$9$/$9$k$?$a$G(B, $B0x?tJ,2r$G$bF1MM$G$"$k(B. +\E +\BEG +Like factorization over the rational number field, +the result is presented, +commonly to both square-free factorization and factorization, +as a list whose elements are pairs (list of two elements) in the form + [@b{factor}, @b{multiplicity}] +without the constant multiple part. +Here, it should be noticed that the products of all factors of the +result may DIFFER from the input polynomial by a constant. +The reason is that the factors are normalized so that they have +integral leading coefficients for the sake of readability. + +This incongruity may happen to square-free factorization and +factorization commonly. +\E + @noindent +\BJP $BBe?tBN>e$G$N0x?tJ,2r$O(B, Trager $B$K$h$k%N%k%`K!$r2~NI$7$?$b$N$G(B, $BFC$K(B $B$"$kB?9`<0$KBP$7(B, $B$=$N:,$rE:2C$7$?BN>e$G$=$NB?9`<0<+?H$r0x?tJ,2r$9$k(B $B>l9g$KFC$KM-8z$G$"$k(B. +\E +\BEG +The algorithm employed for factorization over algebraic number fields +is an improvement of the norm method by Trager. +It is especially very effective to factorize a polynomial over a field +obtained by adjoining some of its @b{root}'s to the base field. +\E @example [119] af(T,[A]); @@ -296,16 +661,35 @@ x^11+(#4+1)*x^10+(-4*#4-8)*x^9+(-10*#4-4)*x^8+(16*#4+2 @end example @noindent +\BJP $B0z?t$O(B 2 $B$D$G(B, $BBh(B 2 $B0z?t$O(B, @code{root} $B$N%j%9%H$G$"$k(B. $B0x?tJ,2r$O(B $BM-M}?tBN$K(B, $B$=$l$i$N(B @code{root} $B$rE:2C$7$?BN>e$G9T$o$l$k(B. @code{root} $B$N=g=x$K$O@)8B$,$"$k(B. $B$9$J$o$A(B, $B8e$GDj5A$5$l$?$b$N$[$I(B $BA0$NJ}$K$3$J$1$l$P(B $B$J$i$J$$(B. $BJB$Y49$($O(B, $B<+F0E*$K$O9T$o$l$J$$(B. $B%f!<%6$N@UG$$H$J$k(B. +\E +\BEG +The function takes two arguments: The second argument is a list of +@b{root}'s. Factorization is performed over a field obtained by +adjoining the @b{root}'s to the rational number field. +It is important to keep in mind that the ordering of the @b{root}'s +must obey a restriction: Last defined should come first. +The automatic re-ordering is not done. +It should be done by yourself. +\E @noindent +\BJP $B%N%k%`$rMQ$$$?0x?tJ,2r$K$*$$$F$O(B, $B%N%k%`$N7W;;$H@0?t78?t(B 1 $BJQ?tB?9`<0$N(B $B0x?tJ,2r$N8zN($,(B, $BA4BN$N8zN($r:81&$9$k(B. $B$3$N$&$A(B, $BFC$K9bl9g$K8el9g$,$7$P$7$P@8$:$k(B. +\E +\BEG +The efficiency of factorization via norm depends on the efficiency +of the norm computation and univariate factorization over the rationals. +Especially the latter often causes combinatorial explosion and the +computation will stick in such a case. +\E @example [120] B=newalg(x^2-2*A-3); @@ -314,38 +698,85 @@ x^11+(#4+1)*x^10+(-4*#4-8)*x^9+(-10*#4-4)*x^8+(16*#4+2 [[x+(#5),2],[x^3-x+(-#4),2],[x+(-#5),2],[x+(#4+1),1]] @end example +\BJP @node $B:G>.J,2rBN(B,,, $BBe?tBN>e$G$N(B 1 $BJQ?tB?9`<0$N1i;;(B @subsection $B:G>.J,2rBN(B +\E +\BEG +@node Splitting fields,,, Operations for uni-variate polynomials over an algebraic number field +@subsection Splitting fields +\E @noindent +\BJP $B$d$dFC.J,2rBN$r5a$a$k$3$H$,$G$-$k(B. $BH!?t$O(B @code{sp()} $B$G$"$k(B. +\E +\BEG +This operation may be somewhat unusual and for specific interest. +(Galois Group for example.) Procedurally, however, it is easy to +obtain the splitting field of a polynomial by repeated application +of algebraic factorization described in the previous section. +The function is @code{sp()}. +\E @example [103] sp(x^5-2); -[[x+(-#1),2*x+(#0^3*#1^3+#0^4*#1^2+2*#1+2*#0),2*x+(-#0^4*#1^2),2*x -+(-#0^3*#1^3),x+(-#0)],[[(#1),t#1^4+t#0*t#1^3+t#0^2*t#1^2+t#0^3*t#1+t#0^4], -[(#0),t#0^5-2]]] +[[x+(-#1),2*x+(#0^3*#1^3+#0^4*#1^2+2*#1+2*#0),2*x+(-#0^4*#1^2), +2*x+(-#0^3*#1^3),x+(-#0)], +[[(#1),t#1^4+t#0*t#1^3+t#0^2*t#1^2+t#0^3*t#1+t#0^4],[(#0),t#0^5-2]]] @end example @noindent +\BJP @code{sp()} $B$O(B 1 $B0z?t$G(B, $B7k2L$O(B @code{[1 $B.J,2rBN$,F@$i$l$k$^$GE:2C$7$F$$$C$?(B @code{root} $B$r<($9(B. $B$=$NDj5AB?9`<0$O(B, $B$=$ND>A0$^$G$N(B @code{root} $B$rE:2C$7$?BN>e$G4{Ls$G$"$k$3$H(B $B$,J]>Z$5$l$F$$$k(B. +\E +\BEG +Function @code{sp()} takes only one argument. +The result is a list of two element: The first element is +a list of linear factors, and the second one is a list whose elements +are pairs (list of two elements) in the form +@code{[@b{root}, algptorat(@b{defining polynomial})]}. +The second element, a list of pairs of form +@code{[@b{root},algptorat(@b{defining polynomial})]}, +corresponds to the @b{root}'s which are adjoined to eventually obtain +the splitting field. They are listed in the reverse order of adjoining. +Each of the defining polynomials in the list is, of course, +guaranteed to be irreducible over the field obtained by adjoining all +@b{root}'s defined before it. +\E @noindent +\BJP $B7k2L$NBh(B 1 $BMWAG$G$"$k(B 1 $Be$G$N(B, @code{sp()} $B$N0z?t$NB?9`<0$NA4$F$N0x;R$rI=$9(B. $B$=$NBN$O(B $B:G>.J,2rBN$H$J$C$F$$$k$N$G(B, $B0x;R$OA4$F(B 1 $BH(B +\JP @item $B;2>H(B +\EG @item Reference @fref{defpoly} @end table -@node defpoly,,, $BBe?tE*?t$K4X$9$kH!?t$N$^$H$a(B +\JP @node defpoly,,, $BBe?tE*?t$K4X$9$kH!?t$N$^$H$a(B +\EG @node defpoly,,, Summary of functions for algebraic numbers @subsection @code{defpoly} @findex defpoly @table @t @item defpoly(@var{alg}) -:: @code{root} $B$NDj5AB?9`<0$rJV$9(B. +\JP :: @code{root} $B$NDj5AB?9`<0$rJV$9(B. +\EG :: Returns the defining polynomial of @b{root} @var{alg}. @end table @table @var @item return -$BB?9`<0(B +\JP $BB?9`<0(B +\EG polynomial @item alg -$BBe?tE*?t(B (@code{root}) +\JP $BBe?tE*?t(B (@code{root}) +\EG algebraic number (@code{root}) @end table @itemize @bullet @item -@code{root} @var{alg} $B$NDj5AB?9`<0$rJV$9(B. +\JP @code{root} @var{alg} $B$NDj5AB?9`<0$rJV$9(B. +\EG Returns the defining polynomial of @b{root} @var{alg}. @item +\BJP @code{root} $B$r(B @code{#@var{n}} $B$H$9$l$P(B, $BDj5AB?9`<0$NH(B +\JP @item $B;2>H(B +\EG @item Reference @fref{newalg}, @fref{alg}, @fref{algv} @end table -@node alg,,, $BBe?tE*?t$K4X$9$kH!?t$N$^$H$a(B +\JP @node alg,,, $BBe?tE*?t$K4X$9$kH!?t$N$^$H$a(B +\EG @node alg,,, Summary of functions for algebraic numbers @subsection @code{alg} @findex alg @table @t @item alg(@var{i}) -:: $B%$%s%G%C%/%9$KBP1~$9$k(B @code{root} $B$rJV$9(B. +\JP :: $B%$%s%G%C%/%9$KBP1~$9$k(B @code{root} $B$rJV$9(B. +\EG :: Returns a @b{root} which correspond to the index @var{i}. @end table @table @var @item return -$BBe?tE*?t(B (@code{root}) +\JP $BBe?tE*?t(B (@code{root}) +\EG algebraic number (@code{root}) @item i -$B@0?t(B +\JP $B@0?t(B +\EG integer @end table @itemize @bullet @item -@code{root} @code{#@var{i}} $B$rJV$9(B. +\JP @code{root} @code{#@var{i}} $B$rJV$9(B. +\EG Returns @code{#@var{i}}, a @b{root}. @item +\BJP @code{#@var{i}} $B$O%f!<%6$,D>@\F~NO$G$-$J$$$?$a(B, @code{alg(@var{i})} $B$H(B $B$$$&7A$GF~NO$9$k(B. +\E +\BEG +Because @code{#@var{i}} cannot be input directly, +this function provides an alternative way: input @code{alg(@var{i})}. +\E @end itemize @example @@ -460,32 +930,44 @@ syntax error @end example @table @t -@item $B;2>H(B +\JP @item $B;2>H(B +\EG @item Reference @fref{newalg}, @fref{algv} @end table -@node algv,,, $BBe?tE*?t$K4X$9$kH!?t$N$^$H$a(B +\JP @node algv,,, $BBe?tE*?t$K4X$9$kH!?t$N$^$H$a(B +\EG @node algv,,, Summary of functions for algebraic numbers @subsection @code{algv} @findex algv @table @t @item algv(@var{i}) -:: @code{alg(@var{i})} $B$KBP1~$9$kITDj85$rJV$9(B. +\JP :: @code{alg(@var{i})} $B$KBP1~$9$kITDj85$rJV$9(B. +\EG :: Returns the associated indeterminate with @code{alg(@var{i})}. @end table @table @var @item return -$BB?9`<0(B +\JP $BB?9`<0(B +\EG polynomial @item i -$B@0?t(B +\JP $B@0?t(B +\EG integer @end table @itemize @bullet @item -$BB?9`<0(B @code{t#@var{i}} $B$rJV$9(B. +\JP $BB?9`<0(B @code{t#@var{i}} $B$rJV$9(B. +\EG Returns an indeterminate @code{t#@var{i}} @item +\BJP @code{t#@var{i}} $B$O%f!<%6$,D>@\F~NO$G$-$J$$$?$a(B, @code{algv(@var{i})} $B$H(B $B$$$&7A$GF~NO$9$k(B. +\E +\BEG +Since indeterminate @code{t#@var{i}} cannot be input directly, +it is input by @code{algv(@var{i})}. +\E @end itemize @example @@ -499,38 +981,60 @@ t#0 @end example @table @t -@item $B;2>H(B +\JP @item $B;2>H(B +\EG @item Reference @fref{newalg}, @fref{defpoly}, @fref{alg} @end table -@node simpalg,,, $BBe?tE*?t$K4X$9$kH!?t$N$^$H$a(B +\JP @node simpalg,,, $BBe?tE*?t$K4X$9$kH!?t$N$^$H$a(B +\EG @node simpalg,,, Summary of functions for algebraic numbers @subsection @code{simpalg} @findex simpalg @table @t @item simpalg(@var{rat}) -:: $BM-M}<0$K4^$^$l$kBe?tE*?t$r4JC12=$9$k(B. +\JP :: $BM-M}<0$K4^$^$l$kBe?tE*?t$r4JC12=$9$k(B. +\EG :: Simplifies algebraic numbers in a rational expression. @end table @table @var @item return -$BM-M}<0(B +\JP $BM-M}<0(B +\EG rational expression @item rat -$BM-M}<0(B +\JP $BM-M}<0(B +\EG rational expression @end table @itemize @bullet @item -@samp{sp} $B$GDj5A$5$l$F$$$k(B. +\JP @samp{sp} $B$GDj5A$5$l$F$$$k(B. +\EG Defined in the file @samp{sp}. @item +\BJP $B?t(B, $BB?9`<0(B, $BM-M}<0$K4^$^$l$kBe?tE*?t$r(B, $B4^$^$l$k(B @code{root} $B$NDj5A(B $BB?9`<0$K$h$j4JC12=$9$k(B. +\E +\BEG +Simplifies algebraic numbers contained in numbers, +polynomials, and rational expressions by the defining +polynomials of @b{root}'s contained in them. +\E @item -$B?t$N>l9g(B, $BJ,Jl$,$"$l$PM-M}2=$5$l(B, $B7k2L$O(B @code{root} $B$NB?9`<0$H$J$k(B. +\JP $B?t$N>l9g(B, $BJ,Jl$,$"$l$PM-M}2=$5$l(B, $B7k2L$O(B @code{root} $B$NB?9`<0$H$J$k(B. +\BEG +If the argument is a number having the denominator, it is +rationalized and the result is a polynomial in @b{root}'s. +\E @item -$BB?9`<0$N>l9g(B, $B3F78?t$,4JC12=$5$l$k(B. +\JP $BB?9`<0$N>l9g(B, $B3F78?t$,4JC12=$5$l$k(B. +\EG If the argument is a polynomial, each coefficient is simplified. @item -$BM-M}<0$N>l9g(B, $BJ,JlJ,;R$,B?9`<0$H$7$F4JC12=$5$l$k(B. +\JP $BM-M}<0$N>l9g(B, $BJ,JlJ,;R$,B?9`<0$H$7$F4JC12=$5$l$k(B. +\BEG +If the argument is a rational expression, its denominator and +numerator are simplified as a polynomial. +\E @end itemize @example @@ -546,28 +1050,39 @@ return to toplevel (x+(#0+1))/(x+(-#0+1)) @end example -@node algptorat,,, $BBe?tE*?t$K4X$9$kH!?t$N$^$H$a(B +\JP @node algptorat,,, $BBe?tE*?t$K4X$9$kH!?t$N$^$H$a(B +\EG @node algptorat,,, Summary of functions for algebraic numbers @subsection @code{algptorat} @findex algptorat @table @t @item algptorat(@var{poly}) -:: $BB?9`<0$K4^$^$l$k(B @code{root} $B$r(B, $BBP1~$9$kITDj85$KCV$-49$($k(B. +\JP :: $BB?9`<0$K4^$^$l$k(B @code{root} $B$r(B, $BBP1~$9$kITDj85$KCV$-49$($k(B. +\EG :: Substitutes the associated indeterminate for every @b{root} @end table @table @var @item return -$BB?9`<0(B +\JP $BB?9`<0(B +\EG polynomial @item poly -$BB?9`<0(B +\JP $BB?9`<0(B +\EG polynomial @end table @itemize @bullet @item -@samp{sp} $B$GDj5A$5$l$F$$$k(B. +\JP @samp{sp} $B$GDj5A$5$l$F$$$k(B. +\EG Defined in the file @samp{sp}. @item +\BJP $BB?9`<0$K4^$^$l$k(B @code{root} @code{#@var{n}} $B$rA4$F(B @code{t#@var{n}} $B$K(B $BCV$-49$($k(B. +\E +\BEG +Substitutes the associated indeterminate @code{t#@var{n}} +for every @b{root} @code{#@var{n}} in a polynomial. +\E @end itemize @example @@ -576,35 +1091,53 @@ return to toplevel @end example @table @t -@item $B;2>H(B +\JP @item $B;2>H(B +\EG @item Reference @fref{defpoly}, @fref{algv} @end table -@node rattoalgp,,, $BBe?tE*?t$K4X$9$kH!?t$N$^$H$a(B +\JP @node rattoalgp,,, $BBe?tE*?t$K4X$9$kH!?t$N$^$H$a(B +\EG @node rattoalgp,,, Summary of functions for algebraic numbers @subsection @code{rattoalgp} @findex rattoalgp @table @t @item rattoalgp(@var{poly},@var{alglist}) +\BJP :: $BB?9`<0$K4^$^$l$k(B @code{root} $B$KBP1~$9$kITDj85$r(B @code{root} $B$K(B $BCV$-49$($k(B. +\E +\BEG +:: Substitutes a @b{root} for the associated indeterminate with the + @b{root}. +\E @end table @table @var @item return -$BB?9`<0(B +\JP $BB?9`<0(B +\EG polynomial @item poly -$BB?9`<0(B +\JP $BB?9`<0(B +\EG polynomial @item alglist -$B%j%9%H(B +\JP $B%j%9%H(B +\EG list @end table @itemize @bullet @item -@samp{sp} $B$GDj5A$5$l$F$$$k(B. +\JP @samp{sp} $B$GDj5A$5$l$F$$$k(B. +\EG Defined in the file @samp{sp}. @item +\BJP $BBh(B 2 $B0z?t$O(B @code{root} $B$N%j%9%H$G$"$k(B. @code{rattoalgp()} $B$O(B, $B$3$N(B @code{root} $B$KBP1~$9$kITDj85$r(B, $B$=$l$>$l(B @code{root} $B$KCV$-49$($k(B. +\E +\BEG +The second argument is a list of @b{root}'s. Function @code{rattoalgp()} +substitutes a @b{root} for the associated indeterminate of the @b{root}. +\E @end itemize @example @@ -613,38 +1146,38 @@ return to toplevel @end example @table @t -@item $B;2>H(B +\JP @item $B;2>H(B +\EG @item Reference @fref{alg}, @fref{algv} @end table -@node gcda,,, $BBe?tE*?t$K4X$9$kH!?t$N$^$H$a(B -@subsection @code{gcda} -@findex gcda +\JP @node cr_gcda,,, $BBe?tE*?t$K4X$9$kH!?t$N$^$H$a(B +\EG @node cr_gcda,,, Summary of functions for algebraic numbers +@subsection @code{cr_gcda} +@findex cr_gcda @table @t -@item gcda(@var{poly1},@var{poly2},@var{alist}) -:: $BBe?tBN>e$N(B 1 $BJQ?tB?9`<0$N(B GCD +@item cr_gcda(@var{poly1},@var{poly2}) +\JP :: $BBe?tBN>e$N(B 1 $BJQ?tB?9`<0$N(B GCD +\EG :: GCD of two uni-variate polynomials over an algebraic number field. @end table @table @var @item return -$BB?9`<0(B -@item poly1, poly2 -$BB?9`<0(B -@item alist -$B%j%9%H(B +\JP $BB?9`<0(B +\EG polynomial +@item poly1 poly2 +\JP $BB?9`<0(B +\EG polynomial @end table @itemize @bullet @item -@samp{sp} $B$GDj5A$5$l$F$$$k(B. +\JP @samp{sp} $B$GDj5A$5$l$F$$$k(B. +\EG Defined in the file @samp{sp}. @item -2 $B$D$N(B 1 $BJQ?tB?9`<0$N(B GCD $B$r5a$a$k(B. -@item -@var{alist} $B$OF~NO$K8=$l$k(B @code{root} $B$*$h$S(B, $B$=$l$i$NDj5A$K4^$^$l$k(B -@code{root} $B$r:F5"E*$Kl9g(B, @var{a} $B$O(B @var{b} $B$h$j8e(B ($B1&(B) $B$KJB$P$J$1$l$P(B -$B$J$i$J$$(B. +\JP 2 $B$D$N(B 1 $BJQ?tB?9`<0$N(B GCD $B$r5a$a$k(B. +\EG Finds the GCD of two uni-variate polynomials. @end itemize @example @@ -652,52 +1185,81 @@ return to toplevel [77] Y=x^6+6*x^5+24*x^4+8*x^3-48*x^2+384*x+1024$ [78] A=newalg(X); (#0) -[79] gcda(X,subst(Y,x,x+A),[A]); +[79] cr_gcda(X,subst(Y,x,x+A)); x+(-#0) @end example @table @t -@item $B;2>H(B -@fref{gr hgr gr_mod}, @fref{asq af} +\JP @item $B;2>H(B +\EG @item Reference +@fref{gr hgr gr_mod}, @fref{asq af af_noalg} @end table -@node sp_norm,,, $BBe?tE*?t$K4X$9$kH!?t$N$^$H$a(B +\JP @node sp_norm,,, $BBe?tE*?t$K4X$9$kH!?t$N$^$H$a(B +\EG @node sp_norm,,, Summary of functions for algebraic numbers @subsection @code{sp_norm} @findex sp_norm @table @t @item sp_norm(@var{alg},@var{var},@var{poly},@var{alglist}) -:: $BBe?tBN>e$G$N%N%k%`$N7W;;(B +\JP :: $BBe?tBN>e$G$N%N%k%`$N7W;;(B +\EG :: Norm computation over an algebraic number field. @end table @table @var @item return -$BB?9`<0(B +\JP $BB?9`<0(B +\EG polynomial @item var -@var{poly} $B$Ne$N6&Lr$KCV$-49$($?$b$N(B $BA4$F$N@Q$rJV$9(B. +\E +\BEG +Computes the norm of @var{poly} with respect to @var{alg}. +Namely, if we write +@b{K} = @b{Q}(@var{alglist} \ @{@var{alg}@}), +The function returns a product of all conjugates of @var{poly}, +where the conjugate of polynomial @var{poly} is a polynomial +in which the algebraic number @var{alg} is substituted +for its conjugate over @b{K}. +\E @item -$B7k2L$O(B @b{K} $B>e$NB?9`<0$H$J$k(B. +\JP $B7k2L$O(B @b{K} $B>e$NB?9`<0$H$J$k(B. +\EG The result is a polynomial over @b{K}. @item +\BJP $Bl9g$o$1$,9T$o$l(B, $B=*7k<0$ND>@\7W;;$dCf9q>jM>DjM}$K(B $B$h$j7W;;$5$l$k$,(B, $B:GE,$JA*Br$,9T$o$l$F$$$k$H$O8B$i$J$$(B. $BBg0hJQ?t(B @code{USE_RES} $B$r(B 1 $B$K@_Dj$9$k$3$H$K$h$j(B, $B>o$K=*7k<0$K$h$j7W;;(B $B$5$;$k$3$H$,$G$-$k(B. +\E +\BEG +The method of computation depends on the input. Currently +direct computation of resultant and Chinese remainder theorem +are used but the selection is not necessarily optimal. +By setting the global variable @code{USE_RES} to 1, the builtin function +@code{res()} is always used. +\E @end itemize @example @@ -711,106 +1273,252 @@ x^12+2*x^8+5*x^4+1 @end example @table @t -@item $B;2>H(B -@fref{res}, @fref{asq af} +\JP @item $B;2>H(B +\EG @item Reference +@fref{res}, @fref{asq af af_noalg} @end table -@node asq af,,, $BBe?tE*?t$K4X$9$kH!?t$N$^$H$a(B -@subsection @code{asq}, @code{af} +\JP @node asq af af_noalg,,, $BBe?tE*?t$K4X$9$kH!?t$N$^$H$a(B +\EG @node asq af af_noalg,,, Summary of functions for algebraic numbers +@subsection @code{asq}, @code{af}, @code{af_noalg} @findex asq @findex af +@findex af_noalg @table @t @item asq(@var{poly}) -:: $BBe?tBN>e$N(B 1 $BJQ?tB?9`<0$NL5J?J}J,2r(B +\JP :: $BBe?tBN>e$N(B 1 $BJQ?tB?9`<0$NL5J?J}J,2r(B +\BEG +:: Square-free factorization of polynomial @var{poly} over an +algebraic number field. +\E @item af(@var{poly},@var{alglist}) -:: $BBe?tBN>e$N(B 1 $BJQ?tB?9`<0$N0x?tJ,2r(B +@itemx af_noalg(@var{poly},@var{defpolylist}) +\JP :: $BBe?tBN>e$N(B 1 $BJQ?tB?9`<0$N0x?tJ,2r(B +\BEG +:: Factorization of polynomial @var{poly} over an +algebraic number field. +\E @end table @table @var @item return -$B%j%9%H(B +\JP $B%j%9%H(B +\EG list @item poly -$BB?9`<0(B +\JP $BB?9`<0(B +\EG polynomial @item alglist -@code{root} $B$N%j%9%H(B +\JP @code{root} $B$N%j%9%H(B +\EG @code{root} list +@item defpolylist +\JP @code{root} $B$rI=$9ITDj85$HDj5AB?9`<0$N%Z%"$N%j%9%H(B +\EG @code{root} list of pairs of an indeterminate and a polynomial @end table @itemize @bullet @item -$B$$$:$l$b(B @samp{sp} $B$GDj5A$5$l$F$$$k(B. +\JP $B$$$:$l$b(B @samp{sp} $B$GDj5A$5$l$F$$$k(B. +\EG Both defined in the file @samp{sp}. @item +\BJP @code{root} $B$r4^$^$J$$>l9g$O@0?t>e$NH!?t$,8F$S=P$5$l9bB.$G$"$k$,(B, -@code{root} $B$r4^$`>l9g$K$O(B, @code{gcda()} $B$,5/F0$5$l$k$?$a$7$P$7$P(B +@code{root} $B$r4^$`>l9g$K$O(B, @code{cr_gcda()} $B$,5/F0$5$l$k$?$a$7$P$7$P(B $B;~4V$,$+$+$k(B. +\E +\BEG +If the inputs contain no @b{root}'s, these functions run fast +since they invoke functions over the integers. +In contrast to this, if the inputs contain @b{root}'s, they sometimes +take a long time, since @code{cr_gcda()} is invoked. +\E @item +\BJP @code{af()} $B$O(B, $B4pACBN$N;XDj(B, $B$9$J$o$ABh(B 2 $B0z?t$N(B, @code{root} $B$N%j%9%H(B $B$N;XDj$,I,MW$G$"$k(B. +\E +\BEG +Function @code{af()} requires the specification of base field, +i.e., list of @b{root}'s for its second argument. +\E @item +\BJP @code{alglist} $B$G;XDj$5$l$k(B @code{root} $B$O(B, $B8e$GDj5A$5$l$?$b$N$[$IA0$N(B $BJ}$KMh$J$1$l$P$J$i$J$$(B. +\E +\BEG +In the second argument @code{alglist}, @b{root} defined last must come +first. +\E @item -$B7k2L$O(B, $BDL>o$NL5J?J}J,2r(B, $B0x?tJ,2r$HF1MM(B [@b{$B0x;R(B}, @b{$B=EJ#EY(B}] $B$N%j%9%H$G$"$k(B. +\BJP +@code{af(F,AL)} $B$K$*$$$F(B, @code{AL} $B$OBe?tE*?t$N%j%9%H$G$"$j(B, $BM-M}?tBN$N(B +$BBe?t3HBg$rI=$9(B. @code{AL=[An,...,A1]} $B$H=q$/$H$-(B, $B3F(B @code{Ak} $B$O(B, $B$=$l$h$j(B +$B1&$K$"$kBe?tE*?t$r78?t$H$7$?(B, $B%b%K%C%/$JDj5AB?9`<0$GDj5A$5$l$F$$$J$1$l$P(B +$B$J$i$J$$(B. +\E +\BEG +In @code{af(F,AL)}, @code{AL} denotes a list of @code{roots} and it +represents an algebraic number field. In @code{AL=[An,...,A1]} each +@code{Ak} should be defined as a root of a defining polynomial +whose coefficients are in @code{Q(A(k+1),...,An)}. +\E + +@example +[1] A1 = newalg(x^2+1); +[2] A2 = newalg(x^2+A1); +[3] A3 = newalg(x^2+A2*x+A1); +[4] af(x^2+A2*x+A1,[A2,A1]); +[[x^2+(#1)*x+(#0),1]] +@end example + +\BJP +@code{af_noalg} $B$G$O(B, @var{poly} $B$K4^$^$l$kBe?tE*?t(B @var{ai} $B$rITDj85(B @var{vi} +$B$GCV$-49$($k(B. @code{defpolylist} $B$O(B, [[vn,dn(vn,...,v1)],...,[v1,d(v1)]] +$B$J$k%j%9%H$G$"$k(B. $B$3$3$G(B @var{di}(vi,...,v1) $B$O(B @var{ai} $B$NDj5AB?9`<0$K$*$$$F(B +$BBe?tE*?t$rA4$F(B @var{vj} $B$KCV$-49$($?$b$N$G$"$k(B. +\E +\BEG +To call @code{sp_noalg}, one should replace each algebraic number +@var{ai} in @var{poly} with an indeterminate @var{vi}. @code{defpolylist} +is a list [[vn,dn(vn,...,v1)],...,[v1,d(v1)]]. In this expression +@var{di}(vi,...,v1) is a defining polynomial of @var{ai} represented +as a multivariate polynomial. +\E + +@example +[1] af_noalg(x^2+a2*x+a1,[[a2,a2^2+a1],[a1,a1^2+1]]); +[[x^2+a2*x+a1,1]] +@end example + @item -$B=EJ#EY$r9~$a$?0x;R$NA4$F$N@Q$O(B, @var{poly} $B$HDj?tG\$N0c$$$,$"$jF@$k(B. +\BJP +$B7k2L$O(B, $BDL>o$NL5J?J}J,2r(B, $B0x?tJ,2r$HF1MM(B [@b{$B0x;R(B}, @b{$B=EJ#EY(B}] +$B$N%j%9%H$G$"$k(B. @code{af_noalg} $B$N>l9g(B, @b{$B0x;R(B} $B$K8=$l$kBe?tE*?t$O(B, +@var{defpolylist} $B$K=>$C$FITDj85$KCV$-49$($i$l$k(B. +\E +\BEG +The result is a list, as a result of usual factorization, whose elements +is of the form [@b{factor}, @b{multiplicity}]. +In the result of @code{af_noalg}, algebraic numbers in @v{factor} are +replaced by the indeterminates according to @var{defpolylist}. +\E +@item +\JP $B=EJ#EY$r9~$a$?0x;R$NA4$F$N@Q$O(B, @var{poly} $B$HDj?tG\$N0c$$$,$"$jF@$k(B. +\BEG +The product of all factors with multiplicities counted may differ from +the input polynomial by a constant. +\E @end itemize @example +[98] A = newalg(t^2-2); +(#0) [99] asq(-x^4+6*x^3+(2*alg(0)-9)*x^2+(-6*alg(0))*x-2); [[-x^2+3*x+(#0),2]] [100] af(-x^2+3*x+alg(0),[alg(0)]); [[x+(#0-1),1],[-x+(#0+2),1]] +[101] af_noalg(-x^2+3*x+a,[[a,x^2-2]]); +[[x+a-1,1],[-x+a+2,1]] @end example @table @t -@item $B;2>H(B -@fref{gcda}, @fref{fctr sqfr} +\JP @item $B;2>H(B +\EG @item Reference +@fref{cr_gcda}, @fref{fctr sqfr} @end table -@node sp,,, $BBe?tE*?t$K4X$9$kH!?t$N$^$H$a(B -@subsection @code{sp} +\JP @node sp sp_noalg,,, $BBe?tE*?t$K4X$9$kH!?t$N$^$H$a(B +\EG @node sp sp_noalg,,, Summary of functions for algebraic numbers +@subsection @code{sp}, @code{sp_noalg} @findex sp @table @t @item sp(@var{poly}) -:: $B:G>.J,2rBN$r5a$a$k(B. +@itemx sp_noalg(@var{poly}) +\JP :: $B:G>.J,2rBN$r5a$a$k(B. +\EG :: Finds the splitting field of polynomial @var{poly} and splits. @end table @table @var @item return -$B%j%9%H(B +\JP $B%j%9%H(B +\EG list @item poly -$BB?9`<0(B +\JP $BB?9`<0(B +\EG polynomial @end table @itemize @bullet @item -@samp{sp} $B$GDj5A$5$l$F$$$k(B. +\JP @samp{sp} $B$GDj5A$5$l$F$$$k(B. +\EG Defined in the file @samp{sp}. @item +\BJP $BM-M}?t78?t$N(B 1 $BJQ?tB?9`<0(B @var{poly} $B$N:G>.J,2rBN(B, $B$*$h$S$=$NBN>e$G$N(B @var{poly} $B$N(B 1 $B.J,2rBN$N(B, $BC`.J,2rBN$O(B, @code{[root,algptorat(defpoly(root))]} $B$N%j%9%H$H$7$F(B $BI=8=$5$l$F$$$k(B. $B$9$J$o$A(B, $B5a$a$k:G>.J,2rBN$O(B, $BM-M}?tBN$K(B, $B$3$N(B @code{root} $B$rA4$FE:2C$7$?BN$H$7$FF@$i$l$k(B. $BE:2C$O(B, $B1&$NJ}$N(B @code{root} $B$+$i=g$K(B $B9T$o$l$k(B. +\E +\BEG +The splitting field is represented as a list of pairs of form +@code{[root,} @code{algptorat(defpoly(root))]}. +In more detail, the list is interpreted as a representation +of successive extension obtained by adjoining @b{root}'s +to the rational number field. Adjoining is performed from the right +@b{root} to the left. +\E @item +\BJP @code{sp()} $B$O(B, $BFbIt$G%N%k%`$N7W;;$N$?$a$K(B @code{sp_norm()} $B$r$7$P$7$P(B $B5/F0$9$k(B. $B%N%k%`$N7W;;$O(B, $B>u67$K1~$8$F$5$^$6$^$JJ}K!$G9T$o$l$k$,(B, $B$=$3$GMQ$$$i$l$kJ}K!$,:GA1$H$O8B$i$:(B, $BC1=c$J=*7k<0$N7W;;$NJ}$,9bB.(B $B$G$"$k>l9g$b$"$k(B. $BBg0hJQ?t(B @code{USE_RES} $B$r(B 1 $B$K@_Dj$9$k$3$H$K$h$j(B, $B>o$K=*7k<0$K$h$j7W;;(B $B$5$;$k$3$H$,$G$-$k(B. +\E +\BEG +@code{sp()} invokes @code{sp_norm()} internally. Computation of norm +is done by several methods according to the situation but the algorithm +selection is not always optimal and a simple resultant computation is +often superior to the other methods. +By setting the global variable @code{USE_RES} to 1, +the builtin function @code{res()} is always used. +\E @end itemize @example [101] L=sp(x^9-54); -[[x+(-#2),-54*x+(#1^6*#2^4),54*x+(#1^6*#2^4+54*#2),54*x+(-#1^8*#2^2), --54*x+(#1^5*#2^5),54*x+(#1^5*#2^5+#1^8*#2^2),-54*x+(-#1^7*#2^3-54*#1), -54*x+(-#1^7*#2^3),x+(-#1)],[[(#2),t#2^6+t#1^3*t#2^3+t#1^6],[(#1),t#1^9-54]]] +[[x+(-#2),-54*x+(#1^6*#2^4),54*x+(#1^6*#2^4+54*#2), +54*x+(-#1^8*#2^2),-54*x+(#1^5*#2^5),54*x+(#1^5*#2^5+#1^8*#2^2), +-54*x+(-#1^7*#2^3-54*#1),54*x+(-#1^7*#2^3),x+(-#1)], +[[(#2),t#2^6+t#1^3*t#2^3+t#1^6],[(#1),t#1^9-54]]] [102] for(I=0,M=1;I<9;I++)M*=L[0][I]; [111] M=simpalg(M); -1338925209984*x^9+72301961339136 @@ -819,7 +1527,156 @@ x^12+2*x^8+5*x^4+1 @end example @table @t -@item $B;2>H(B -@fref{asq af}, @fref{defpoly}, @fref{algptorat}, @fref{sp_norm}. +\JP @item $B;2>H(B +\EG @item Reference +@fref{asq af af_noalg}, @fref{defpoly}, @fref{algptorat}, @fref{sp_norm}. @end table +\JP @node set_field,,, $BBe?tE*?t$K4X$9$kH!?t$N$^$H$a(B +\EG @node set_field,,, Summary of functions for algebraic numbers +@subsection @code{set_field} +@findex set_field + +@table @t +@item set_field(@var{rootlist}) +\JP :: $BBe?tBN$r4pACBN$H$7$F@_Dj$9$k(B. +\EG :: Set an algebraic number field as the currernt ground field. +@end table + +@table @var +@item return +0 +@item rootlist +\JP @code{root} $B$N%j%9%H(B +\EG A list of @code{root} +@end table + +@itemize @bullet +@item +\JP @code{root} $B$N%j%9%H(B @var{rootlist} $B$G@8@.$5$l$kBe?tBN$r4pACBN$H$7$F@_Dj$9$k(B. +\BEG +@code{set_field()} sets an algebraic number field generated by @code{root} in +@var{rootlist} over Q. +\E +@item +\BJP +@code{root} $B$OFbItE*$K=g=x$E$1$i$l$F$$$k$N$G(B, @var{rootlist} $B$O=89g$H$7$F;XDj(B +$B$9$l$P$h$$(B. ($B=g=x$O5$$K$7$J$/$F$h$$(B.) +\E +\BEG +You don't care about the order of @code{root} in @var{rootlist}, because +@code{root} are automatically ordered internally. +\E +@end itemize + +@example +[0] A=newalg(x^2+1); +(#0) +[1] B=newalg(x^3+A); +(#1) +[2] C=newalg(x^4+B); +(#1) +[3] set_field([C,B,A]); +0 +@end example + +@table @t +\JP @item $B;2>H(B +\EG @item Reference +@fref{algtodalg dalgtoalg dptodalg dalgtodp} +@end table + +\JP @node algtodalg dalgtoalg dptodalg dalgtodp,,, $BBe?tE*?t$K4X$9$kH!?t$N$^$H$a(B +\EG @node algtodalg dalgtoalg dptodalg dalgtodp,,, Summary of functions for algebraic numbers +@subsection @code{algtodalg}, @code{dalgtoalg}, @code{dptodalg}, @code{dalgtodp} +@findex algtodalg +@findex dalgtoalg +@findex dpodalg +@findex dalgtodp + +@table @t +@item algtodalg(@var{alg}) +\JP :: $BBe?tE*?t(B @var{alg} $B$r(B @code{DAlg} $B$KJQ49$9$k(B. +\EG :: Converts an algebraic number @var{alg} to a @code{DAlg}. +@item dalgtoalg(@var{dalg}) +\JP :: @code{DAlg} @code{dalg} $B$rBe?tE*?t$KJQ49$9$k(B. +\EG :: Converts a @code{DAlg} @code{dalg} to an algebraic number. +@item dptodalg(@var{dp}) +\JP :: $BJ,;6B?9`<0(B @var{dp} $B$r(B @code{DAlg} $B$KJQ49$9$k(B. +\EG :: Converts an algebraic number @var{alg} to a @code{DAlg}. +@item dalgtodp(@var{dalg}) +\JP :: @code{DAlg} @code{dalg} $B$rJ,;6B?9`<0$KJQ49$9$k(B. +\EG :: Converts a @code{DAlg} @code{dalg} to an algebraic number. +@end table + +@table @var +@item return +\JP $BBe?tE*?t(B, @code{DAlg} $B$^$?$O(B [$BJ,;6B?9`<0(B,$BJ,Jl(B] $B$J$k%j%9%H(B +\EG An algebraic number, a @code{DAlg} or a list [distributed polynomial,denominator] +@item alg +\JP @code{root} $B$r4^$`Be?tE*?t(B +\EG an algebraic number containing @code{root} +@item dp +\JP $BM-M}?t78?tJ,;6B?9`<0(B +\EG a distributed polynomial over Q +@end table + +@itemize @bullet +@item +\JP @code{root} $B$r4^$`Be?tE*?t(B, @code{DAlg} $B$*$h$SJ,;6B?9`<04V$NJQ49$r9T$&(B. +\BEG +These functions are converters between @code{DAlg} and an algebraic number +containing @code{root}, or a distributed polynomial. +\E +@item +\BJP +@code{DAlg} $B$,B0$9$Y$-Be?tBN$O(B, @code{set_field()} $B$K$h$j(B +$B$"$i$+$8$a@_Dj$7$F$*$/I,MW$,$"$k(B. +\E +\BEG +A ground field to which a @code{DAlg} belongs must be set by @code{set_field()} +in advance. +\E +@item +\BJP +@code{dalgtodp()} $B$O(B, $BJ,;R$G$"$k@0?t78?tJ,;6B?9`<0$H(B, $BJ,Jl$G$"$k@0?t$rMWAG$K;}$D(B +$B%j%9%H$rJV$9(B. +\E +\BEG +@code{dalgtodp()} returns a list containing the numerator (a distributed polynomial) +and the denominator (an integer). +\E +@item +\BJP +@code{algtodalg()}, @code{dptodalg()} $B$O4JC12=$5$l$?7k2L$rJV$9(B. +\E +\BEG +@code{algtodalg()}, @code{dptodalg()} return the simplified result. +\E +@end itemize + +@example +[0] A=newalg(x^2+1); +(#0) +[1] B=newalg(x^3+A*x+A); +(#1) +[2] set_field([B,A]); +0 +[3] C=algtodalg((A+B)^10); +((408)*<<2,1>>+(103)*<<2,0>>+(-36)*<<1,1>>+(-446)*<<1,0>> ++(-332)*<<0,1>>+(-218)*<<0,0>>) +[4] dalgtoalg(C); +((408*#0+103)*#1^2+(-36*#0-446)*#1-332*#0-218) +[5] D=dptodalg(<<10,10>>/10+2*<<5,5>>+1/3*<<0,0>>); +((-9)*<<2,1>>+(57)*<<2,0>>+(-63)*<<1,1>>+(-12)*<<1,0>> ++(-60)*<<0,1>>+(1)*<<0,0>>)/30 +[6] dalgtodp(D); +[(-9)*<<2,1>>+(57)*<<2,0>>+(-63)*<<1,1>>+(-12)*<<1,0>> ++(-60)*<<0,1>>+(1)*<<0,0>>,30] +@end example + +@table @t +\JP @item $B;2>H(B +\EG @item Reference +@fref{set_field} +@end table