[ << ] [ < ] [?] [ > ] [ >> ]         [??] [??] [???] [ ? ]

6.3 多項式, 有理式の演算


[ << ] [ < ] [?] [ > ] [ >> ]         [??] [??] [???] [ ? ]

6.3.1 var

var(rat)

:: rat の主変数.

return

不定元

rat

有理式

[0] var(x^2+y^2+a^2);
x
[1] var(a*b*c*d*e);
a
[2] var(3/abc+2*xy/efg);
abc
参照

ord, vars.


[ << ] [ < ] [?] [ > ] [ >> ]         [??] [??] [???] [ ? ]

6.3.2 vars

vars(obj)

:: obj に含まれる変数のリスト.

return

リスト

obj

任意

[0] vars(x^2+y^2+a^2);
[x,y,a]
[1] vars(3/abc+2*xy/efg);
[abc,xy,efg]
[2] vars([x,y,z]);
[x,y,z]
参照

var, uc, ord.


[ << ] [ < ] [?] [ > ] [ >> ]         [??] [??] [???] [ ? ]

6.3.3 uc

uc()

:: 未定係数法のための不定元を生成する.

return

vtype が 1 の不定元

[0] A=uc();
_0
[1] B=uc();
_1
[2] (uc()+uc())^2;
_2^2+2*_3*_2+_3^2
[3] (A+B)^2;
_0^2+2*_1*_0+_1^2
参照

vtype, rtostr, strtov.


[ << ] [ < ] [?] [ > ] [ >> ]         [??] [??] [???] [ ? ]

6.3.4 coef

coef(poly,deg[,var])

:: polyvar (省略時は主変数) に関する deg 次の係数.

return

多項式

poly

多項式

var

不定元

deg

自然数

[0] A = (x+y+z)^3;
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
[1] coef(A,1,y);
3*x^2+6*z*x+3*z^2
[2] coef(A,0);
y^3+3*z*y^2+3*z^2*y+z^3
参照

var, deg, mindeg.


[ << ] [ < ] [?] [ > ] [ >> ]         [??] [??] [???] [ ? ]

6.3.5 deg, mindeg

deg(poly,var)

:: poly の, 変数 var に関する最高次数.

mindeg(poly,var)

:: poly の, 変数 var に関する最低次数.

return

自然数

poly

多項式

var

不定元

[0] deg((x+y+z)^10,x);
10
[1] deg((x+y+z)^10,w);
0
[75] mindeg(x^2+3*x*y,x);
1

[ << ] [ < ] [?] [ > ] [ >> ]         [??] [??] [???] [ ? ]

6.3.6 nmono

nmono(rat)

:: rat の単項式の項数.

return

自然数

rat

有理式

[0] nmono((x+y)^10);
11
[1] nmono((x+y)^10/(x+z)^10);
22
[2] nmono(sin((x+y)^10));
1
参照

vtype.


[ << ] [ < ] [?] [ > ] [ >> ]         [??] [??] [???] [ ? ]

6.3.7 ord

ord([varlist])

:: 変数順序の設定

return

変数のリスト

varlist

変数のリスト

[0] ord();
[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,_q,_r,_s,_t,_a,_b,_c,_d,_e,_f,_g,_h,_i,_j,_k,_l,_m,_n,_o,
exp(_x),(_x)^(_y),log(_x),(_x)^(_y-1),cos(_x),sin(_x),tan(_x),
(-_x^2+1)^(-1/2),cosh(_x),sinh(_x),tanh(_x),
(_x^2+1)^(-1/2),(_x^2-1)^(-1/2)]
[1] ord([dx,dy,dz,a,b,c]);
[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,_w,_p,_q,_r,_s,_t,_a,_b,_c,_d,_e,_f,_g,_h,_i,_j,_k,_l,_m,_n,
_o,exp(_x),(_x)^(_y),log(_x),(_x)^(_y-1),cos(_x),sin(_x),tan(_x),
(-_x^2+1)^(-1/2),cosh(_x),sinh(_x),tanh(_x),
(_x^2+1)^(-1/2),(_x^2-1)^(-1/2)]

[ << ] [ < ] [?] [ > ] [ >> ]         [??] [??] [???] [ ? ]

6.3.8 sdiv, sdivm, srem, sremm, sqr, sqrm

sdiv(poly1,poly2[,v])
sdivm(poly1,poly2,mod[,v])

:: poly1poly2 で割る除算が最後まで実行できる場合に商を求める.

srem(poly1,poly2[,v])
sremm(poly1,poly2,mod[,v])

:: poly1poly2 で割る除算が最後まで実行できる場合に剰余を求める.

sqr(poly1,poly2[,v])
sqrm(poly1,poly2,mod[,v])

:: poly1poly2 で割る除算が最後まで実行できる場合に商, 剰余を 求める.

return

sdiv(), sdivm(), srem(), sremm() : 多項式, sqr(), sqrm() : [商,剰余] なるリスト

poly1 poly2

多項式

v

不定元

mod

素数

[0] sdiv((x+y+z)^3,x^2+y+a);    
x+3*y+3*z
[1] srem((x+y+z)^2,x^2+y+a);
(2*y+2*z)*x+y^2+(2*z-1)*y+z^2-a
[2] X=(x+y+z)*(x-y-z)^2;
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
[3] Y=(x+y+z)^2*(x-y-z);  
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
[4] G=gcd(X,Y);
x^2-y^2-2*z*y-z^2
[5] sqr(X,G);
[x-y-z,0]
[6] sqr(Y,G);
[x+y+z,0]
[7] sdiv(y*x^3+x+1,y*x+1);  
divsp: cannot happen
return to toplevel
参照

idiv, irem, %.


[ << ] [ < ] [?] [ > ] [ >> ]         [??] [??] [???] [ ? ]

6.3.9 tdiv

tdiv(poly1,poly2)

:: poly1poly2 で割り切れるかどうか調べる.

return

割り切れるならば商, 割り切れなければ 0

poly1 poly2

多項式

[11] Y=(x+y+z)^5*(x-y-z)^3;  
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
+(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+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-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-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
[12] for(I=0,F=x+y+z,T=Y; T=tdiv(T,F); I++); 
[13] I;
5
参照

sdiv, sdivm, srem, sremm, sqr, sqrm.


[ << ] [ < ] [?] [ > ] [ >> ]         [??] [??] [???] [ ? ]

6.3.10 %

poly % m

:: 整数による剰余

return

整数または多項式

poly

整数または整数係数多項式

m

整数

[0] (x+2)^5 % 3;
x^5+x^4+x^3+2*x^2+2*x+2
[1] (x-2)^5 % 3;
x^5+2*x^4+x^3+x^2+2*x+1
[2] (-5) % 4;
3
[3] irem(-5,4);
-1
参照

idiv, irem.


[ << ] [ < ] [?] [ > ] [ >> ]         [??] [??] [???] [ ? ]

6.3.11 subst, psubst

subst(rat[,varn,ratn]*)
psubst(rat[,var,rat]*)

:: ratvarnratn を代入 (n=1,2,... で左から右に順次代入する).

return

有理式

rat ratn

有理式

varn

不定元

[0] subst(x^3-3*y*x^2+3*y^2*x-y^3,y,2);
x^3-6*x^2+12*x-8
[1] subst(@@,x,-1);
-27
[2] subst(x^3-3*y*x^2+3*y^2*x-y^3,y,2,x,-1);
-27
[3] subst(x*y^3,x,y,y,x);  
x^4
[4] subst(x*y^3,y,x,x,y);    
y^4
[5] subst(x*y^3,x,t,y,x,t,y);
y*x^3
[6] subst(x*sin(x),x,t);
sint(t)*t
[7] psubst(x*sin(x),x,t);
sin(x)*t

[ << ] [ < ] [?] [ > ] [ >> ]         [??] [??] [???] [ ? ]

6.3.12 diff

diff(rat[,varn]*)
diff(rat,varlist)

:: ratvarn あるいは varlist の中の変数で順次微分する.

return

rat

有理式 (初等函数を含んでもよい)

varn

不定元

varlist

不定元のリスト

[0] diff((x+2*y)^2,x);  
2*x+4*y
[1] diff((x+2*y)^2,x,y);
4
[2] diff(x/sin(log(x)+1),x);
(sin(log(x)+1)-cos(log(x)+1))/(sin(log(x)+1)^2)
[3] diff(sin(x),[x,x,x,x]);
sin(x)

[ << ] [ < ] [?] [ > ] [ >> ]         [??] [??] [???] [ ? ]

6.3.13 ediff

ediff(poly[,varn]*)
ediff(poly,varlist)

:: polyvarn あるいは varlist の中の変数で順次オイラー微分する.

return

多項式

poly

多項式

varn

不定元

varlist

不定元のリスト

[0] ediff((x+2*y)^2,x);  
2*x^2+4*y*x
[1] ediff((x+2*y)^2,x,y);
4*y*x

[ << ] [ < ] [?] [ > ] [ >> ]         [??] [??] [???] [ ? ]

6.3.14 res

res(var,poly1,poly2[,mod])

:: var に関する poly1poly2 の終結式.

return

多項式

var

不定元

poly1 poly2

多項式

mod

素数

[0] res(t,(t^3+1)*x+1,(t^3+1)*y+t);
-x^3-x^2-y^3

[ << ] [ < ] [?] [ > ] [ >> ]         [??] [??] [???] [ ? ]

6.3.15 fctr, sqfr

fctr(poly)

:: poly を既約因子に分解する.

sqfr(poly)

:: poly を無平方分解する.

return

リスト

poly

有理数係数の多項式

[0] fctr(x^10-1);
[[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]]
[1] fctr(x^3+y^3+(z/3)^3-x*y*z);
[[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]]
[2] A=(a+b+c+d)^2;
a^2+(2*b+2*c+2*d)*a+b^2+(2*c+2*d)*b+c^2+2*d*c+d^2
[3] fctr(A);
[[1,1],[a+b+c+d,2]]
[4] A=(x+1)*(x^2-y^2)^2; 
x^5+x^4-2*y^2*x^3-2*y^2*x^2+y^4*x+y^4
[5] sqfr(A);
[[1,1],[x+1,1],[-x^2+y^2,2]]
[6] fctr(A);
[[1,1],[x+1,1],[-x-y,2],[x-y,2]]
参照

ufctrhint.


[ << ] [ < ] [?] [ > ] [ >> ]         [??] [??] [???] [ ? ]

6.3.16 ufctrhint

ufctrhint(poly,hint)

:: 次数情報を用いた 1 変数多項式の因数分解

return

リスト

poly

有理数係数の 1 変数多項式

hint

自然数

[10] A=t^9-15*t^6-87*t^3-125;               
t^9-15*t^6-87*t^3-125
0msec
[11] N=res(t,subst(A,t,x-2*t),A);           
-x^81+1215*x^78-567405*x^75+139519665*x^72-19360343142*x^69
+1720634125410*x^66-88249977024390*x^63-4856095669551930*x^60
+1999385245240571421*x^57-15579689952590251515*x^54
+15956967531741971462865*x^51
...
+140395588720353973535526123612661444550659875*x^6
+10122324287343155430042768923500799484375*x^3
+139262743444407310133459021182733314453125
980msec + gc : 250msec
[12] sqfr(N);
[[-1,1],[x^81-1215*x^78+567405*x^75-139519665*x^72+19360343142*x^69
-1720634125410*x^66+88249977024390*x^63+4856095669551930*x^60
-1999385245240571421*x^57+15579689952590251515*x^54
...
-10122324287343155430042768923500799484375*x^3
-139262743444407310133459021182733314453125,1]]
20msec
[13] fctr(N);                               
[[-1,1],[x^9-405*x^6-63423*x^3-2460375,1],
[x^18-486*x^15+98739*x^12-9316620*x^9+945468531*x^6-12368049246*x^3
+296607516309,1],[x^18-8667*x^12+19842651*x^6+19683,1],
[x^18-324*x^15+44469*x^12-1180980*x^9+427455711*x^6+2793253896*x^3
+31524548679,1],
[x^18+10773*x^12+2784051*x^6+307546875,1]]
167.050sec + gc : 1.890sec
[14] ufctrhint(N,9);
[[-1,1],[x^9-405*x^6-63423*x^3-2460375,1],
[x^18-486*x^15+98739*x^12-9316620*x^9+945468531*x^6-12368049246*x^3
+296607516309,1],[x^18-8667*x^12+19842651*x^6+19683,1],
[x^18-324*x^15+44469*x^12-1180980*x^9+427455711*x^6+2793253896*x^3
+31524548679,1],
[x^18+10773*x^12+2784051*x^6+307546875,1]]
119.340sec + gc : 1.300sec
参照

fctr, sqfr.


[ << ] [ < ] [?] [ > ] [ >> ]         [??] [??] [???] [ ? ]

6.3.17 modfctr

modfctr(poly,mod)

:: 有限体上での多項式の因数分解

return

リスト

poly

整数係数の多項式

mod

自然数

[0] modfctr(x^10+x^2+1,2147483647);
[[1,1],[x+1513477736,1],[x+2055628767,1],[x+91854880,1],
[x+634005911,1],[x+1513477735,1],[x+634005912,1],
[x^4+1759639395*x^2+2045307031,1]]
[1] modfctr(2*x^6+(y^2+z*y)*x^4+2*z*y^3*x^2+(2*z^2*y^2+z^3*y)*x+z^4,3);
[[2,1],[2*x^3+z*y*x+z^2,1],[2*x^3+y^2*x+2*z^2,1]]
参照

fctr, sqfr.


[ << ] [ < ] [?] [ > ] [ >> ]         [??] [??] [???] [ ? ]

6.3.18 ptozp

ptozp(poly)

:: poly を有理数倍して整数係数多項式にする.

return

多項式

poly

多項式

[0] ptozp(2*x+5/3);
6*x+5
[1] nm(2*x+5/3);   
2*x+5/3
参照

nm, dn.


[ << ] [ < ] [?] [ > ] [ >> ]         [??] [??] [???] [ ? ]

6.3.19 prim, cont

prim(poly[,v])

:: poly の原始的部分 (primitive part).

cont(poly[,v])

:: poly の容量 (content).

return poly

有理数係数多項式

v

不定元

[0] E=(y-z)*(x+y)*(x-z)*(2*x-y);
(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
[1] prim(E);
2*x^3+(y-2*z)*x^2+(-y^2-z*y)*x+z*y^2
[2] cont(E);
y-z
[3] prim(E,z);
(y-z)*x-z*y+z^2
参照

var, ord.


[ << ] [ < ] [?] [ > ] [ >> ]         [??] [??] [???] [ ? ]

6.3.20 gcd, gcdz

gcd(poly1,poly2[,mod])
gcdz(poly1,poly2)

:: poly1poly2 の gcd.

return

多項式

poly1 poly2

多項式

mod

素数

[0] gcd(12*(x^2+2*x+1)^2,18*(x^2+(y+1)*x+y)^3);
x^3+3*x^2+3*x+1
[1] gcdz(12*(x^2+2*x+1)^2,18*(x^2+(y+1)*x+y)^3);
6*x^3+18*x^2+18*x+6
[2] gcd((x+y)*(x-y)^2,(x+y)^2*(x-y));
x^2-y^2
[3] gcd((x+y)*(x-y)^2,(x+y)^2*(x-y),2);
x^3+y*x^2+y^2*x+y^3
参照

igcd,igcdcntl.


[ << ] [ < ] [?] [ > ] [ >> ]         [??] [??] [???] [ ? ]

6.3.21 red

red(rat)

:: rat を約分したもの.

return

有理式

rat

有理式

[0] (x^3-1)/(x-1);
(x^3-1)/(x-1)
[1] red((x^3-1)/(x-1));
x^2+x+1
[2] red((x^3+y^3+z^3-3*x*y*z)/(x+y+z));
x^2+(-y-z)*x+y^2-z*y+z^2
[3] red((3*x*y)/(12*x^2+21*y^3*x));
(y)/(4*x+7*y^3)
[4] red((3/4*x^2+5/6*x)/(2*y*x+4/3*x));
(9/8*x+5/4)/(3*y+2)
参照

nm, dn, gcd, gcdz, ptozp.


[ << ] [ < ] [?] [ > ] [ >> ]

?????10? 19, 2017?texi2html 5.0????????????