version 1.44, 2019/01/16 05:30:35 |
version 1.45, 2019/02/28 06:56:49 |
|
|
/* $OpenXM: OpenXM/src/asir-contrib/packages/src/os_muldif.rr,v 1.43 2019/01/07 22:49:50 takayama Exp $ */
|
/* $OpenXM: OpenXM/src/asir-contrib/packages/src/os_muldif.rr,v 1.44 2019/01/16 05:30:35 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 - Jan. 2019) |
* Toshio Oshima (Nov. 2007 - Feb. 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) |
|
|
static ID_PLOT$ |
static ID_PLOT$ |
static Rand$ |
static Rand$ |
static LQS$ |
static LQS$ |
|
static SVORG$ |
localf spType2$ |
localf spType2$ |
localf erno$ |
localf erno$ |
localf chkfun$ |
localf chkfun$ |
Line 243 localf seriesHG$ |
|
Line 244 localf seriesHG$ |
|
localf seriesMc$ |
localf seriesMc$ |
localf seriesTaylor$ |
localf seriesTaylor$ |
localf mulpolyMod$ |
localf mulpolyMod$ |
|
localf baseODE$ |
localf taylorODE$ |
localf taylorODE$ |
localf evalred$ |
localf evalred$ |
localf toeul$ |
localf toeul$ |
|
|
extern ID_PLOT$ |
extern ID_PLOT$ |
extern Rand$ |
extern Rand$ |
extern LQS$ |
extern LQS$ |
|
extern SV=SVORG$ |
#endif |
#endif |
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="00190114"$ |
Muldif.rr="00190225"$ |
AMSTeX=1$ |
AMSTeX=1$ |
TeXEq=5$ |
TeXEq=5$ |
TeXLim=80$ |
TeXLim=80$ |
Line 489 LCOPT=["red","green","blue","yellow","cyan","magenta", |
|
Line 492 LCOPT=["red","green","blue","yellow","cyan","magenta", |
|
COLOPT=[0xff,0xff00,0xff0000,0xffff,0xffff00,0xff00ff,0,0xffffff,0xc0c0c0]$ |
COLOPT=[0xff,0xff00,0xff0000,0xffff,0xffff00,0xff00ff,0,0xffffff,0xc0c0c0]$ |
LPOPT=["above","below","left","right"]$ |
LPOPT=["above","below","left","right"]$ |
LFOPT=["very thin","thin","dotted","dashed"]$ |
LFOPT=["very thin","thin","dotted","dashed"]$ |
|
SVORG=["x","y","z","w","u","v","p","q","r","s"]$ |
Canvas=[400,400]$ |
Canvas=[400,400]$ |
LQS=[[1,0]]$ |
LQS=[[1,0]]$ |
|
|
Line 6194 def mulpolyMod(P,Q,X,N) |
|
Line 6198 def mulpolyMod(P,Q,X,N) |
|
return R; |
return R; |
} |
} |
|
|
|
/* Opt: f, var, ord, to, in, TeX */ |
|
def baseODE(L) |
|
{ |
|
if(type(TeX=getopt(TeX))!=1) TeX=0; |
|
if(type(F=getopt(f))!=1) F=0; |
|
In=(getopt(in)==1)?1:0; |
|
if(type(Ord=getopt(ord))!=1&&Ord!=0) Ord=2; |
|
Hgr=0; |
|
if(Ord>3){ |
|
Ord-=4; Hgr=1; |
|
} |
|
if(type(car(L))==4&&type(L[1])==7){ |
|
Tt=L[1];L=car(L); |
|
} |
|
M=N=length(L); |
|
SV=SVORG; |
|
if(type(Var=getopt(var))==4&&(In==1||length(Var)==N)){ |
|
SV=Var; |
|
M=length(SV); |
|
if(type(car(SV))==2){ |
|
for(R=[];SV!=[];SV=cdr(SV)) R=cons(rtostr(car(SV)),R); |
|
SV=reverse(R); |
|
} |
|
}else if(N>10){ |
|
R=[]; |
|
for(K=N-1;K>9;K++) R=cons(SV[floor(K/10)-1]+SV[K%10],R); |
|
SV=append(SV,R); |
|
} |
|
for(I=0;I<M;I++) L=subst(L,makev([SV[I]]), makev([SV[I],0])); |
|
if(TeX){ |
|
for(TL=L,I=0;I<M;I++) |
|
TL=subst(TL,makev([SV[I],0]),makev([SV[I]])); |
|
for(I=0;I<N;I++){ |
|
if(I) S0+=",\\\\\n"; |
|
if(In) S0+=" "+my_tex_form(TL[I])+"=0"; |
|
else S0+=" "+SV[I]+"'\\!\\!\\! &= "+my_tex_form(TL[I]); |
|
} |
|
S0+=".\n"; |
|
S0=texbegin("cases", S0); |
|
S0=texbegin("align",S0); |
|
if(type(Tt)==7) S0=Tt+"\n"+S0; |
|
if(F==-1){ |
|
if(TeX==2) dviout(S0); |
|
return S0; |
|
} |
|
} |
|
if(In) TL=L; |
|
else{ |
|
for(I=0,TL=[];L!=[];L=cdr(L),I++){ |
|
T=makev([SV[I],1])-car(L); |
|
TL=cons(nm(red(T)),TL); |
|
} |
|
} |
|
if(type(T=getopt(to))>0){ |
|
if(type(car(SV))==7) T=rtostr(T); |
|
IT=findin(T,SV); |
|
if(IT>=0 && IT<M){ |
|
R=[SV[IT]]; |
|
for(J=0;SV!=[];SV=cdr(SV),J++){ |
|
if(J==IT) continue; |
|
R=cons(car(SV),R); |
|
} |
|
SV=reverse(R); |
|
}else{ |
|
IT=0; |
|
mycat(["Cannot find variable", T, "!\n"]); |
|
} |
|
} |
|
for(S=1;S<M;S++){ |
|
L=append(TL,L); |
|
TL=reverse(TL); |
|
for(RL=[];TL!=[];TL=cdr(TL)){ |
|
if(In==0&&S==N-1&&length(TL)!=N-IT) continue; |
|
T=car(TL);R=diff(V,t); |
|
for(I=0;I<M;I++){ |
|
for(J=0;J<=S;J++){ |
|
V=makev([SV[I],J]|num=1); |
|
if((DR=diff(T,V))!=0) R+=DR*makev([SV[I],J+1]|num=1); |
|
} |
|
} |
|
RL=cons(R,RL); |
|
} |
|
TL=RL; |
|
} |
|
L=append(TL,L); |
|
for(I=0;I<M;I++) L=subst(L,makev([SV[I],0]),makev([SV[I]])); |
|
for(V=VV=[],I=0;I<M;I++){ |
|
for(J=0;J<M;J++) V=cons(J?makev([SV[I],J]):makev([SV[I]]),V); |
|
if(!I||In) V=cons(makev([SV[0],M]),V); |
|
if(F==-2){ |
|
VV=cons(V,VV); |
|
V=[]; |
|
} |
|
} |
|
if(F>=0&&!chkfun("gr",0)){ |
|
mycat("load(\"gr\"); /* <- do! */\n"); |
|
F=-1; |
|
} |
|
if(F==-2) return [VV,L]; |
|
if(F<0) return [V,L]; |
|
LL=(Hgr==1)?hgr(L,V,Ord):gr(L,V,Ord); |
|
if(F==2) return [V,L,LL]; |
|
if(Ord==2) P=LL[0]; |
|
else{ |
|
P=LL[length(LL)-1]; |
|
for(RV=reverse(V), I=0;I<M+1;I++) RV=cdr(RV); |
|
if(lsort(vars(P),RV,2)!=[]){ |
|
LL=tolex_tl(LL,V,Ord,V,2);P=LL[0]; |
|
} |
|
} |
|
V0=makev([car(SV),M]); |
|
CP=mycoef(P,mydeg(P,V0),V0); |
|
if(cmpsimple(-CP,CP)<0) P=-P; |
|
if(TeX){ |
|
for(V0=[makev([car(SV)])],I=1;I<=M;I++) V0=cons(makev([car(SV),I]),V0); |
|
T="&\\!\\!\\!"+fctrtos(P|var=VV,dic=1,TeX=3); |
|
S=((TeX==3)?(Tt+"\n"):S0)+texbegin("align*",texbegin("split",T)); |
|
if(TeX==2) dviout(S); |
|
return S; |
|
} |
|
return (F==1)? P:[P,V,L,LL]; |
|
} |
|
|
def taylorODE(D){ |
def taylorODE(D){ |
Dif=(getopt(dif)==1)?1:0; |
Dif=(getopt(dif)==1)?1:0; |
if(D==0) return Dif?f:f_00; |
if(D==0) return Dif?f:f_00; |
|
|
return U; |
return U; |
} |
} |
S=strtoascii(S); |
S=strtoascii(S); |
|
if(type(N=getopt(n))>0){ |
|
S=ltov(S); |
|
L=length(S); |
|
R=""; |
|
for(I=J=N=0, V=[];J<L;J++){ |
|
if(S[J]==72) I=J; /* ( */ |
|
else if(S[J]>47&&S[J]<58) N=N*10+S[J]-48; |
|
else{ |
|
if(N>0){ |
|
V=cons(N,V); |
|
N=0; |
|
} |
|
if(S[J]==41){ /* ) */ |
|
|
|
}else if(S[J]==44){ /* , */ |
|
|
|
} |
|
} |
|
} |
|
} |
for(P=TS=[],I=D=0; S!=[]; S=cdr(S)){ |
for(P=TS=[],I=D=0; S!=[]; S=cdr(S)){ |
if((C=car(S))==44){ /* , */ |
if((C=car(S))==44){ /* , */ |
P=cons(D,P);D=0; |
P=cons(D,P);D=0; |