Annotation of OpenXM/src/asir-doc/parts/builtin/poly.texi, Revision 1.1.1.1
1.1 noro 1: @node $BB?9`<0$*$h$SM-M}<0$N1i;;(B,,, $BAH$_9~$_H!?t(B
2: @section $BB?9`<0(B, $BM-M}<0$N1i;;(B
3:
4: @menu
5: * var::
6: * vars::
7: * uc::
8: * coef::
9: * deg mindeg::
10: * nmono::
11: * ord::
12: * sdiv sdivm srem sremm sqr sqrm::
13: * tdiv::
14: * %::
15: * subst psubst::
16: * diff::
17: * res::
18: * fctr sqfr::
19: * modfctr::
20: * ufctrhint::
21: * ptozp::
22: * prim cont::
23: * gcd gcdz::
24: * red::
25: @end menu
26:
27: @node var,,, $BB?9`<0$*$h$SM-M}<0$N1i;;(B
28: @subsection @code{var}
29: @findex var
30:
31: @table @t
32: @item var(@var{rat})
33: :: @var{rat} $B$N<gJQ?t(B.
34: @end table
35:
36: @table @var
37: @item return
38: $BITDj85(B
39: @item rat
40: $BM-M}<0(B
41: @end table
42:
43: @itemize @bullet
44: @item
45: $B<gJQ?t$K4X$7$F$O(B, @xref{Asir $B$G;HMQ2DG=$J7?(B}.
46: @item
47: $B%G%U%)%k%H$NJQ?t=g=x$O<!$N$h$&$K$J$C$F$$$k(B.
48:
49: @code{x}, @code{y}, @code{z}, @code{u}, @code{v}, @code{w}, @code{p}, @code{q}, @code{r}, @code{s}, @code{t}, @code{a}, @code{b}, @code{c}, @code{d}, @code{e},
50: @code{f}, @code{g}, @code{h}, @code{i}, @code{j}, @code{k}, @code{l}, @code{m}, @code{n}, @code{o},$B0J8e$OJQ?t$N8=$l$?=g(B.
51: @end itemize
52:
53: @example
54: [0] var(x^2+y^2+a^2);
55: x
56: [1] var(a*b*c*d*e);
57: a
58: [2] var(3/abc+2*xy/efg);
59: abc
60: @end example
61:
62: @table @t
63: @item $B;2>H(B
64: @fref{ord}, @fref{vars}.
65: @end table
66:
67: @node vars,,, $BB?9`<0$*$h$SM-M}<0$N1i;;(B
68: @subsection @code{vars}
69: @findex vars
70:
71: @table @t
72: @item vars(@var{obj})
73: :: @var{obj} $B$K4^$^$l$kJQ?t$N%j%9%H(B.
74: @end table
75:
76: @table @var
77: @item return
78: $B%j%9%H(B
79: @item obj
80: $BG$0U(B
81: @end table
82:
83: @itemize @bullet
84: @item
85: $BM?$($i$l$?<0$K4^$^$l$kJQ?t$N%j%9%H$rJV$9(B.
86: @item
87: $BJQ?t=g=x$N9b$$$b$N$+$i=g$KJB$Y$k(B.
88: @end itemize
89:
90: @example
91: [0] vars(x^2+y^2+a^2);
92: [x,y,a]
93: [1] vars(3/abc+2*xy/efg);
94: [abc,xy,efg]
95: [2] vars([x,y,z]);
96: [x,y,z]
97: @end example
98:
99: @table @t
100: @item $B;2>H(B
101: @fref{var}, @fref{uc}, @fref{ord}.
102: @end table
103:
104: @node uc,,, $BB?9`<0$*$h$SM-M}<0$N1i;;(B
105: @subsection @code{uc}
106: @findex uc
107:
108: @table @t
109: @item uc()
110: :: $B?7$?$JITDj85$r@8@.$9$k(B.
111: @end table
112:
113: @table @var
114: @item return
115: @code{vtype} $B$,(B 1 $B$NITDj85(B
116: @end table
117:
118: @itemize @bullet
119: @item
120: @code{uc()} $B$r<B9T$9$k$?$S$K(B, @code{_0}, @code{_1}, @code{_2},... $B$H$$$&(B
121: $BITDj85$r@8@.$9$k(B.
122: @item
123: @code{uc()} $B$G@8@.$5$l$?ITDj85$O(B, $BD>@\%-!<%\!<%I$+$iF~NO$9$k$3$H$,$G$-$J$$(B.
124: $B$3$l$O(B, $B%W%m%0%i%`Cf$GL$Dj78?t$r<+F0@8@.$9$k>l9g(B, $BF~NO$J$I$K4^$^$l$k(B
125: $BITDj85$HF10l$N$b$N$,@8@.$5$l$k$3$H$rKI$0$?$a$G$"$k(B.
126: @item
127: $BDL>o$NITDj85(B (@code{vtype} $B$,(B 0) $B$N<+F0@8@.$K$O(B @code{rtostr()},
128: @code{strtov()} $B$rMQ$$$k(B.
129: @item
130: @code{uc()} $B$G@8@.$5$l$?ITDj85$NITDj85$H$7$F$N7?(B (@code{vtype}) $B$O(B 1 $B$G$"$k(B.
131: (@xref{$BITDj85$N7?(B})
132: @end itemize
133:
134: @example
135: [0] A=uc();
136: _0
137: [1] B=uc();
138: _1
139: [2] (uc()+uc())^2;
140: _2^2+2*_3*_2+_3^2
141: [3] (A+B)^2;
142: _0^2+2*_1*_0+_1^2
143: @end example
144:
145: @table @t
146: @item $B;2>H(B
147: @fref{vtype}, @fref{rtostr}, @fref{strtov}.
148: @end table
149:
150: @node coef,,, $BB?9`<0$*$h$SM-M}<0$N1i;;(B
151: @subsection @code{coef}
152: @findex coef
153:
154: @table @t
155: @item coef(@var{poly},@var{deg}[,@var{var}])
156: :: @var{poly} $B$N(B @var{var} ($B>JN,;~$O<gJQ?t(B) $B$K4X$9$k(B @var{deg} $B<!$N78?t(B.
157: @end table
158:
159: @table @var
160: @item return
161: $BB?9`<0(B
162: @item poly
163: $BB?9`<0(B
164: @item var
165: $BITDj85(B
166: @item deg
167: $B<+A3?t(B
168: @end table
169:
170: @itemize @bullet
171: @item
172: @var{poly} $B$N(B @var{var} $B$K4X$9$k(B @var{deg} $B<!$N78?t$r=PNO$9$k(B.
173: @item
174: @var{var} $B$O(B, $B>JN,$9$k$H<gJQ?t(B @t{var}(@var{poly}) $B$@$H$_$J$5$l$k(B.
175: @item
176: @var{var} $B$,<gJQ?t$G$J$$;~(B, @var{var} $B$,<gJQ?t$N>l9g$KHf3S$7$F(B
177: $B8zN($,Mn$A$k(B.
178: @end itemize
179:
180: @example
181: [0] A = (x+y+z)^3;
182: x^3+(3*y+3*z)*x^2+(3*y^2+6*z*y+3*z^2)*x+y^3+3*z*y^2+3*z^2*y+z^3
183: [1] coef(A,1,y);
184: 3*x^2+6*z*x+3*z^2
185: [2] coef(A,0);
186: y^3+3*z*y^2+3*z^2*y+z^3
187: @end example
188:
189: @table @t
190: @item $B;2>H(B
191: @fref{var}, @fref{deg mindeg}.
192: @end table
193:
194: @node deg mindeg,,, $BB?9`<0$*$h$SM-M}<0$N1i;;(B
195: @subsection @code{deg}, @code{mindeg}
196: @findex deg
197: @findex mindeg
198:
199: @table @t
200: @item deg(@var{poly},@var{var})
201: :: @var{poly} $B$N(B, $BJQ?t(B @var{var} $B$K4X$9$k:G9b<!?t(B.
202: @item mindeg(@var{poly},@var{var})
203: :: @var{poly} $B$N(B, $BJQ?t(B @var{var} $B$K4X$9$k:GDc<!?t(B.
204: @end table
205:
206: @table @var
207: @item return
208: $B<+A3?t(B
209: @item poly
210: $BB?9`<0(B
211: @item var
212: $BITDj85(B
213: @end table
214:
215: @itemize @bullet
216: @item
217: $BM?$($i$l$?B?9`<0$NJQ?t(B @var{var} $B$K4X$9$k:G9b<!?t(B, $B:GDc<!?t$r=PNO$9$k(B.
218: @item
219: $BJQ?t(B @var{var} $B$r>JN,$9$k$3$H$O=PMh$J$$(B.
220: @end itemize
221:
222: @example
223: [0] deg((x+y+z)^10,x);
224: 10
225: [1] deg((x+y+z)^10,w);
226: 0
227: [75] mindeg(x^2+3*x*y,x);
228: 1
229: @end example
230:
231: @node nmono,,, $BB?9`<0$*$h$SM-M}<0$N1i;;(B
232: @subsection @code{nmono}
233: @findex nmono
234:
235: @table @t
236: @item nmono(@var{rat})
237: :: @var{rat} $B$NC19`<0$N9`?t(B.
238: @end table
239:
240: @table @var
241: @item return
242: $B<+A3?t(B
243: @item rat
244: $BM-M}<0(B
245: @end table
246:
247: @itemize @bullet
248: @item
249: $BB?9`<0$rE83+$7$?>uBV$G$N(B 0 $B$G$J$$78?t$r;}$DC19`<0$N9`?t$r5a$a$k(B.
250: @item
251: $BM-M}<0$N>l9g$O(B, $BJ,;R$HJ,Jl$N9`?t$NOB$,JV$5$l$k(B.
252: @item
253: $BH!?t7A<0(B (@xref{$BITDj85$N7?(B}) $B$O(B, $B0z?t$,2?$G$"$C$F$bC19`$H$_$J$5$l$k(B. (1 $B8D$NITDj85$HF1$8(B. )
254: @end itemize
255:
256: @example
257: [0] nmono((x+y)^10);
258: 11
259: [1] nmono((x+y)^10/(x+z)^10);
260: 22
261: [2] nmono(sin((x+y)^10));
262: 1
263: @end example
264:
265: @table @t
266: @item $B;2>H(B
267: @fref{vtype}.
268: @end table
269:
270: @node ord,,, $BB?9`<0$*$h$SM-M}<0$N1i;;(B
271: @subsection @code{ord}
272: @findex ord
273:
274: @table @t
275: @item ord([@var{varlist}])
276: :: $BJQ?t=g=x$N@_Dj(B
277: @end table
278:
279: @table @var
280: @item return
281: $BJQ?t$N%j%9%H(B
282: @item varlist
283: $BJQ?t$N%j%9%H(B
284: @end table
285:
286: @itemize @bullet
287: @item
288: $B0z?t$,$"$k$H$-(B, $B0z?t$NJQ?t%j%9%H$r@hF,$K=P$7(B, $B;D$j$NJQ?t$,$=$N8e$K(B
289: $BB3$/$h$&$KJQ?t=g=x$r@_Dj$9$k(B. $B0z?t$N$"$k$J$7$K4X$o$i$:(B, @code{ord()}
290: $B$N=*N;;~$K$*$1$kJQ?t=g=x%j%9%H$rJV$9(B.
291:
292: @item
293: $B$3$NH!?t$K$h$kJQ?t=g=x$NJQ99$r9T$C$F$b(B, $B4{$K%W%m%0%i%`JQ?t$J$I$K(B
294: $BBeF~$5$l$F$$$k<0$NFbIt7A<0$O?7$7$$=g=x$K=>$C$F$OJQ99$5$l$J$$(B.
295: $B=>$C$F(B, $B$3$NH!?t$K$h$k=g=x$NJQ99$O(B, @b{Asir} $B$N5/F0D>8e(B,
296: $B$"$k$$$O(B, $B?7$?$JJQ?t$,8=$l$?;~E@$K9T$o$l$k(B
297: $B$Y$-$G$"$k(B. $B0[$J$kJQ?t=g=x$N$b$H$G@8@.$5$l$?<0$I$&$7$N1i;;(B
298: $B$,9T$o$l$?>l9g(B, $BM=4|$;$L7k2L$,@8$:$k$3$H$b$"$jF@$k(B.
299: @end itemize
300:
301: @example
302: [0] ord();
303: [x,y,z,u,v,w,p,q,r,s,t,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,_x,_y,_z,_u,_v,_w,_p,
304: _q,_r,_s,_t,_a,_b,_c,_d,_e,_f,_g,_h,_i,_j,_k,_l,_m,_n,_o,exp(_x),(_x)^(_y),
305: log(_x),(_x)^(_y-1),cos(_x),sin(_x),tan(_x),(-_x^2+1)^(-1/2),cosh(_x),sinh(_x),
306: tanh(_x),(_x^2+1)^(-1/2),(_x^2-1)^(-1/2)]
307: [1] ord([dx,dy,dz,a,b,c]);
308: [dx,dy,dz,a,b,c,x,y,z,u,v,w,p,q,r,s,t,d,e,f,g,h,i,j,k,l,m,n,o,_x,_y,_z,_u,_v,
309: _w,_p,_q,_r,_s,_t,_a,_b,_c,_d,_e,_f,_g,_h,_i,_j,_k,_l,_m,_n,_o,exp(_x),
310: (_x)^(_y),log(_x),(_x)^(_y-1),cos(_x),sin(_x),tan(_x),(-_x^2+1)^(-1/2),
311: cosh(_x),sinh(_x),tanh(_x),(_x^2+1)^(-1/2),(_x^2-1)^(-1/2)]
312: @end example
313:
314: @node sdiv sdivm srem sremm sqr sqrm,,, $BB?9`<0$*$h$SM-M}<0$N1i;;(B
315: @subsection @code{sdiv}, @code{sdivm}, @code{srem}, @code{sremm}, @code{sqr}, @code{sqrm}
316: @findex sdiv
317: @findex sdivm
318: @findex srem
319: @findex sremm
320: @findex sqr
321: @findex sqrm
322:
323: @table @t
324: @item sdiv(@var{poly1},@var{poly2}[,@var{v}])
325: @itemx sdivm(@var{poly1},@var{poly2},@var{mod}[,@var{v}])
326: :: @var{poly1} $B$r(B @var{poly2} $B$G3d$k=|;;$,:G8e$^$G<B9T$G$-$k>l9g$K>&$r5a$a$k(B.
327: @item srem(@var{poly1},@var{poly2}[,@var{v}])
328: @item sremm(@var{poly1},@var{poly2},@var{mod}[,@var{v}])
329: :: @var{poly1} $B$r(B @var{poly2} $B$G3d$k=|;;$,:G8e$^$G<B9T$G$-$k>l9g$K>jM>$r5a$a$k(B.
330: @item sqr(@var{poly1},@var{poly2}[,@var{v}])
331: @item sqrm(@var{poly1},@var{poly2},@var{mod}[,@var{v}])
332: :: @var{poly1} $B$r(B @var{poly2} $B$G3d$k=|;;$,:G8e$^$G<B9T$G$-$k>l9g$K>&(B, $B>jM>$r(B
333: $B5a$a$k(B.
334: @end table
335:
336: @table @var
337: @item return
338: @code{sdiv()}, @code{sdivm()}, @code{srem()}, @code{sremm()} : $BB?9`<0(B, @code{sqr()}, @code{sqrm()} : @code{[$B>&(B,$B>jM>(B]} $B$J$k%j%9%H(B
339: @item poly1 poly2
340: $BB?9`<0(B
341: @item v
342: $BITDj85(B
343: @item mod
344: $BAG?t(B
345: @end table
346:
347: @itemize @bullet
348: @item
349: @var{poly1} $B$r(B @var{poly2} $B$N<gJQ?t(B @t{var}(@var{poly2})
350: ( $B0z?t(B @var{v} $B$,$"$k>l9g$K$O(B @var{v}) $B$K4X$9$kB?9`<0$H8+$F(B,
351: @var{poly2} $B$G(B, $B3d$j;;$r9T$&(B.
352: @item
353: @code{sdivm()}, @code{sremm()}, @code{sqrm()} $B$O(B GF(@var{mod}) $B>e$G7W;;$9$k(B.
354: @item
355: $BB?9`<0$N=|;;$O(B, $B<g78?t$I$&$7$N3d;;$K$h$jF@$i$l$?>&$H(B, $B<gJQ?t$NE,Ev$JQQ$N(B
356: $B@Q$r(B @var{poly2} $B$K3]$1$F(B, @var{poly1} $B$+$i0z$/$H$$$&A`:n$r(B
357: @var{poly1} $B$N<!?t$,(B @var{poly2} $B$N<!?t$h$j>.$5$/$J$k$^$G7+$jJV$7$F(B
358: $B9T$&(B. $B$3$NA`:n$,(B, $BB?9`<0$NHO0OFb$G9T$o$l$k$?$a$K$O(B, $B3F%9%F%C%W$K$*$$$F(B
359: $B<g78?t$I$&$7$N=|;;$,(B, $BB?9`<0$H$7$F$N@0=|$G$"$kI,MW$,$"$k(B. $B$3$l$,(B, $B!V=|;;(B
360: $B$,:G8e$^$G<B9T$G$-$k!W$3$H$N0UL#$G$"$k(B.
361: @item
362: $BE57?E*$J>l9g$H$7$F(B, @var{poly2} $B$N<g78?t$,(B, $BM-M}?t$G$"$k>l9g(B, $B$"$k$$$O(B,
363: @var{poly2} $B$,(B @var{poly1} $B$N0x;R$G$"$k$3$H$,$o$+$C$F$$$k>l9g$J$I(B
364: $B$,$"$k(B.
365: @item
366: @code{sqr()} $B$O>&$H>jM>$rF1;~$K5a$a$?$$;~$KMQ$$$k(B.
367: @item
368: $B@0?t=|;;$N>&(B, $B>jM>$O(B @code{idiv}, @code{irem} $B$rMQ$$$k(B.
369: @item
370: $B78?t$KBP$9$k>jM>1i;;$O(B @code{%} $B$rMQ$$$k(B.
371: @end itemize
372:
373: @example
374: [0] sdiv((x+y+z)^3,x^2+y+a);
375: x+3*y+3*z
376: [1] srem((x+y+z)^2,x^2+y+a);
377: (2*y+2*z)*x+y^2+(2*z-1)*y+z^2-a
378: [2] X=(x+y+z)*(x-y-z)^2;
379: x^3+(-y-z)*x^2+(-y^2-2*z*y-z^2)*x+y^3+3*z*y^2+3*z^2*y+z^3
380: [3] Y=(x+y+z)^2*(x-y-z);
381: x^3+(y+z)*x^2+(-y^2-2*z*y-z^2)*x-y^3-3*z*y^2-3*z^2*y-z^3
382: [4] G=gcd(X,Y);
383: x^2-y^2-2*z*y-z^2
384: [5] sqr(X,G);
385: [x-y-z,0]
386: [6] sqr(Y,G);
387: [x+y+z,0]
388: [7] sdiv(y*x^3+x+1,y*x+1);
389: divsp: cannot happen
390: return to toplevel
391: @end example
392:
393: @table @t
394: @item $B;2>H(B
395: @fref{idiv irem}, @fref{%}.
396: @end table
397:
398: @node tdiv,,, $BB?9`<0$*$h$SM-M}<0$N1i;;(B
399: @subsection @code{tdiv}
400: @findex tdiv
401:
402: @table @t
403: @item tdiv(@var{poly1},@var{poly2})
404: :: @var{poly1} $B$,(B @var{poly2} $B$G3d$j@Z$l$k$+$I$&$+D4$Y$k(B.
405: @end table
406:
407: @table @var
408: @item return
409: $B3d$j@Z$l$k$J$i$P>&(B, $B3d$j@Z$l$J$1$l$P(B 0
410: @item poly1 poly2
411: $BB?9`<0(B
412: @end table
413:
414: @itemize @bullet
415: @item
416: @var{poly2} $B$,(B @var{poly1} $B$rB?9`<0$H$7$F3d$j@Z$k$+$I$&$+D4$Y$k(B.
417: @item
418: $B$"$kB?9`<0$,4{Ls0x;R$G$"$k$3$H$O$o$+$C$F$$$k$,(B, $B$=$N=EJ#EY$,$o$+$i$J$$(B
419: $B>l9g$K(B, @code{tdiv()} $B$r7+$jJV$78F$V$3$H$K$h$j=EJ#EY$,$o$+$k(B.
420: @end itemize
421:
422: @example
423: [11] Y=(x+y+z)^5*(x-y-z)^3;
424: x^8+(2*y+2*z)*x^7+(-2*y^2-4*z*y-2*z^2)*x^6+(-6*y^3-18*z*y^2-18*z^2*y-6*z^3)*x^5
425: +(6*y^5+30*z*y^4+60*z^2*y^3+60*z^3*y^2+30*z^4*y+6*z^5)*x^3+(2*y^6+12*z*y^5
426: +30*z^2*y^4+40*z^3*y^3+30*z^4*y^2+12*z^5*y+2*z^6)*x^2+(-2*y^7-14*z*y^6
427: -42*z^2*y^5-70*z^3*y^4-70*z^4*y^3-42*z^5*y^2-14*z^6*y-2*z^7)*x-y^8-8*z*y^7
428: -28*z^2*y^6-56*z^3*y^5-70*z^4*y^4-56*z^5*y^3-28*z^6*y^2-8*z^7*y-z^8
429: [12] for(I=0,F=x+y+z,T=Y; T=tdiv(T,F); I++);
430: [13] I;
431: 5
432: @end example
433:
434: @table @t
435: @item $B;2>H(B
436: @fref{sdiv sdivm srem sremm sqr sqrm}.
437: @end table
438:
439: @node %,,, $BB?9`<0$*$h$SM-M}<0$N1i;;(B
440: @subsection @code{%}
441: @findex %
442:
443: @table @t
444: @item @var{poly} % @var{m}
445: :: $B@0?t$K$h$k>jM>(B
446: @end table
447:
448: @table @var
449: @item return
450: $B@0?t$^$?$OB?9`<0(B
451: @item poly
452: $B@0?t$^$?$O@0?t78?tB?9`<0(B
453: @item m
454: $B@0?t(B
455: @end table
456:
457: @itemize @bullet
458: @item
459: @var{poly} $B$N3F78?t$r(B @var{m} $B$G3d$C$?>jM>$GCV$-49$($?B?9`<0$rJV$9(B.
460: @item
461: $B7k2L$N78?t$OA4$F@5$N@0?t$H$J$k(B.
462: @item
463: @var{poly} $B$O@0?t$G$b$h$$(B. $B$3$N>l9g(B, $B7k2L$,@5$K@55,2=$5$l$k$3$H$r=|$1$P(B
464: @code{irem()} $B$HF1MM$KMQ$$$k$3$H$,$G$-$k(B.
465: @item
466: @var{poly} $B$N78?t(B, @var{m} $B$H$b@0?t$G$"$kI,MW$,$"$k$,(B, $B%A%'%C%/$O9T$J$o$l$J$$(B.
467: @end itemize
468:
469: @example
470: [0] (x+2)^5 % 3;
471: x^5+x^4+x^3+2*x^2+2*x+2
472: [1] (x-2)^5 % 3;
473: x^5+2*x^4+x^3+x^2+2*x+1
474: [2] (-5) % 4;
475: 3
476: [3] irem(-5,4);
477: -1
478: @end example
479:
480: @table @t
481: @item $B;2>H(B
482: @fref{idiv irem}.
483: @end table
484:
485: @node subst psubst,,, $BB?9`<0$*$h$SM-M}<0$N1i;;(B
486: @subsection @code{subst}, @code{psubst}
487: @findex subst
488: @findex psubst
489:
490: @table @t
491: @item subst(@var{rat}[,@var{varn},@var{ratn}]*)
492: @item psubst(@var{rat}[,@var{var},@var{rat}]*)
493: :: @var{rat} $B$N(B @var{varn} $B$K(B @var{ratn} $B$rBeF~(B
494: (@var{n=1,2},... $B$G:8$+$i1&$K=g<!BeF~$9$k(B).
495: @end table
496:
497: @table @var
498: @item return
499: $BM-M}<0(B
500: @item rat,ratn
501: $BM-M}<0(B
502: @item varn
503: $BITDj85(B
504: @end table
505:
506: @itemize @bullet
507: @item
508: $BM-M}<0$NFCDj$NITDj85$K(B, $BDj?t$"$k$$$OB?9`<0(B, $BM-M}<0$J$I$rBeF~$9$k$N$KMQ$$$k(B.
509: @item
510: @t{subst}(@var{rat},@var{var1},@var{rat1},@var{var2},@var{rat2},...) $B$O(B,
511: @t{subst}(@t{subst}(@var{rat},@var{var1},@var{rat1}),@var{var2},@var{rat2},...)
512: $B$HF1$80UL#$G$"$k(B.
513: @item
514: $BF~NO$N:8B&$+$i=g$KBeF~$r7+$jJV$9$?$a$K(B, $BF~NO$N=g$K$h$C$F7k2L$,JQ$o$k$3$H$,$"$k(B.
515: @item
516: @code{subst()} $B$O(B, @code{sin()} $B$J$I$NH!?t$N0z?t$KBP$7$F$bBeF~$r9T$&(B.
517: @code{psubst()} $B$O(B, $B$3$N$h$&$JH!?t$r0l$D$NFHN)$7$?ITDj85$H8+$J$7$F(B, $B$=(B
518: $B$N0z?t$K$OBeF~$O9T$o$J$$(B. (partial substitution $B$N$D$b$j(B)
519: @item
520: @b{Asir} $B$G$O(B, $BM-M}<0$NLsJ,$O<+F0E*$K$O9T$o$J$$$?$a(B,
521: $BM-M}<0$NBeF~$O(B, $B;W$o$L7W;;;~4V$NA}Bg$r0z$-5/$3$9>l9g$,$"$k(B.
522: $BM-M}<0$rBeF~$9$k>l9g$K$O(B, $BLdBj$K1~$8$?FH<+$NH!?t$r=q$$$F(B,
523: $B$J$k$Y$/J,Jl(B, $BJ,;R$,Bg$-$/$J$i$J$$$h$&$KG[N8$9$k$3$H$b$7$P$7$PI,MW$H$J$k(B.
524: @item
525: $BJ,?t$rBeF~$9$k>l9g$bF1MM$G$"$k(B.
526: @end itemize
527:
528: @example
529: [0] subst(x^3-3*y*x^2+3*y^2*x-y^3,y,2);
530: x^3-6*x^2+12*x-8
531: [1] subst(@@@@,x,-1);
532: -27
533: [2] subst(x^3-3*y*x^2+3*y^2*x-y^3,y,2,x,-1);
534: -27
535: [3] subst(x*y^3,x,y,y,x);
536: x^4
537: [4] subst(x*y^3,y,x,x,y);
538: y^4
539: [5] subst(x*y^3,x,t,y,x,t,y);
540: y*x^3
541: [6] subst(x*sin(x),x,t);
542: sint(t)*t
543: [7] psubst(x*sin(x),x,t);
544: sin(x)*t
545: @end example
546:
547: @node diff,,, $BB?9`<0$*$h$SM-M}<0$N1i;;(B
548: @subsection @code{diff}
549: @findex diff
550:
551: @table @t
552: @item diff(@var{rat}[,@var{varn}]*)
553: @item diff(@var{rat},@var{varlist})
554: :: @var{rat} $B$r(B @var{varn} $B$"$k$$$O(B @var{varlist} $B$NCf$NJQ?t$G=g<!HyJ,$9$k(B.
555: @end table
556:
557: @table @var
558: @item return
559: $B<0(B
560: @item rat
561: $BM-M}<0(B ($B=iEyH!?t$r4^$s$G$b$h$$(B)
562: @item varn
563: $BITDj85(B
564: @item varlist
565: $BITDj85$N%j%9%H(B
566: @end table
567:
568: @itemize @bullet
569: @item
570: $BM?$($i$l$?=iEyH!?t$r(B @var{varn} $B$"$k$$$O(B @var{varlist} $B$NCf$NJQ?t$G(B
571: $B=g<!HyJ,$9$k(B.
572: @item
573: $B:8B&$NITDj85$h$j(B, $B=g$KHyJ,$7$F$$$/(B. $B$D$^$j(B, @t{diff}(@var{rat},@t{x,y}) $B$O(B,
574: @t{diff}(@t{diff}(@var{rat},@t{x}),@t{y}) $B$HF1$8$G$"$k(B.
575: @end itemize
576:
577: @example
578: [0] diff((x+2*y)^2,x);
579: 2*x+4*y
580: [1] diff((x+2*y)^2,x,y);
581: 4
582: [2] diff(x/sin(log(x)+1),x);
583: (sin(log(x)+1)-cos(log(x)+1))/(sin(log(x)+1)^2)
584: [3] diff(sin(x),[x,x,x,x]);
585: sin(x)
586: @end example
587:
588: @node res,,, $BB?9`<0$*$h$SM-M}<0$N1i;;(B
589: @subsection @code{res}
590: @findex res
591:
592: @table @t
593: @item res(@var{var},@var{poly1},@var{poly2}[,@var{mod}])
594: :: @var{var} $B$K4X$9$k(B @var{poly1} $B$H(B @var{poly2} $B$N=*7k<0(B.
595: @end table
596:
597: @table @var
598: @item return
599: $BB?9`<0(B
600: @item var
601: $BITDj85(B
602: @item poly1,poly2
603: $BB?9`<0(B
604: @item mod
605: $BAG?t(B
606: @end table
607:
608: @itemize @bullet
609: @item
610: $BFs$D$NB?9`<0(B @var{poly1} $B$H(B @var{poly2} $B$N(B, $BJQ?t(B @var{var} $B$K4X$9$k(B
611: $B=*7k<0$r5a$a$k(B.
612: @item
613: $BItJ,=*7k<0%"%k%4%j%:%`$K$h$k(B.
614: @item
615: $B0z?t(B @var{mod} $B$,$"$k;~(B, GF(@var{mod}) $B>e$G$N7W;;$r9T$&(B.
616: @end itemize
617:
618: @example
619: [0] res(t,(t^3+1)*x+1,(t^3+1)*y+t);
620: -x^3-x^2-y^3
621: @end example
622:
623: @node fctr sqfr,,, $BB?9`<0$*$h$SM-M}<0$N1i;;(B
624: @subsection @code{fctr}, @code{sqfr}
625: @findex fctr
626: @findex sqfr
627:
628: @table @t
629: @item fctr(@var{poly})
630: :: @var{poly} $B$r4{Ls0x;R$KJ,2r$9$k(B.
631: @item sqfr(@var{poly})
632: :: @var{poly} $B$rL5J?J}J,2r$9$k(B.
633: @end table
634:
635: @table @var
636: @item return
637: $B%j%9%H(B
638: @item poly
639: $BM-M}?t78?t$NB?9`<0(B
640: @end table
641:
642: @itemize @bullet
643: @item
644: $BM-M}?t78?t$NB?9`<0(B @var{poly} $B$r0x?tJ,2r$9$k(B. @code{fctr()} $B$O4{Ls0x;RJ,2r(B,
645: @code{sqfr()} $B$OL5J?J}0x;RJ,2r(B.
646: @item
647: $B7k2L$O(B [[@b{$B?t78?t(B},1],[@b{$B0x;R(B},@b{$B=EJ#EY(B}],...] $B$J$k%j%9%H(B.
648: @item
649: @b{$B?t78?t(B} $B$H(B $BA4$F$N(B @b{$B0x;R(B}^@b{$B=EJ#EY(B} $B$N@Q$,(B @var{poly} $B$HEy$7$$(B.
650: @item
651: @b{$B?t78?t(B} $B$O(B, (@var{poly}/@b{$B?t78?t(B}) $B$,(B, $B@0?t78?t$G(B, $B78?t$N(B GCD $B$,(B 1 $B$H$J$k(B
652: $B$h$&$JB?9`<0$K$J$k$h$&$KA*$P$l$F$$$k(B. (@code{ptozp()} $B;2>H(B)
653: @end itemize
654:
655: @example
656: [0] fctr(x^10-1);
657: [[1,1],[x-1,1],[x+1,1],[x^4+x^3+x^2+x+1,1],[x^4-x^3+x^2-x+1,1]]
658: [1] fctr(x^3+y^3+(z/3)^3-x*y*z);
659: [[1/27,1],[9*x^2+(-9*y-3*z)*x+9*y^2-3*z*y+z^2,1],[3*x+3*y+z,1]]
660: [2] A=(a+b+c+d)^2;
661: a^2+(2*b+2*c+2*d)*a+b^2+(2*c+2*d)*b+c^2+2*d*c+d^2
662: [3] fctr(A);
663: [[1,1],[a+b+c+d,2]]
664: [4] A=(x+1)*(x^2-y^2)^2;
665: x^5+x^4-2*y^2*x^3-2*y^2*x^2+y^4*x+y^4
666: [5] sqfr(A);
667: [[1,1],[x+1,1],[-x^2+y^2,2]]
668: [6] fctr(A);
669: [[1,1],[x+1,1],[-x-y,2],[x-y,2]]
670: @end example
671:
672: @table @t
673: @item $B;2>H(B
674: @fref{ufctrhint}.
675: @end table
676:
677: @node ufctrhint,,, $BB?9`<0$*$h$SM-M}<0$N1i;;(B
678: @subsection @code{ufctrhint}
679: @findex ufctrhint
680:
681: @table @t
682: @item ufctrhint(@var{poly},@var{hint})
683: :: $B<!?t>pJs$rMQ$$$?(B 1 $BJQ?tB?9`<0$N0x?tJ,2r(B
684: @end table
685:
686: @table @var
687: @item return
688: $B%j%9%H(B
689: @item poly
690: $BM-M}?t78?t$N(B 1 $BJQ?tB?9`<0(B
691: @item hint
692: $B<+A3?t(B
693: @end table
694:
695: @itemize @bullet
696: @item
697: $B3F4{Ls0x;R$N<!?t$,(B @var{hint} $B$NG\?t$G$"$k$3$H$,$o$+$C$F$$$k>l9g$K(B
698: @var{poly} $B$N4{Ls0x;RJ,2r$r(B @code{fctr()} $B$h$j8zN(NI$/9T$&(B.
699: @var{poly} $B$,(B, @var{d} $B<!$N3HBgBN>e$K$*$1$k(B
700: $B$"$kB?9`<0$N%N%k%`(B (@xref{$BBe?tE*?t$K4X$9$k1i;;(B}) $B$GL5J?J}$G$"$k>l9g(B,
701: $B3F4{Ls0x;R$N<!?t$O(B @var{d} $B$NG\?t$H$J$k(B. $B$3$N$h$&$J>l9g$K(B
702: $BMQ$$$i$l$k(B.
703: @end itemize
704:
705: @example
706: [10] A=t^9-15*t^6-87*t^3-125;
707: t^9-15*t^6-87*t^3-125
708: 0msec
709: [11] N=res(t,subst(A,t,x-2*t),A);
710: -x^81+1215*x^78-567405*x^75+139519665*x^72-19360343142*x^69+1720634125410*x^66
711: -88249977024390*x^63-4856095669551930*x^60+1999385245240571421*x^57
712: -15579689952590251515*x^54+15956967531741971462865*x^51
713: ...
714: +140395588720353973535526123612661444550659875*x^6
715: +10122324287343155430042768923500799484375*x^3
716: +139262743444407310133459021182733314453125
717: 980msec + gc : 250msec
718: [12] sqfr(N);
719: [[-1,1],[x^81-1215*x^78+567405*x^75-139519665*x^72+19360343142*x^69
720: -1720634125410*x^66+88249977024390*x^63+4856095669551930*x^60
721: -1999385245240571421*x^57+15579689952590251515*x^54
722: ...
723: -10122324287343155430042768923500799484375*x^3
724: -139262743444407310133459021182733314453125,1]]
725: 20msec
726: [13] fctr(N);
727: [[-1,1],[x^9-405*x^6-63423*x^3-2460375,1],
728: [x^18-486*x^15+98739*x^12-9316620*x^9+945468531*x^6-12368049246*x^3
729: +296607516309,1],[x^18-8667*x^12+19842651*x^6+19683,1],
730: [x^18-324*x^15+44469*x^12-1180980*x^9+427455711*x^6+2793253896*x^3+31524548679,1],
731: [x^18+10773*x^12+2784051*x^6+307546875,1]]
732: 167.050sec + gc : 1.890sec
733: [14] ufctrhint(N,9);
734: [[-1,1],[x^9-405*x^6-63423*x^3-2460375,1],
735: [x^18-486*x^15+98739*x^12-9316620*x^9+945468531*x^6-12368049246*x^3
736: +296607516309,1],[x^18-8667*x^12+19842651*x^6+19683,1],
737: [x^18-324*x^15+44469*x^12-1180980*x^9+427455711*x^6+2793253896*x^3+31524548679,1],
738: [x^18+10773*x^12+2784051*x^6+307546875,1]]
739: 119.340sec + gc : 1.300sec
740: @end example
741:
742: @table @t
743: @item $B;2>H(B
744: @fref{fctr sqfr}.
745: @end table
746:
747: @node modfctr,,, $BB?9`<0$*$h$SM-M}<0$N1i;;(B
748: @subsection @code{modfctr}
749: @findex modfctr
750:
751: @table @t
752: @item modfctr(@var{poly},@var{mod})
753: :: $BM-8BBN>e$G$N(B 1 $BJQ?tB?9`<0$N0x?tJ,2r(B
754: @end table
755:
756: @table @var
757: @item return
758: $B%j%9%H(B
759: @item poly
760: $B@0?t78?t$N(B 1 $BJQ?tB?9`<0(B
761: @item mod
762: $B<+A3?t(B
763: @end table
764:
765: @itemize @bullet
766: @item
767: 2^31 $BL$K~$N<+A3?t(B @var{mod} $B$rI8?t$H$9$kAGBN>e$G0lJQ?tB?9`<0(B
768: @var{poly} $B$r4{Ls0x;R$KJ,2r$9$k(B.
769: @item
770: $B7k2L$O(B [[@b{$B?t78?t(B},1],[@b{$B0x;R(B},@b{$B=EJ#EY(B}],...] $B$J$k%j%9%H(B.
771: @item
772: @b{$B?t78?t(B} $B$H(B $BA4$F$N(B @b{$B0x;R(B}^@b{$B=EJ#EY(B} $B$N@Q$,(B @var{poly} $B$HEy$7$$(B.
773: @end itemize
774:
775: @example
776: [0] modfctr(x^10+x^2+1,2147483647);
777: [[1,1],[x+1513477736,1],[x+2055628767,1],[x+91854880,1],
778: [x+634005911,1],[x+1513477735,1],[x+634005912,1],
779: [x^4+1759639395*x^2+2045307031,1]]
780: @end example
781:
782: @table @t
783: @item $B;2>H(B
784: @fref{fctr sqfr}.
785: @end table
786:
787: @node ptozp,,, $BB?9`<0$*$h$SM-M}<0$N1i;;(B
788: @subsection @code{ptozp}
789: @findex ptozp
790:
791: @table @t
792: @item ptozp(@var{poly})
793: :: @var{poly} $B$rM-M}?tG\$7$F@0?t78?tB?9`<0$K$9$k(B.
794: @end table
795:
796: @table @var
797: @item return
798: $BB?9`<0(B
799: @item poly
800: $BB?9`<0(B
801: @end table
802:
803: @itemize @bullet
804: @item
805: $BM?$($i$l$?B?9`<0(B @var{poly} $B$KE,Ev$JM-M}?t$r3]$1$F(B, $B@0?t78?t$+$D(B
806: $B78?t$N(B GCD $B$,(B 1 $B$K$J$k$h$&$K$9$k(B.
807: @item
808: $BJ,?t$N;MB'1i;;$O(B, $B@0?t$N1i;;$KHf3S$7$FCY$$$?$a(B, $B<o!9$NB?9`<01i;;(B
809: $B$NA0$K(B, $BB?9`<0$r@0?t78?t$K$7$F$*$/$3$H$,K>$^$7$$(B.
810: @item
811: $BM-M}<0$rLsJ,$9$k(B @code{red()} $B$GJ,?t78?tM-M}<0$rLsJ,$7$F$b(B,
812: $BJ,;RB?9`<0$N78?t$OM-M}?t$N$^$^$G$"$j(B, $BM-M}<0$NJ,;R$r5a$a$k(B
813: @code{nm()} $B$G$O(B, $BJ,?t78?tB?9`<0$O(B, $BJ,?t78?t$N$^$^$N7A$G=PNO$5$l$k$?$a(B,
814: $BD>$A$K@0?t78?tB?9`<0$rF@$k;v$O=PMh$J$$(B.
815: @end itemize
816:
817: @example
818: [0] ptozp(2*x+5/3);
819: 6*x+5
820: [1] nm(2*x+5/3);
821: 2*x+5/3
822: @end example
823:
824: @table @t
825: @item $B;2>H(B
826: @fref{nm dn}.
827: @end table
828:
829: @node prim cont,,, $BB?9`<0$*$h$SM-M}<0$N1i;;(B
830: @subsection @code{prim}, @code{cont}
831: @findex prim
832:
833: @table @t
834: @item prim(@var{poly}[,@var{v}])
835: :: @var{poly} $B$N86;OE*ItJ,(B (primitive part).
836: @item cont(@var{poly}[,@var{v}])
837: :: @var{poly} $B$NMFNL(B (content).
838: @end table
839:
840: @table @var
841: @item return poly
842: $BM-M}?t78?tB?9`<0(B
843: @item v
844: $BITDj85(B
845: @end table
846:
847: @itemize @bullet
848: @item
849: @var{poly} $B$N<gJQ?t(B ($B0z?t(B @var{v} $B$,$"$k>l9g$K$O(B @var{v})
850: $B$K4X$9$k86;OE*ItJ,(B, $BMFNL$r5a$a$k(B.
851: @end itemize
852:
853: @example
854: [0] E=(y-z)*(x+y)*(x-z)*(2*x-y);
855: (2*y-2*z)*x^3+(y^2-3*z*y+2*z^2)*x^2+(-y^3+z^2*y)*x+z*y^3-z^2*y^2
856: [1] prim(E);
857: 2*x^3+(y-2*z)*x^2+(-y^2-z*y)*x+z*y^2
858: [2] cont(E);
859: y-z
860: [3] prim(E,z);
861: (y-z)*x-z*y+z^2
862: @end example
863:
864: @table @t
865: @item $B;2>H(B
866: @fref{var}, @fref{ord}.
867: @end table
868:
869: @node gcd gcdz,,, $BB?9`<0$*$h$SM-M}<0$N1i;;(B
870: @subsection @code{gcd}, @code{gcdz}
871: @findex gcd
872:
873: @table @t
874: @item gcd(@var{poly1},@var{poly2}[,@var{mod}])
875: @item gcdz(@var{poly1},@var{poly2})
876: :: @var{poly1} $B$H(B @var{poly2} $B$N(B gcd.
877: @end table
878:
879: @table @var
880: @item return
881: $BB?9`<0(B
882: @item poly1,poly2
883: $BB?9`<0(B
884: @item mod
885: $BAG?t(B
886: @end table
887:
888: @itemize @bullet
889: @item
890: $BFs$D$NB?9`<0$N:GBg8xLs<0(B (GCD) $B$r5a$a$k(B.
891: @item
892: @code{gcd()} $B$OM-M}?tBN>e$NB?9`<0$H$7$F$N(B GCD $B$rJV$9(B.
893: $B$9$J$o$A(B, $B7k2L$O@0?t78?t$G(B, $B$+$D78?t$N(B GCD
894: $B$,(B 1 $B$K$J$k$h$&$JB?9`<0(B, $B$^$?$O(B, $B8_$$$KAG$N>l9g$O(B 1 $B$rJV$9(B.
895: @item
896: @code{gcdz()} $B$O(B @var{poly1}, @var{poly2} $B$H$b$K@0?t78?t$N>l9g$K(B,
897: $B@0?t4D>e$NB?9`<0$H$7$F$N(B GCD $B$rJV$9(B.
898: $B$9$J$o$A(B, @code{gcd()} $B$NCM$K(B, $B78?tA4BN$N@0?t(B GCD$B$NCM$r3]$1$?$b$N$rJV$9(B.
899: @item
900: $B0z?t(B @var{mod} $B$,$"$k;~(B, @code{gcd()} $B$O(B GF(@var{mod}) $B>e$G$N(B GCD $B$rJV$9(B.
901: @item
902: @code{gcd()}, @code{gcdz()} Extended Zassenhaus $B%"%k%4%j%:%`$K$h$k(B.
903: $BM-8BBN>e$N(B GCD $B$O(B PRS $B%"%k%4%j%:%`$K$h$C$F$$$k$?$a(B, $BBg$-$JLdBj(B,
904: GCD $B$,(B 1 $B$N>l9g$J$I$K$*$$$F8zN($,0-$$(B.
905: @end itemize
906:
907: @example
908: [0] gcd(12*(x^2+2*x+1)^2,18*(x^2+(y+1)*x+y)^3);
909: x^3+3*x^2+3*x+1
910: [1] gcdz(12*(x^2+2*x+1)^2,18*(x^2+(y+1)*x+y)^3);
911: 6*x^3+18*x^2+18*x+6
912: [2] gcd((x+y)*(x-y)^2,(x+y)^2*(x-y));
913: x^2-y^2
914: [3] gcd((x+y)*(x-y)^2,(x+y)^2*(x-y),2);
915: x^3+y*x^2+y^2*x+y^3
916: @end example
917:
918: @table @t
919: @item $B;2>H(B
920: @fref{igcd igcdcntl}.
921: @end table
922:
923: @node red,,, $BB?9`<0$*$h$SM-M}<0$N1i;;(B
924: @subsection @code{red}
925: @findex red
926:
927: @table @t
928: @item red(@var{rat})
929: :: @var{rat} $B$rLsJ,$7$?$b$N(B.
930: @end table
931:
932: @table @var
933: @item return
934: $BM-M}<0(B
935: @item rat
936: $BM-M}<0(B
937: @end table
938:
939: @itemize @bullet
940: @item
941: @b{Asir} $B$OM-M}?t$NLsJ,$r>o$K<+F0E*$K9T$&(B.
942: $B$7$+$7(B, $BM-M}<0$K$D$$$F$ODLJ,$O9T$&$,(B,
943: $BLsJ,$O%f!<%6!<$,;XDj$7$J$$8B$j9T$o$J$$(B.
944: $B$3$NLsJ,$r9T$&%3%^%s%I$,(B @t{red} $B$G$"$k(B.
945: @item
946: EZGCD $B$K$h$j(B @var{rat} $B$NJ,;R(B, $BJ,Jl$rLsJ,$9$k(B.
947: @item
948: $B=PNO$5$l$kM-M}<0$NJ,Jl$NB?9`<0$O(B, $B3F78?t$N(B GCD $B$,(B 1 $B$N(B
949: $B@0?t78?tB?9`<0$G$"$k(B.
950: $BJ,;R$K$D$$$F$O@0?t78?tB?9`<0$H$J$k$H$O8B$i$J$$(B.
951: @item
952: GCD $B$OBgJQ=E$$1i;;$J$N$G(B, $BB>$NJ}K!$G=|$1$k6&DL0x;R$O2DG=$J8B$j=|$/$N$,(B
953: $BK>$^$7$$(B. $B$^$?(B, $BJ,Jl(B, $BJ,;R$,Bg$-$/$J$C$F$+$i$N$3$NH!?t$N8F$S=P$7$O(B,
954: $BHs>o$K;~4V$,3]$+$k>l9g$,B?$$(B. $BM-M}<01i;;$r9T$&>l9g$O(B, $B$"$kDxEY(B
955: $BIQHK$K(B, $BLsJ,$r9T$&I,MW$,$"$k(B.
956: @end itemize
957:
958: @example
959: [0] (x^3-1)/(x-1);
960: (x^3-1)/(x-1)
961: [1] red((x^3-1)/(x-1));
962: x^2+x+1
963: [2] red((x^3+y^3+z^3-3*x*y*z)/(x+y+z));
964: x^2+(-y-z)*x+y^2-z*y+z^2
965: [3] red((3*x*y)/(12*x^2+21*y^3*x));
966: (y)/(4*x+7*y^3)
967: [4] red((3/4*x^2+5/6*x)/(2*y*x+4/3*x));
968: (9/8*x+5/4)/(3*y+2)
969: @end example
970:
971: @table @t
972: @item $B;2>H(B
973: @fref{nm dn}, @fref{gcd gcdz}, @fref{ptozp}.
974: @end table
975:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>