version 1.50, 2019/06/27 02:53:26 |
version 1.54, 2019/08/28 05:10:36 |
|
|
/* $OpenXM: OpenXM/src/asir-contrib/packages/src/os_muldif.rr,v 1.49 2019/05/23 01:47:53 takayama Exp $ */
|
/* $OpenXM: OpenXM/src/asir-contrib/packages/src/os_muldif.rr,v 1.53 2019/08/08 02:33:29 takayama Exp $ */
|
/* The latest version will be at ftp://akagi.ms.u-tokyo.ac.jp/pub/math/muldif |
/* The latest version will be at ftp://akagi.ms.u-tokyo.ac.jp/pub/math/muldif |
scp os_muldif.[dp]* ${USER}@lemon.math.kobe-u.ac.jp:/home/web/OpenXM/Current/doc/other-docs |
scp os_muldif.[dp]* ${USER}@lemon.math.kobe-u.ac.jp:/home/web/OpenXM/Current/doc/other-docs |
*/ |
*/ |
|
|
/* #undef USEMODULE */ |
/* #undef USEMODULE */ |
|
|
/* os_muldif.rr (Library for Risa/Asir) |
/* os_muldif.rr (Library for Risa/Asir) |
* Toshio Oshima (Nov. 2007 - Feb. 2019) |
* Toshio Oshima (Nov. 2007 - Aug. 2019) |
* |
* |
* For polynomials and differential operators with coefficients |
* For polynomials and differential operators with coefficients |
* in rational funtions (See os_muldif.pdf) |
* in rational funtions (See os_muldif.pdf) |
|
|
localf iscombox$ |
localf iscombox$ |
localf sproot$ |
localf sproot$ |
localf spgen$ |
localf spgen$ |
|
localf spbasic$ |
localf chkspt$ |
localf chkspt$ |
localf cterm$ |
localf cterm$ |
localf terms$ |
localf terms$ |
Line 475 extern SV=SVORG$ |
|
Line 476 extern SV=SVORG$ |
|
static S_Fc,S_Dc,S_Ic,S_Ec,S_EC,S_Lc$ |
static S_Fc,S_Dc,S_Ic,S_Ec,S_EC,S_Lc$ |
static S_FDot$ |
static S_FDot$ |
extern AMSTeX$ |
extern AMSTeX$ |
Muldif.rr="00190620"$ |
Muldif.rr="00190807"$ |
AMSTeX=1$ |
AMSTeX=1$ |
TeXEq=5$ |
TeXEq=5$ |
TeXLim=80$ |
TeXLim=80$ |
|
|
}else{ |
}else{ |
L0=0; L1=MO+1; |
L0=0; L1=MO+1; |
} |
} |
if(MO<=0){ |
if(M0<=0){ |
MO=-MO; |
MO=-MO; |
if(iand(MO,1)==1) return []; |
if(iand(MO,1)==1) return []; |
if(MO>1){ |
MO=MO/2; |
if(isMs()==0) return []; |
B=spbasic(-2*MO,0|str=1); |
Cmd="okubo "+rtostr(-MO); |
if(L1<3) L1=MO+4; |
MO/=2; |
|
if(L1>0) Cmd=Cmd+"+"+rtostr(L0)+"-"+rtostr(L1); |
|
else L1=MO+4; |
|
Cmd=Cmd+" B"; |
|
Id=getbyshell(Cmd); |
|
if(Id<0) return []; |
|
B=[]; |
|
while((S=get_line(Id)) !=0){ |
|
P0=str_chr(S,1,":")+1; |
|
if(P0>1){ |
|
P1=str_chr(S,P,"\n"); |
|
if(P1<0) P1=str_len(S); |
|
B=cons(sub_str(S,P0,P1-1),B); |
|
} |
|
} |
|
close_file(Id); |
|
}else{ |
|
MO/=2; |
|
if(L1<=1) L1=MO+4; |
|
BB=[ |
|
["11,11,11,11","111,111,111","1^4,1^4,22","1^6,222,33"], |
|
["11,11,11,11,11","1^4,1^4,211","211,22,22,22","1^6,2211,33", |
|
"2211,222,222","22211,2^4,44","2^511,444,66","1^4,22,22,31", |
|
"2^5,3331,55","1^5,1^5,32","1^8,332,44","111,111,21,21","1^5,221,221"], |
|
["11,11,11,11,11,11","1^4,1^4,1^4","1^4,22,22,22","111,111,111,21", |
|
"1^6,21^4,33","21^4,222,222","221^4,2^4,44","2^41^4,444,66", |
|
"1^5,1^5,311","1^8,3311,44","1^6,222,321","321,33,33,33", |
|
"3321,333,333","33321,3^4,66","3^721,666,99","2^5,3322,55", |
|
"1^6,1^6,42","222,33,33,42","1^a,442,55","1^6,33,33,51", |
|
"222,222,33,51","1^9,333,54","2^7,554,77","1^5,2111,221", |
|
"2^41,333,441","1^7,2221,43","211,211,22,22","2211,2211,222", |
|
"22211,22211,44","1^4,211,22,31","2^411,3331,55","1^4,1^4,31,31", |
|
"22,22,22,31,31","1^7,331,331","2221,2221,331","111,21,21,21,21"], |
|
["11,11,11,11,11,11,11","111,111,111,111","1^6,1^6,33", |
|
"1^6,222,222","222,33,33,33","1^5,1^5,221", |
|
"1^4,211,22,22","1^4,1^4,22,31","22,22,22,22,31", |
|
"111,111,21,21,21","21^6,2^4,44","2221^6,444,66", |
|
"1^6,222,3111","3111,33,33,33","33111,333,333", |
|
"333111,3^4,66","3^5111,666,99","2^5,33211,55", |
|
"1^8,3221,44","3222,333,333","33222,3^4,66", |
|
"3^4222,666,99","1^6,1^6,411","222,33,33,411", |
|
"1^a,4411,55","2^4,2^4,431","431,44,44,44", |
|
"2^6,4431,66","4431,444,444","44431,4^4,88", |
|
"4^531,888,cc","1^a,433,55","1^7,1^7,52", |
|
"1^c,552,66","3^4,444,552","1^8,2^4,53", |
|
"1^8,44,44,71","3^5,555,771","21^4,2211,222", |
|
"221^4,22211,44","2221^4,3331,55","1^6,2211,321", |
|
"2^411,3322,55","1^7,322,331","2211,33,33,42", |
|
"3^42,4442,77","2211,222,33,51","3^51,5551,88", |
|
"2^611,554,77","2221,2221,322","2^41,2^41,54", |
|
"1^5,2111,2111","222111,333,441","1^7,22111,43", |
|
"1^5,1^5,41,41","1^9,441,441","22111,2221,331", |
|
"1^5,221,32,41","221,221,221,41","211,211,211,22", |
|
"2211,2211,2211","1^4,211,211,31","211,22,22,31,31", |
|
"1^4,22,31,31,31","1^5,32,32,32","221,221,32,32","21,21,21,21,21,21"], |
|
["11,11,11,11,11,11,11,11","1^4,1^4,22,22","1^8,2^4,44", |
|
"1^6,2211,222","2211,33,33,33","111,111,111,21,21", |
|
"1^5,1^5,2111","1^4,211,211,22","1^4,1^4,211,31", |
|
"211,22,22,22,31","1^4,22,22,31,31","111,21,21,21,21,21", |
|
"221^8,444,66","2^5,331^4,55","1^8,32111,44", |
|
"32211,333,333","332211,3^4,66","3^42211,666,99", |
|
"2^5,32221,55","1^7,1^7,511","1^c,5511,66", |
|
"3^4,444,5511","541,55,55,55","5541,555,555", |
|
"55541,5^4,aa","5^541,aaa,ff","1^8,1^8,62", |
|
"1^a1^4,662,77","1^a,55,55,91","2^71,555,87", |
|
"21^6,22211,44","221^6,3331,55","1^6,2211,3111", |
|
"2^411,33211,55","1^7,3211,331","2211,33,33,411", |
|
"3^42,44411,77","22211,2^4,431","2^511,4431,66", |
|
"1^8,332,431","3^42,4433,77","1^8,22211,53", |
|
"2221,2221,3211","221^5,333,441","1^7,21^5,43", |
|
"1^b,443,65","21^5,2221,331","2^51,3332,65", |
|
"21^4,21^4,222","221^4,221^4,44","1^6,21^4,321", |
|
"2221^4,3322,55","21^4,33,33,42","21^4,222,33,51", |
|
"2^51^4,554,77","2^4,3311,3311","3^411,4442,77", |
|
"321,321,33,33","3321,3321,333","33321,33321,66", |
|
"222,321,33,42","1^6,321,33,51","222,222,321,51", |
|
"1^9,3321,54","1^7,322,322","3^422,5551,88", |
|
"1^6,33,42,42","1^6,222,42,51","33,33,33,42,51", |
|
"1^6,1^6,51,51","222,33,33,51,51","1^b,551,551", |
|
"1^5,221,311,41","2^41,3321,441","22111,2221,322", |
|
"2^51,443,551","222111,2^41,54","21^4,2211,2211", |
|
"1^5,311,32,32","3331,3331,442","2211,2211,33,51", |
|
"221,221,311,32","22111,22111,331","1^5,2111,32,41", |
|
"2111,221,221,41","2111,221,32,32","211,211,211,211", |
|
"211,211,22,31,31","1^4,211,31,31,31","22,22,31,31,31,31"], |
|
["11,11,11,11,11,11,11,11,11","1^5,1^5,1^5","2^5,2^5,55", |
|
"111,111,111,111,21","2^41,333,333","1^4,1^4,211,22", |
|
"211,22,22,22,22","1^8,22211,44","1^4,1^4,1^4,31", |
|
"1^4,22,22,22,31","1^7,1^7,43","1^7,2221,331", |
|
"2221,2221,2221","1^6,21^4,222","21^4,33,33,33", |
|
"1^6,1^6,321","222,321,33,33","1^6,33,33,42", |
|
"222,222,33,42","1^6,222,33,51","222,222,222,51", |
|
"33,33,33,33,51","1^6,2211,2211","111,111,21,21,21,21", |
|
"1^5,1^5,32,41","1^5,221,221,41","1^5,221,32,32", |
|
"221,221,221,32","1^4,211,211,211","211,211,22,22,31", |
|
"1^4,211,22,31,31","1^4,1^4,31,31,31","22,22,22,31,31,31", |
|
"21,21,21,21,21,21,21","21^a,444,66","1^8,31^5,44", |
|
"321^4,333,333","3321^4,3^4,66","3^421^4,666,99", |
|
"2^5,322111,55","32^41,3^4,66","3332^41,666,99", |
|
"1^8,1^8,611","2^4,44,44,611","1^d,6611,77", |
|
"4^5,66611,aa","2^6,444,651","3^4,3^4,651", |
|
"651,66,66,66","3^6,6651,99","6651,666,666", |
|
"66651,6^4,cc","6^551,ccc,ii","2^8,655,88", |
|
"1^9,1^9,72","1^g,772,88","1^c,444,75", |
|
"2^6,3^4,75","1^c,66,66,b1","3^4,444,66,b1", |
|
"3^7,777,ba","1^7,2221,4111","2^41,333,4311", |
|
"1^9,2^41,63","21^8,3331,55","2^411,331^4,55", |
|
"1^7,31^4,331","2^411,32221,55","22211,2^4,422", |
|
"2^511,4422,66","1^8,332,422","2^5,3331,541", |
|
"22211,44,44,62","2^411,2^5,64","2^711,664,88", |
|
"1^a,3331,64","2221,2221,31^4","21^7,333,441", |
|
"333,333,441,81","2^6111,555,87","21^6,221^4,44", |
|
"221^6,3322,55","2^41^6,554,77","1^6,21^4,3111", |
|
"3111,321,33,33","33111,3321,333","333111,33321,66", |
|
"222,3111,33,42","1^6,3111,33,51","222,222,3111,51", |
|
"1^9,33111,54","2221^4,33211,55","1^7,3211,322", |
|
"3^4211,5551,88","2^4,3221,3311","333221,4442,77", |
|
"3222,3321,333","33222,33321,66","1^9,3222,54", |
|
"21^4,33,33,411","3^411,44411,77","222,321,33,411", |
|
"1^6,33,411,42","1^6,222,411,51","33,33,33,411,51", |
|
"221^4,2^4,431","2^41^4,4431,66","1^8,3311,431", |
|
"3^411,4433,77","33321,444,552","1^8,221^4,53", |
|
"3311,44,44,53","4^42,5553,99","2^4,3311,44,71", |
|
"3^421,555,771","4^52,7771,bb","3^611,776,aa", |
|
"2^41,33111,441","22111,2221,3211","2^41,3222,441", |
|
"2^61,4441,76","3331,3331,4411","22211,22211,431", |
|
"3331,3331,433","3^41,3^41,76","1^7,1^7,61,61", |
|
"1^d,661,661","21^5,2221,322","221^5,2^41,54", |
|
"2^51,33311,65","21^5,22111,331","3^41,4441,661", |
|
"1^7,331,43,61","2221,2221,43,61","2221,331,331,61", |
|
"21^4,21^4,2211","21^4,2211,33,51","22211,3311,3311", |
|
"1^5,311,311,32","2211,321,33,42","2211,222,321,51", |
|
"3322,3331,442","2211,222,42,42","2^411,442,442", |
|
"1^6,2211,42,51","2211,33,33,51,51","221,221,311,311", |
|
"1^5,2111,311,41","222111,3321,441","22111,22111,322", |
|
"222111,222111,54","2111,221,311,32","2111,2111,221,41", |
|
"1^5,221,41,41,41","2221,43,43,43","1^5,32,32,41,41", |
|
"331,331,43,43","221,221,32,41,41","221,32,32,32,41", |
|
"211,211,211,31,31","211,22,31,31,31,31","1^4,31,31,31,31,31"]]; |
|
B=BB[MO]; |
|
} |
|
if(St!=1){ |
if(St!=1){ |
for(R=[]; B!=[]; B=cdr(B)){ |
for(R=[]; B!=[]; B=cdr(B)){ |
RT=F?s2sp(car(B)|std=F):s2sp(car(B)); |
RT= F?s2sp(car(B)|std=F): s2sp(car(B)); |
if(length(RT)<L0 || length(RT)>L1) continue; |
if(length(RT)<L0 || length(RT)>L1) continue; |
R=cons(RT,R); |
R=cons(RT,R); |
} |
} |
|
|
return LL; |
return LL; |
} |
} |
|
|
|
def spbasic(Idx,D) |
|
{ |
|
/* |
|
D<=3|Idx|+6, D<=|Idx|+2 (p>3), p<=|Idx|/2+4 |
|
Idx=2*D^2-(D^2-\sum m_{j,\nu}^2); \sum(D-m_{j,1})>=2*D; |
|
\sum (m_{j,1)-m_{j,\nu})*m_{j,\nu) |
|
0<=(2*D-\sum(D-m_{j,1})})*D=\sum_(m_{j,1}-m_{j,\mu})*m_{j,\nu} -|Idx| |
|
(-2,0) 13 (9+3+?) |
|
(-4,0) 37 (25+9+?) |
|
(-6,0) : 8.5sec ?sec 0.05sec 69 (46+17+?) |
|
(-8,0) : 97 sec 1sec 0.13sec 113 (73+29+?) <- (-2,0) |
|
(-10,0): 4sec 0.27sec 198 (127+50+?) |
|
@(-12,0) 28sec 4.2sec 0.64sec 291 (182+76+?) |
|
(-14,0) 27sec 10.2sec 1.31sec 415 (249+115+?) |
|
(-16,0) 34.0sec 2.47sec 647 (395+172+?) <- (-4,0) |
|
(-18,0) 4.42sec 883 (521+243+?) <- (-2,0) |
|
(-20,0) 8.17sec 1186 (680+345+?) |
|
*/ |
|
Idx=-Idx; |
|
if((Str=getopt(str))!=1) Str=0; |
|
if(!isint(Idx)||!isint(Idx/2)||Idx<0||!isint(D)||D<0||D==1||D>3*Idx+6) return []; |
|
if(D==0){ |
|
for(R=[],D=3*Idx+6;D>=2;D--) R=append(spbasic(-Idx,D|str=Str),R); |
|
return R; |
|
} |
|
if(!Idx){ |
|
R=0; |
|
if(D==2) R="11,11,11,11"; |
|
if(D==3) R="111,111,111"; |
|
if(D==4) R="22,1111,1111"; |
|
if(D==6) R="33,222,111111"; |
|
if(!R) return []; |
|
return [(Str==1)?R:s2sp(R)]; |
|
} |
|
if(D>Idx+2){ |
|
L=3; |
|
if(D==3*Idx+6){ |
|
R=[[D/2,D/2],[D/3,D/3,D/3],[D/6,D/6,D/6,D/6,D/6,D/6-1,1]]; |
|
return [(Str==1)?s2sp(R):R]; |
|
} |
|
if(iand(D,1)&&(D-3)/2>Idx) return []; |
|
}else L=Idx/2+4; |
|
V=newvect(L);SV=newvect(L); |
|
for(S1=[],I=0;I<D;I++) S1=cons(1,S1); |
|
for(T=D-1;T>1;T--){ |
|
K=D%T; |
|
if((T-K)*K<=Idx) break; |
|
} |
|
J=(T-K)*K;SJ=K^2+(D-K)*T; |
|
TV=K?[K]:[]; |
|
for(I=(D-K)/T;I>0;I--) TV=cons(T,TV); |
|
for(I=0;I<L;I++){ |
|
SV[I]=2*D^2-(I+1)*(D^2-J)-Idx; |
|
V[I]=TV; |
|
} |
|
if(SV[2]>0) return []; |
|
if(D>Idx+2 && V[0][0]+V[1][0]>=D && V[1][0]>1){ |
|
T=V[1][0]-1;K=D%T;TV=K?[K]:[]; |
|
for(I=(D-K)/T;I>0;I--) TV=cons(T,TV); |
|
V[1]=V[2]=TV; |
|
} |
|
for(R=[];;){ |
|
if(D>Idx+2){ |
|
if(3*V[0][0]<D) break; |
|
if(V[0][0]+V[1][0]>=D && (T=D-V[0][0]-1)>0){ |
|
K=D%T;TV=K?[K]:[]; |
|
for(I=(D-K)/T;I>0;I--) TV=cons(T,TV); |
|
V[1]=V[2]=TV; |
|
} |
|
S2=V[0][0]+V[1][0]+V[2][0]-D; |
|
if(V[0][0]+2*V[1][0]<D ||(S2<0&&V[1][0]==1) ){ |
|
V[0]=V[1]=V[2]=nextpart(V[0]); |
|
T=V[0][0]; |
|
T=D-2*T; |
|
if(T==0){ |
|
V[1]=[D/2-1,1]; |
|
V[2]=S1; |
|
}else if(T>0){ |
|
J=D%T; |
|
K=J?[J]:[]; |
|
for(J=(D-J)/T;J>0;J--) K=cons(T,K); |
|
V[2]=K; |
|
} |
|
continue; |
|
} |
|
if(S2<0||V[2][0]<=S2){ |
|
V[1]=V[2]=nextpart(V[1]); |
|
continue; |
|
}else if(S2>0){ |
|
T=V[2][0]-S2;J=D%T; |
|
K=J?[J]:[]; |
|
for(J=(D-J)/T;J>0;J--) K=cons(T,K); |
|
V[2]=K; |
|
} |
|
} |
|
for(S=-2*D,IL=0;IL<L;IL++){ |
|
S+=D-car(V[IL]); |
|
if(S>=0) break; |
|
} |
|
if((I=IL)==L){ /* reducible i.e. IL=L && S<0 */ |
|
for(LL=L-1;LL>=0;LL--){ |
|
if((K=car(V[LL]))+S>0){ |
|
K+=S; |
|
for(TV=[],TD=D;TD>=K;TD-=K) TV=cons(K,TV); |
|
if(TD>0) V[LL]=append(TV,[TD]); |
|
else V[LL]=TV; |
|
break; |
|
}else{ |
|
S+=K-1; |
|
V[LL]=S1; |
|
} |
|
} |
|
if(LL<0) break; |
|
continue; |
|
} |
|
for(S0=K=0;K<=IL;K++){ |
|
ST=car(V[K]);J=V[K][length(V[K])-1];S0+=(ST-J)*J; |
|
if(S0>Idx) break; |
|
} |
|
if(S0>Idx && car(V[K])!=1){ |
|
ST=car(V[K]); |
|
S0-=(ST-J)*J; |
|
for(ST--;ST>0;ST--){ |
|
J=D%ST; |
|
if(S0+(ST-J)*J <= Idx) break; |
|
} |
|
V[K]=J?[J]:[]; |
|
for(J=D-J;J>0;J-=ST) V[K]=cons(ST,V[K]); |
|
for(J=K+1;J<L;J++) V[J]=V[K]; |
|
continue; |
|
} |
|
|
|
for(K=SS=0;K<L&&SS<=Idx;K++){ |
|
ST=car(V[K]); |
|
for(S0=0,TV=cdr(V[K]);TV!=[];TV=cdr(TV)) S0+=(ST-car(TV))*car(TV); |
|
SS+=S0; |
|
} |
|
if(SS>Idx && K<=IL && K!=L){ |
|
SS0=Idx-SS+S0; |
|
for(TV=car(V[K]);TV>1;TV--){ |
|
U=D%TV; |
|
if((D-U)*U<=SS0) break; |
|
} |
|
if(TV==car(V[K])){ |
|
K=K-1; |
|
V[K]=nextpart(V[K]); /* to be improves */ |
|
}else{ |
|
V[K]=U?[U]:[]; /* to be improved */ |
|
for(J=D-U;J>0;J-=TV) V[K]=cons(TV,V[K]); |
|
} |
|
for(J=K+1;J<L;J++) V[J]=V[K]; |
|
continue; |
|
} |
|
|
|
for(Ix=2*D^2+Idx,J=0;J<L;J++){ |
|
IxF=Ix; |
|
for(Ix-=D^2,TV=V[J];TV!=[];TV=cdr(TV)) Ix+=car(TV)^2; |
|
if(Ix<=0) break; |
|
} |
|
if(Ix==0&&(J>=I||IL==2)){ |
|
for(TR=[],K=J;K>=0;K--) TR=cons(V[K],TR); |
|
R=cons((Str==1)?s2sp(TR):TR,R); |
|
} |
|
if(J>=0 && J<L && Ix<=0){ |
|
I=V[J][0];K=D%I;S0=(D-K)*I+K^2; |
|
if(I>1&& IxF-D^2+S0<0){ |
|
for(V[J]=[],K=D-I;K>0;K--) V[J]=cons(1,V[J]); |
|
V[J]=cons(I,V[J]); |
|
V[J]=nextpart(V[J]); |
|
for(I=J+1;I<L;I++) V[I]=V[J]; |
|
continue; |
|
} |
|
} |
|
if(J>=0 && J<L && Ix<=0 && car(V[J])>(U=V[J][length(V[J])-1])+1){ |
|
TV=reverse(V[J]); |
|
for(S0=0,K=[];TV!=[];TV=cdr(TV),S0++){ |
|
if((I=car(TV))<U+2||(length(TV)>1&&S0<2)){ |
|
while(I-->0) K=cons(1,K); |
|
}else K=cons(car(TV),K); |
|
} |
|
V[I=J]=K; |
|
}else{ |
|
if(J>=L) J=L-1; |
|
for(I=J;I>=0&&length(V[I])==D;I--); |
|
if(I<0) break; |
|
} |
|
V[I]=nextpart(V[I]); /* to be improved */ |
|
for(J=I+1;J<L;J++) V[J]=V[I]; |
|
} |
|
return R; |
|
} |
|
|
def spType2(L) |
def spType2(L) |
{ |
{ |
C=0;R=[]; |
C=0;R=[]; |
Line 10816 def my_tex_form(S) |
|
Line 10868 def my_tex_form(S) |
|
} |
} |
SS = cons(S[I], SS); |
SS = cons(S[I], SS); |
} |
} |
|
SS=str_subst(SS,"\n\\\\\n\\end{pmatrix}","\n\\end{pmatrix}"|raw=1); |
SS=str_subst(SS,"\\\\\n\\end{pmatrix}","\n\\end{pmatrix}"|raw=1); |
SS=str_subst(SS,"\\\\\n\\end{pmatrix}","\n\\end{pmatrix}"|raw=1); |
Subst=getopt(subst); |
Subst=getopt(subst); |
Sub0=["{asin}","{acos}","{atan}"]; |
Sub0=["{asin}","{acos}","{atan}"]; |
|
|
S+=N[I]; |
S+=N[I]; |
} |
} |
M=newbmat(K,K,reverse(M)); |
M=newbmat(K,K,reverse(M)); |
|
NR=N; |
N=S; |
N=S; |
}else{ |
}else{ |
if(type(X)==7) X=strtov(X); |
if(type(X)==7) X=strtov(X); |
|
|
} |
} |
} |
} |
} |
} |
if(getopt(get)==1){ |
if((Get=getopt(get))==1){ |
for(R=[],I=0;I<N;I++){ |
for(R=[],I=0;I<N;I++){ |
U=newmat(N,N); |
U=newmat(N,N); |
for(J=0;J<N;J++) U[J][J]=M[J][I]; |
for(J=0;J<N;J++) U[J][J]=M[J][I]; |
R=cons(map(red,myinv(M)*U*M),R); |
R=cons(map(red,myinv(M)*U*M),R); |
} |
} |
return reverse(R); |
return reverse(R); |
|
}else if(Get==2||Get==3||Get==4){ |
|
for(V=[],I=N;I>0;I--) V=cons(makev(["a0",I]),V); |
|
MI=myinv(M); |
|
V=ltov(V)*MI; |
|
for(R=[],I=0;I<N;I++){ |
|
for(J=I+1;J<N;J++){ |
|
K=newmat(N,N); |
|
K[I][I]=V[J];K[I][J]=-V[J];K[J][J]=V[I];K[J][I]=-V[I]; |
|
R=cons(map(red,MI*K*M),R); |
|
} |
|
} |
|
R=reverse(R); |
|
if(Get==2||length(NR)!=2||Z==1) return R; |
|
for(V1=[],I=NR[0];I>0;I--) V1=cons(os_md.makev([X[0],I]),V1); |
|
for(V2=[],I=NR[1];I>0;I--) V2=cons(os_md.makev([X[1],I]),V2); |
|
R=subst(R,car(V1),0,car(V2),0); |
|
V1=subst(V1,car(V1),0); |
|
V2=subst(V2,car(V2),0); |
|
for(V=[],S=V1;S!=[];S=cdr(S)) for(T=V2;T!=[];T=cdr(T)) V=cons(car(T)-car(S),V); |
|
V=reverse(V); |
|
Mx=length(V); |
|
for(A0=[],I=J=NR[0]-1;J>=0;I+=--J) for(K=0;K<NR[1];K++,I++) A0=cons(R[I],A0); |
|
A0=reverse(A0); |
|
for(F0=[],T=1,I=Mx-1;I>=0;I--) F0=cons(1/(x-V[I]), F0); |
|
MV=confexp([F0,V]|sym=3); |
|
RR=newvect(Mx); |
|
for(K=0;K<Mx;K++) for(RR[K]=0,I=0;I<Mx;I++) RR[K]=map(red,RR[K]+MV[I][K]*A0[I]); |
|
RR0=mysubst(RR,[append(cdr(V1),cdr(V2)),vtol(newvect(Mx-2))]|lpair=1); |
|
RR0=vtol(RR0); |
|
return (Get==3)?[RR,RR0]:RR0; |
} |
} |
return M; |
return M; |
} |
} |
|
|
def confexp(S) |
def confexp(S) |
{ |
{ |
|
if((Sym=getopt(sym))==1||Sym==2||Sym==3){ |
|
D=polbyroot(S[1],x); |
|
for(R=[],T=S[0];T!=[];T=cdr(T)){ |
|
M=D*car(T); |
|
if(type(M)>3) M=map(red,M); |
|
else M=red(M); |
|
R=cons(M,R); |
|
} |
|
R=reverse(R); |
|
if(Sym==2) return R; |
|
M=length(R);N=length(S[1]); |
|
E=newmat(M,N); |
|
for(I=0;I<M;I++){ |
|
for(J=0;J<N;J++) E[I][J]=mycoef(R[I],N-J-1,x); |
|
} |
|
if(Sym==3){ |
|
for(R=[],P=1,T=S[1];T!=[];T=cdr(T)) R=cons(P/=(x-car(T)),R); |
|
R=confexp([reverse(R),S[1]]|sym=1); |
|
return E*myinv(R); |
|
} |
|
return E; |
|
} |
if(type(S[0])==4){ |
if(type(S[0])==4){ |
for(E=[];S!=[];S=cdr(S)) |
for(E=[];S!=[];S=cdr(S)) E=cons(confexp(car(S),E)); |
E=cons(confexp(car(S),E)); |
|
return reverse(E); |
return reverse(E); |
} |
} |
V=x;E=[]; |
V=x;E=[]; |