version 1.9, 2017/05/11 04:55:18 |
version 1.17, 2017/06/19 02:10:04 |
|
|
/* $OpenXM: OpenXM/src/asir-contrib/packages/src/os_muldif.rr,v 1.8 2017/05/10 02:37:37 takayama Exp $ */
|
/* $OpenXM: OpenXM/src/asir-contrib/packages/src/os_muldif.rr,v 1.16 2017/06/08 06:41:51 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 - Apr. 2017) |
* Toshio Oshima (Nov. 2007 - June 2017) |
* |
* |
* 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) |
Line 22 static Muldif.rr$ |
|
Line 22 static Muldif.rr$ |
|
static TeXEq$ |
static TeXEq$ |
static TeXLim$ |
static TeXLim$ |
static DIROUT$ |
static DIROUT$ |
|
static DIROUTD$ |
static DVIOUTL$ |
static DVIOUTL$ |
static DVIOUTA$ |
static DVIOUTA$ |
static DVIOUTB$ |
static DVIOUTB$ |
static DVIOUTH$ |
static DVIOUTH$ |
static DVIOUTF$ |
static DVIOUTF$ |
static FCAT$ |
|
static LCOPT$ |
static LCOPT$ |
static COLOPT$ |
static COLOPT$ |
static LPOPT$ |
static LPOPT$ |
|
|
localf myatan$ |
localf myatan$ |
localf mylog$ |
localf mylog$ |
localf mypow$ |
localf mypow$ |
|
localf scale$ |
localf arg$ |
localf arg$ |
localf sqrt$ |
localf sqrt$ |
localf gamma$ |
localf gamma$ |
Line 425 extern Muldif.rr$ |
|
Line 426 extern Muldif.rr$ |
|
extern TeXEq$ |
extern TeXEq$ |
extern TeXLim$ |
extern TeXLim$ |
extern DIROUT$ |
extern DIROUT$ |
|
extern DIROUTD$ |
extern DVIOUTL$ |
extern DVIOUTL$ |
extern DVIOUTA$ |
extern DVIOUTA$ |
extern DVIOUTB$ |
extern DVIOUTB$ |
extern DVIOUTH$ |
extern DVIOUTH$ |
extern DVIOUTF$ |
extern DVIOUTF$ |
extern FCAT$ |
|
static LCOPT$ |
static LCOPT$ |
static COLOPT$ |
static COLOPT$ |
static LPOPT$ |
static LPOPT$ |
|
|
extern LQS$ |
extern LQS$ |
#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="00170510"$ |
Muldif.rr="00170612"$ |
AMSTeX=1$ |
AMSTeX=1$ |
TeXEq=5$ |
TeXEq=5$ |
TeXLim=80$ |
TeXLim=80$ |
Line 465 DVIOUTL="%ASIRROOT%\\bin\\risatex0.bat"$ |
|
Line 466 DVIOUTL="%ASIRROOT%\\bin\\risatex0.bat"$ |
|
DVIOUTA="%ASIRROOT%\\bin\\risatex.bat"$ |
DVIOUTA="%ASIRROOT%\\bin\\risatex.bat"$ |
DVIOUTB="%ASIRROOT%\\bin\\risatex1%TikZ%.bat"$ |
DVIOUTB="%ASIRROOT%\\bin\\risatex1%TikZ%.bat"$ |
DVIOUTH="start dviout -2 -hyper=0x90 \"%ASIRROOT%\\help\\os_muldif.dvi\" #%LABEL%"$ |
DVIOUTH="start dviout -2 -hyper=0x90 \"%ASIRROOT%\\help\\os_muldif.dvi\" #%LABEL%"$ |
FCAT="%TEMP%\\fcat.txt"$ |
|
DVIOUTF=0$ |
DVIOUTF=0$ |
LCOPT=["red","green","blue","yellow","cyan","magenta","black","white","gray"]$ |
LCOPT=["red","green","blue","yellow","cyan","magenta","black","white","gray"]$ |
COLOPT=[0xff,0xff00,0xff0000,0xffff,0xffff00,0xff00ff,0,0xffffff,0xc0c0c0]$ |
COLOPT=[0xff,0xff00,0xff0000,0xffff,0xffff00,0xff00ff,0,0xffffff,0xc0c0c0]$ |
|
|
def fcat(S,X) |
def fcat(S,X) |
{ |
{ |
if(type(S)!=7){ |
if(type(S)!=7){ |
if(S==-1) return FCAT; |
T="fcat"; |
if(S==0&&access(FCAT)) remove(FCAT); |
if(S>=2&&S<=9) T+=rtostr(S); |
S=FCAT; |
T=DIROUTD+T+".txt"; |
|
if(S==-1) return T; |
|
if(S!=0&&access(T)) remove_file(T); |
|
S=T; |
} |
} |
output(S); |
output(S); |
print(X); |
print(X); |
output(); |
output(); |
|
if(getopt(exe)==1) shell("\""+S+"\""); |
} |
} |
|
|
def mycat0(L,T) |
def mycat0(L,T) |
|
|
|
|
def countin(S,M,L) |
def countin(S,M,L) |
{ |
{ |
if(((Step=getopt(step))==1)||Step==-1){ |
Step=getopt(step); |
|
if(type(Step)==1){ |
|
N=(Step>0)?Step:-Step; |
if(type(L)==5) L=vtol(L); |
if(type(L)==5) L=vtol(L); |
L=qsort(L); |
L=qsort(L); |
while(car(L)<S&&L!=[]) L=cdr(L); |
while(car(L)<S&&L!=[]) L=cdr(L); |
S+=M; |
S+=M; |
for(R=[],C=0;L!=[];){ |
for(R=[],C=I=0;L!=[];){ |
if(car(L)<S||(Step==1&&car(L)==S)){ |
if(car(L)<S||(Step>0&&car(L)==S)){ |
C++; |
C++; |
L=cdr(L); |
L=cdr(L); |
}else{ |
}else{ |
R=cons(C,R);C=0;S+=M; |
R=cons(C,R);C=0;S+=M; |
|
if(N>1&&++I>=N) break; |
} |
} |
} |
} |
if(C>0) R=cons(C,R); |
if(C>0) R=cons(C,R); |
|
if(N>1&&(N-=length(R))>0) while(N-->0) R=cons(0,R); |
return reverse(R); |
return reverse(R); |
} |
} |
if(type(L)==4){ |
if(type(L)==4){ |
Line 1235 def mulseries(V1,V2) |
|
Line 1243 def mulseries(V1,V2) |
|
return VV; |
return VV; |
} |
} |
|
|
|
def scale(L) |
|
{ |
|
T=0;LS=1; |
|
if(type(L)!=4){ |
|
if(L==2){ |
|
L=[[[1,2,1/20],[2,5,1/10],[5,10,1/5], [10,20,1/2],[20,50,1],[50,100,2]], |
|
[[1,2,1/10],[2,5,1/2], [10,20,1],[20,50,5]], |
|
[[1,2,1/2],[2,10,1], [10,20,5],[20,100,10]]]; |
|
LS=2; |
|
}else if(L==3){ |
|
L=[[[1,2,1/20],[2,5,1/10],[5,10,1/5], [10,20,1/2],[20,50,1],[50,100,2], |
|
[100,200,5],[200,500,10],[500,1000,20]], |
|
[[1,2,1/10],[2,5,1/2], [10,20,1],[20,50,5], [100,200,10],[200,500,50]], |
|
[[1,2,1/2],[2,10,1], [10,20,5],[20,100,10], [100,200,50],[200,1000,100]]]; |
|
LS=3; |
|
}else{ |
|
L=[[[1,2,1/50],[5,10,1/2],[5,10,1/10]],[[1,5,1/10],[5,10,1/2]], |
|
[[1,5,1/2],[5,10,1]]]; |
|
} |
|
}else if(type(L[0])!=4){ |
|
L=[L]; |
|
if(length(L)!=3||L[0]+L[2]>L[1]) T=L; |
|
} |
|
if(T==0){ |
|
if(type(L[0][0])!=4) L=[L]; |
|
for(R=[];L!=[];L=cdr(L)){ |
|
for(RR=[],LT=car(L);LT!=[];LT=cdr(LT)) |
|
for(I=car(LT)[0];I<=car(LT)[1];I+=car(LT)[2]) RR=cons(I,RR); |
|
RR=lsort(RR,[],1); |
|
R=cons(RR,R); |
|
} |
|
R=reverse(R); |
|
for(T=[];R!=[];R=cdr(R)){ |
|
if(length(R)>1) T=cons(lsort(R[0],R[1],"setminus"),T); |
|
else T=cons(R[0],T); |
|
} |
|
} |
|
V0=dlog(10); |
|
S0=S1=1;D0=D1=0; |
|
SC=getopt(scale); |
|
if(type(SC)==4){ |
|
S0=SC[0];S1=SC[1]; |
|
}else if(type(S)==1){ |
|
S0=S;S1=0; |
|
}else return T; |
|
if(type(D=getopt(shift))==4){ |
|
D0=D[0];D1=D[1]; |
|
} |
|
if(type(F=getopt(f))>1) F=f2df(F); |
|
else F=0; |
|
for(M=[],I=length(T);T!=[];T=cdr(T),I--){ |
|
for(S=car(T);S!=[];S=cdr(S)){ |
|
V=((!F)?dlog(car(S))/dlog(10)/LS:myfdeval(F,car(S)))*S0; |
|
if(S1!=0){ |
|
M=cons([V+D0,D1],M); |
|
M=cons([V+D0,I*((length(SC)>2)?SC[I]:S1)+D1],M); |
|
M=cons(0,M); |
|
}else M=cons(V+D0,M); |
|
} |
|
} |
|
if(S1!=0) M=cdr(M); |
|
M=reverse(M); |
|
if(getopt(TeX)==1){ |
|
if(type(U=getopt(line))==4) |
|
M=cons([U[0]+D0,D1],cons([U[1]+D0,D1],cons(0,M))); |
|
S=xylines(M); |
|
if(type(Mes=getopt(mes))==4){ |
|
S3=car(Mes); |
|
V=car(scale(cdr(Mes))); |
|
if(!F) Mes=scale(cdr(Mes)|scale=[S0/LS,0],shift=[D0,D1]); |
|
else Mes=scale(cdr(Mes)|f=F,scale=[S0,0],shift=[D0,D1]); |
|
for(M=Mes;M!=[];M=cdr(M),V=cdr(V)) |
|
S+=xyput([car(M),S3,deval(car(V))]); |
|
} |
|
return S; |
|
} |
|
return M; |
|
} |
|
|
def pluspower(P,V,N,M) |
def pluspower(P,V,N,M) |
{ |
{ |
RR = 1; |
RR = 1; |
Line 3058 def llbase(VV,L) |
|
Line 3145 def llbase(VV,L) |
|
|
|
def lsort(L1,L2,T) |
def lsort(L1,L2,T) |
{ |
{ |
|
C1=getopt(c1);C2=getopt(c2); |
if(type(T)==4){ |
if(type(T)==4){ |
K=T; |
K=T; |
T=K[0]; |
if(length(T)>0){ |
K=cdr(K); |
T=K[0]; |
|
K=cdr(K); |
|
}else T=0; |
}else K=0; |
}else K=0; |
if(type(T)==7) |
if(type(TT=T)==7) |
T = findin(T,["cup","setminus","cap","reduce"]); |
T = findin(T,["cup","setminus","cap","reduce","sum","subst"]); |
if(K){ |
if(type(L2)==7&&T<0) |
C1=getopt(c1);C2=getopt(c2); |
T=findin(TT,["put","get","sub"]); |
KN=K[0]; |
if(K){ /* [[..],..] */ |
if(L2==[]){ /* sort or deduce duplication */ |
if(K!=[]) KN=K[0]; |
if((T!=0&&T!=1)||length(K)!=1) return L1; |
if(L2==[]||L2=="sort"){ /* sort or deduce duplication */ |
|
if((T!=0&&T!=3)||length(K)!=1) return L1; |
if(KN<0){ |
if(KN<0){ |
KN=-KN-1; |
KN=-KN-1; |
F=-1; |
F=-1; |
}else F=1; |
}else F=1; |
L1=msort(L1,[F,0,KN]); |
L1=msort(L1,[F,0,KN]); |
if(T==1){ |
if(T==3){ |
R=[car(L1)];L1=cdr(L1); |
R=[car(L1)];L1=cdr(L1); |
for(;L1!=[];L1=cdr(L1)){ |
for(;L1!=[];L1=cdr(L1)){ |
if(car(L1)[KN]!=car(R)[KN]) R=cons(car(L1),R); |
if(car(L1)[KN]!=car(R)[KN]) R=cons(car(L1),R); |
Line 3083 def lsort(L1,L2,T) |
|
Line 3174 def lsort(L1,L2,T) |
|
L1=reverse(R); |
L1=reverse(R); |
} |
} |
return L1; |
return L1; |
}else if(L2==0&&type(C1)==4){ |
}else if((L2==0||L2=="col")&&type(C1)==4){ |
if(T==0||T==1){ /* extract or delete columns */ |
if(T==0||T==1){ /* extract or delete columns */ |
for(R=[];L1!=[];L1=cdr(L1)){ |
for(R=[];L1!=[];L1=cdr(L1)){ |
if(T==1&&L=[0]){ /* delete top column */ |
if(T==1&&C1==[0]){ /* delete top column */ |
R=cons(cdr(car(L1)),R); |
R=cons(cdr(car(L1)),R); |
continue; |
continue; |
} |
} |
LT=car(L1); |
LT=car(L1);RT=[]; |
if(T==0){ |
if(T==0){ |
for(CT=C1;CT!=[];CT=cdr(CT)){ |
for(CT=C1;CT!=[];CT=cdr(CT)) RT=cons(LT[car(CT)],RT); |
for(RT=[],CT=C1;CT!=[];CT=cdr(CT)) |
|
RT=cons(LT[car(CT)],R); |
|
} |
|
}else{ |
}else{ |
for(I=0,RT=[];LT!=[];I++,LT=cdr(LT)) |
for(I=0;LT!=[];I++,LT=cdr(LT)) |
if(findin(I,C1)<0) RT=cons(car(LT),RT); |
if(findin(I,C1)<0) RT=cons(car(LT),RT); |
RT=reverse(RT); |
RT=reverse(RT); |
} |
} |
Line 3105 def lsort(L1,L2,T) |
|
Line 3193 def lsort(L1,L2,T) |
|
} |
} |
return reverse(R); |
return reverse(R); |
} |
} |
}else{ |
}else if(type(L2)==1||type(L2)==7){ |
|
if(L2==1||L2=="num"){ |
|
if(T==4) T=3; |
|
I=(length(K)<2)?(-1):K[1]; |
|
if(T==0||T==1||T==2||T==3){ |
|
S=F=CT=0;R=[]; |
|
if(K==[] || type((S=K[0]))==1 || S==0){ |
|
if(T==0||T==1||T==2){ |
|
for(J;L1!=[];L1=cdr(L1),J++){ |
|
if(T==0) R=cons(cons(J+S,car(L1)),R); |
|
else if(T==1){ |
|
for( ;C1!=[]; C1=cdr(C1)) |
|
R=cons(L1[car(C1)],R); |
|
}else{ |
|
if(findin(J,C1)<0) R=cons(car(L1),R); |
|
} |
|
} |
|
return reverse(R); |
|
}else if(T==3) return length(L1); |
|
}else{ |
|
if(type(S)==2&&vtype(S)>2) F=1; |
|
else if(type(S)==4) F=2; |
|
else if(S=="+") F=3; |
|
else return L1; |
|
} |
|
for(R=[];L1!=[];L1=cdr(L1)){ |
|
L1T=car(L1); |
|
if(F==1) V=call(S,(I<0)?L1T:L1T[I]); |
|
else if(F==2) V=calc((I<0)?L1T:L1T[I],S); |
|
else if(F==3){ |
|
for(C=C1,V=0;C!=[];C=cdr(C)) |
|
if(type(X=L1T[car(C)])==1) V+=X; |
|
} |
|
if(T==0) R=cons(cons(V,L1T),R); |
|
else if(T==1){ |
|
if(V) R=cons(L1T,R); |
|
}else if(T==2){ |
|
if(!V) R=cons(L1T,R); |
|
}else if(T==3){ |
|
if(F==3) CT+=V; |
|
else if(V) CT++; |
|
} |
|
} |
|
return (T==3)?CT:reverse(R); |
|
}else if(TT=="col"){ |
|
J=(length(K)>0)?car(K):0; |
|
I=length(car(L1))+J; |
|
for(V=[];I>J;) |
|
V=cons(--I,V); |
|
return cons(V,L1); |
|
} |
|
}else if(L2=="transpose") return mtranspose(L1); |
|
else if(L2=="subst"||L2=="adjust"){ |
|
Null=(!K)?"":car(K); |
|
if(L2=="adjust") C1=[]; |
|
R=lv2m(L1|null=""); |
|
for(;C1!=[];C1=cdr(C1)) R[car(C1)[0]][car(C1)[1]]=car(C1)[2]; |
|
return m2ll(R); |
|
} |
|
return L1; |
|
}else{ /* [[..],..], [[..],..] */ |
|
if(type(L2[0])<4){ |
|
for(R=[];L2!=[];L2=cdr(L2)) R=cons([car(L2)],R); |
|
L2=reverse(R); |
|
} |
|
if(TT=="sum") T=3; |
|
if(TT=="over") T=4; |
|
if(findin(T,[0,1,2,3,4,5])<0) return L1; |
|
if(T==4||T==5){ |
|
if(type(C1)<2) C1=[C1]; |
|
if(type(C2)<2) C2=[C2]; |
|
} |
if(type(car(L2))!=4){ |
if(type(car(L2))!=4){ |
for(R=[];L2!=[];L2=cdr(L2)) R=cons([car(L2)],R); |
for(R=[];L2!=[];L2=cdr(L2)) R=cons([car(L2)],R); |
R=reverse(R); |
R=reverse(R); |
if(length(K)==1) K=[K[0],0]; |
if(length(K)==1) K=[K[0],0]; |
} |
|
for(R=[],I=0;L1!=[];I++,L1=cdr(L1)) |
|
R=cons(cons(I,car(L1)),R); |
|
KN++; |
|
KR=K[1]; |
|
K0=K[0];K1=K[1]; |
|
L1=msort(R,[],[1,0,K0]); |
|
if(type(C2)==4){ |
|
L2=msort(L2,0,0|c1=cons(K1,C2)); /* extract columns */ |
|
C2=0; |
C2=0; |
K1=0; |
|
} |
} |
L2=msort(L2,[],[1,0,K1]); |
L1=lsort(L1,"num",["put",0]); /* insert number */ |
S=size(L2); |
K0=(length(K)>0)?K[0]+1:1; |
for(R0=[];S>0;S--) R0=cons("",R0); |
K1=(length(K)>1)?K1=K[1]:0; |
R0=[R0]; |
L1=lsort(L1,"sort",[0,K0]); |
if(T==0||T==1||T==3){ /* cup or setminus or cap */ |
if(T<4&&type(C2)==4&&length(L2[0])>1){ |
for(R=[];L1!=[];L1=cdr(L1)){ |
L2=lsort(L2,"col",["put"]|c1=cons(K1,C2)); /* add key and extract columns */ |
while(L2!=[]&&car(L1)[K0]>car(L2)[K1]) L2=cdr(L2); |
C2=0;K1=0; |
if(L2==[]||car(L1)[K0]<car(L2)[K1]){ |
} |
if(T1==0||T1==1) |
L2=lsort(L2,"sort",[0,K1]); |
R=cons((T1==0)?append(car(L1),R0):car(L1),R); |
for(R0=[],S=S1=length(L1[0]);S>0;S--) R0=cons("",R0); |
}else if(T==1||T1==3) R=cons([car(L1),car(L2)],R); |
for(R1=[],S=length(L2[0]);S>0;S--) R1=cons("",R1); |
|
if(!K1&&T!=3) R1=cdr(R1); |
|
for(R=[];L1!=[];L1=cdr(L1)){ |
|
while(L2!=[]&&car(L1)[K0]>car(L2)[K1]){ |
|
if(T==3) R=cons(append(R0,car(L2)),R); |
|
L2=cdr(L2); |
} |
} |
|
if(L2==[]||car(L1)[K0]<car(L2)[K1]){ |
|
if(T!=2) R=cons((T==1||T>3||R1==[])?car(L1):append(car(L1),R1),R); |
|
}else if(T==0||T==2||T==3){ |
|
if(R0==[]) R=append(car(L1),R); |
|
else R=cons(append(car(L1),(!K1&&T!=3)?cdr(car(L2)):car(L2)),R); |
|
L2=cdr(L2); |
|
}else if(T==4||T==5){ |
|
V1=ltov(car(L1));V2=ltov(car(L2)); |
|
for(D1=C1,D2=C2;D1!=[];D1=cdr(D1),D2=cdr(D2)) |
|
if((I=V2[car(D2)])!=""||T==4) V1[car(D1)+1]=I; |
|
R=cons(vtol(V1),R); |
|
} |
} |
} |
R=msort(R,[],[1,0,K0]); |
if(T==3){ |
R=msort(R,0,[1]|c1=(T1!=0&&T!=3)?[0]:[0,length(L1)+K[1]]); |
while(L2!=[]){ |
if(type(C1)!=4&&type(C2)!=4) return R; |
R=cons(append(R0,car(L2)),R); |
C=[];S0=size(L1); |
L2=cdr(L2); |
if(type(C1)==4) |
|
for(;C1!=[];C1=cdr(C1)) C=cons(car(C1),C); |
|
else for(I=0;I<S0; I++) C=cons(I,C); |
|
/* |
|
if(type(C2)==4){ |
|
for(F=0,I=0;C1!=[];I++,C1=cdr(C1)){ |
|
if(I==I) continue; |
|
if(car(C1)==K1) continue; |
|
F=(car(C1)>K1)?S0:(S0-1); |
|
C=cons(car(C1)+F,C); |
|
} |
} |
}else |
} |
*/ |
R=lsort(R,"sort",["put",0]); /* original order */ |
for(I=0;I<S-1;I++) C=cons(I+S0,C); |
D=(((T==0||T==2)&&!K1)||T==3)?[0]:[0,S1+K1]; |
|
R=lsort(R,0,[1]|c1=D); /* delete */ |
|
if(type(C1)!=4||T==1||T==4||T==5) return R; |
|
C=[];S0=size(L1[0]); |
|
for(;C1!=[];C1=cdr(C1)) C=cons(car(C1),C); |
|
for(I=0;I<S0-S1;I++) C=cons(I+S1,C); |
C=reverse(C); |
C=reverse(C); |
return msort(L,0,[0]|c1=C); |
return lsort(R,"col",[1]|c1=C); |
} |
} |
} |
} |
if(L2 == []){ |
if(L2 == []){ /* [...] */ |
if(T == 2) return L2; |
if(T==8||TT=="count") return [length(L1),length(lsort(L1,[],1))]; |
if(T == 3) return [L1,L2]; |
if(T==7||TT=="cut"){ |
|
K=length(L1); |
|
if(C1<0) C1=K+C1; |
|
for(R=[],I=0;I<C1&&L1!=[];I++,L1=cdr(L1)) |
|
R=cons(car(L1),R); |
|
for(S=[];L1!=[];L1=cdr(L1)) |
|
S=cons(car(L1),S); |
|
return [reverse(R),reverse(S)]; |
|
} |
|
if(T==2) return L2; |
|
if(T==3) return [L1,L2]; |
L1 = ltov(L1); qsort(L1); |
L1 = ltov(L1); qsort(L1); |
if(T != 1) |
if(T != 1) |
return vtol(L1); |
return vtol(L1); |
Line 3171 def lsort(L1,L2,T) |
|
Line 3342 def lsort(L1,L2,T) |
|
} |
} |
return L3; |
return L3; |
} |
} |
|
if(T==8||TT=="count"){ |
|
K=length(lsort(L1,L2,3)[0]); |
|
R=[length(L2),length(L1)]; |
|
L1 = lsort(L1,[],1); |
|
L2 = lsort(L2,[],1); |
|
R=append([length(L2),length(L1)],R); |
|
R=cons(length(lsort(L1,L2,2)),R); |
|
return reverse(cons(K,R)); |
|
} |
|
if((T==9||TT=="cons")&&type(car(L1))==4){ |
|
if(type(L2)!=4) L2=[L2]; |
|
for(R=[];L1!=[];L1=cdr(L1)){ |
|
R=cons(cons(car(L2),car(L1)),R); |
|
if(length(L2)>1) L2=cdr(L2); |
|
} |
|
return reverse(R); |
|
} |
|
if(T==10||TT=="cmp"){ |
|
if(length(L1)!=length(L2)){ |
|
mycat("Different length!"); |
|
return 1; |
|
} |
|
R=[]; |
|
if(type(car(L1))==4){ |
|
for(U=[],I=0;L1!=[];I++,L1=cdr(L1),L2=cdr(L2)){ |
|
if(length(S=car(L1))!=length(T=car(L2))){ |
|
mycat(["Different size : line ",I]); |
|
return 0; |
|
} |
|
for(J=0;S!=[];S=cdr(S),T=cdr(T),J++) |
|
if(car(S)!=car(T)) U=cons([[I,J],car(S),car(T)],U); |
|
} |
|
if(U!=[]) R=cons(reverse(U),R); |
|
}else{ |
|
for(I=0;L1!=[];L1=cdr(L1),L2=cdr(L2),I++) |
|
if(car(L1)!=car(L2)) R=cons([I,car(L1),car(L2)],R); |
|
} |
|
return reverse(R); |
|
} |
|
if(T==11||TT=="append"){ |
|
if(type(car(L1))!=4) return append(L1,L2); |
|
for(R=[];L1!=[];L1=cdr(L1),L2=cdr(L2)) |
|
R=cons(append(car(L1),car(L2)),R); |
|
return reverse(R); |
|
} |
if(T == 1 || T == 2){ |
if(T == 1 || T == 2){ |
L1 = lsort(L1,[],1); |
L1 = lsort(L1,[],1); |
L2 = lsort(L2,[],1); |
L2 = lsort(L2,[],1); |
|
|
Opt=[]; |
Opt=[]; |
}else if(length(Opt)==2 && type(Opt[0])!=4) Opt=[Opt]; |
}else if(length(Opt)==2 && type(Opt[0])!=4) Opt=[Opt]; |
for(;;){ |
for(;;){ |
G=mysubst(F,[[sin(0),0],[tan(0),0],[asin(0),0],[atan(0),0],[sinh(0),0],[tanh(0),0], |
G=mysubst(F,[[tan(0),0],[asin(0),0],[atan(0),0],[sinh(0),0],[tanh(0),0], |
[log(1),0],[cos(0),1],[cosh(0),1],[exp(0),1]]); |
[log(1),0],[cosh(0),1],[exp(0),1]]); |
for(Rep=Opt; Rep!=[]; Rep=cdr(Rep)) |
for(Rep=Opt; Rep!=[]; Rep=cdr(Rep)) |
G=subst(G,car(Rep)[0],car(Rep)[1]); |
G=subst(G,car(Rep)[0],car(Rep)[1]); |
Var=vars(G); |
Var=vars(G); |
for(V=Var; V!=[]; V=cdr(V)){ |
for(V=Var; V!=[]; V=cdr(V)){ |
if(functor(car(V))!=pow || (P=args(car(V))[0])!=1) continue; |
if(!(VV=args(CV=car(V)))) continue; |
G=subst(G,car(V),1); |
if((functor(CV)==sin||functor(CV)==cos)){ |
|
P=2*red(VV[0]/@pi); |
|
if(functor(CV)==sin) P=1-P; |
|
if(isint(P)){ |
|
if(iand(P,1)) G=subst(G,CV,0); |
|
else if(!iand(P,3)) G=subst(G,CV,1); |
|
else G=subst(G,CV,-1); |
|
continue; |
|
} |
|
if(isint(P*=3/2)){ |
|
if(iand(P,3)==1) G=subst(G,CV,1/2); |
|
else G=subst(G,CV,-1/2); |
|
} |
|
} |
|
for(;VV!=[];VV=cdr(VV)) |
|
if(car(VV)!=(TV=evalred(car(VV)))) G=subst(G,car(VV),TV); |
|
if(functor(CV)!=pow || (args(CV)[0])!=1) continue; |
|
G=subst(G,CV,1); |
} |
} |
if(G==F) return F; |
if(G==F) return F; |
F=G; |
F=G; |
|
|
|
|
def calc(X,L) |
def calc(X,L) |
{ |
{ |
if(type(X)<4){ |
if(type(X)<4||type(X)==7){ |
if(type(L)==4){ |
if(type(L)==4||type(L)==7){ |
V=L[1]; |
V=L[1]; |
if((L0=L[0])=="+") X+=V; |
if(type(X)!=7){ |
else if(L0=="-") X-=V; |
if((L0=L[0])=="+") X+=V; |
else if(L0=="*") X*=V; |
else if(L0=="-") X-=V; |
else if(L0=="/") X/=V; |
else if(L0=="*") X*=V; |
else if(L0=="^") X^=V; |
else if(L0=="/") X/=V; |
else if(L0==">") X=(X>V); |
else if(L0=="^") X^=V; |
else if(L0=="<") X=(X<V); |
} |
else if(L0=="=") X=(X==V); |
if((L0=L[0])==">") X=(X>V); |
|
else if(L0=="<") X=(X<V); |
|
else if(L0=="=") X=(X==V); |
else if(L0==">=") X=(X>=V); |
else if(L0==">=") X=(X>=V); |
else if(L0=="<=") X=(X<=V); |
else if(L0=="<=") X=(X<=V); |
else if(L0=="!=") X=(X!=V); |
else if(L0=="!=") X=(X!=V); |
}else if(type(L)==7){ |
}else if(type(L)==7&&type(X)<4){ |
if(L=="neg") X=-X; |
if(L=="neg") X=-X; |
else if(L=="abs") X=abs(X); |
else if(L=="abs") X=abs(X); |
else if(L=="neg") X=-X; |
else if(L=="neg") X=-X; |
|
|
B=cons(sub_str(S,P0,P1-1),B); |
B=cons(sub_str(S,P0,P1-1),B); |
} |
} |
} |
} |
|
close_file(Id); |
}else{ |
}else{ |
MO/=2; |
MO/=2; |
if(L1<=1) L1=MO+4; |
if(L1<=1) L1=MO+4; |
Line 7965 def mcgrs(G, R) |
|
Line 8201 def mcgrs(G, R) |
|
G = GN; |
G = GN; |
continue; |
continue; |
} |
} |
VP = newvec(L+1); GV = ltov(G); |
VP = newvect(L+1); GV = ltov(G); |
for(I = S = OD = 0; I <= L; I++){ |
for(I = S = OD = 0; I <= L; I++){ |
RTT = (I==0)?(Mat-RT):0; |
RTT = (I==0)?(Mat-RT):0; |
VP[I] = -1; |
VP[I] = -1; |
Line 10001 def dviout0(L) |
|
Line 10237 def dviout0(L) |
|
mycat0(["DVIOUTA=\"", DVIOUTA,"\""],1); |
mycat0(["DVIOUTA=\"", DVIOUTA,"\""],1); |
mycat0(["DVIOUTB=\"", DVIOUTB,"\""],1); |
mycat0(["DVIOUTB=\"", DVIOUTB,"\""],1); |
mycat0(["DVIOUTL=\"", DVIOUTL,"\""],1); |
mycat0(["DVIOUTL=\"", DVIOUTL,"\""],1); |
mycat0(["FCAT =\"", FCAT,"\""],1); |
|
mycat(["Canvas =", Canvas]); |
mycat(["Canvas =", Canvas]); |
mycat(["TeXLim =", TeXLim]); |
mycat(["TeXLim =", TeXLim]); |
mycat(["TeXEq =", TeXEq]); |
mycat(["TeXEq =", TeXEq]); |
|
|
} |
} |
str_tb("\n",Tb); |
str_tb("\n",Tb); |
} |
} |
return str_tb(0,Tb); |
S=str_tb(0,Tb); |
|
if(type(EXE=getopt(exe))!=1&&EXE!=0&&type(EXE)!=7) return S; |
|
if(type(F)!=7){ |
|
F="risaout"; |
|
if(EXE>=2&&EXE<=9) F+=rtostr(EXE); |
|
F=DIROUTD+F+".csv"; |
|
}else F=S; |
|
if(EXE!=0 && access(F)) remove_file(F); |
|
fcat(F,S|exe=1); |
|
return 1; |
} |
} |
|
|
def readcsv(F) |
def readcsv(F) |
Line 10177 def readcsv(F) |
|
Line 10421 def readcsv(F) |
|
} |
} |
close_file(ID); |
close_file(ID); |
if(T) L=m2l(L|flat=1); |
if(T) L=m2l(L|flat=1); |
return reverse(L); |
L=reverse(L); |
|
return L; |
} |
} |
|
|
def showbyshell(S) |
def showbyshell(S) |
Line 10199 def getbyshell(S) |
|
Line 10444 def getbyshell(S) |
|
Tmp=str_subst(DIROUT,["%HOME%","%ASIRROOT%"],[Home,get_rootdir()]); |
Tmp=str_subst(DIROUT,["%HOME%","%ASIRROOT%"],[Home,get_rootdir()]); |
Sep=isMs()?"\\":"/"; |
Sep=isMs()?"\\":"/"; |
F=Tmp+Sep+"muldif.tmp"; |
F=Tmp+Sep+"muldif.tmp"; |
if(type(S)<=1 && S>=0) close_file(Id); |
if(type(S)<=1 && S>=0) close_file(S); |
remove_file(F); |
remove_file(F); |
if(type(S)<=1) return -1; |
if(type(S)<=1) return -1; |
shell(S+" > \""+F+"\""); |
shell(S+" > \""+F+"\""); |
|
|
|
|
def sint(N,P) |
def sint(N,P) |
{ |
{ |
if( type(N)==1 ) { |
if( type(N)==1 || N==0 ) { |
NT=ntype(N); |
NT=ntype(N); |
if((type(Opt=getopt(str))==1 || Opt==0) && Opt>=0 && P>=0){ |
if((type(Opt=getopt(str))==1 || Opt==0) && Opt>=0 && P>=0){ |
if(Opt==2 || Opt==4 || Opt==0){ |
if(Opt==2 || Opt==4 || Opt==0){ |
if(N==0) return "0"; |
if(N==0) return (Opt>0)?"0":0; |
Pw=0; |
Pw=0; |
if(NT==4){ |
if(NT==4){ |
NN=abs(real(N));N1=abs(imag(N)); |
NN=abs(real(N));N1=abs(imag(N)); |
|
|
N=-N; |
N=-N; |
Neg="-"; |
Neg="-"; |
}else Neg=""; |
}else Neg=""; |
|
N=rint(N*10^P)/10^P; |
NN=floor(N); |
NN=floor(N); |
|
NV=(N-NN+1)*10^P; |
NS=rtostr(NN); |
NS=rtostr(NN); |
if(P<=0) return Neg+NS; |
if(P<=0) return Neg+NS; |
if(NN==0 && getopt(zero)==0) NS=""; |
if(NN==0 && getopt(zero)==0) NS=""; |
return Neg+NS+"."+str_cut(rtostr(rint((N-NN+1)*10^P)),1,P); |
return Neg+NS+"."+str_cut(rtostr(NV),1,P); |
} |
} |
if(NT==4) |
if(NT==4) |
return sint(real(N),P)+sint(imag(N),P)*@i; |
return sint(real(N),P)+sint(imag(N),P)*@i; |
X = rint( N*10^P ); |
X = rint( N*10^P ); |
return ((X+1.0)-1.0)/10^P; |
return deval(X/10^P); |
} |
} |
if( (type(N)==2) || (type(N)==3) ){ |
if( (type(N)==2) || (type(N)==3) ){ |
NN = eval(N); |
NN = eval(N); |
|
|
if((T=type(N))<0) return N; |
if((T=type(N))<0) return N; |
E=(getopt(big)==1)?eval(@e):0.1; |
E=(getopt(big)==1)?eval(@e):0.1; |
if(T==1){ |
if(T==1){ |
if(ntype(N)==0) return (E+N)-E; |
if(ntype(N)==0) return (E*N)/E; |
else if(ntype(N)!=4) return N; |
else if(ntype(N)!=4) return N; |
else return (E*(1+@i)+N)-E*(1+@i); |
else return (E*(1+@i)*N)/(E*(1+@i)); |
} |
} |
if(T==3||T==2){ |
if(T==3||T==2){ |
N=red(N); |
N=red(N); |
|
|
for(S=0,I=mydeg(Nm,V);I>=0;I--) S+=frac2n(mycoef(Nm,I,V))*V^I; |
for(S=0,I=mydeg(Nm,V);I>=0;I--) S+=frac2n(mycoef(Nm,I,V))*V^I; |
return S/dn(N); |
return S/dn(N); |
} |
} |
if(T<4) return (N+E)-E; |
if(T<4) return (E*N)/E; |
#ifdef USEMODULE |
#ifdef USEMODULE |
return mtransbys(os_md.frac2n,N,[]|option_list=getopt()); |
return mtransbys(os_md.frac2n,N,[]|option_list=getopt()); |
#else |
#else |
|
|
def mytan(Z) |
def mytan(Z) |
{ |
{ |
if(type(Z=eval(Z))>1) return todf(os_md.mytan,[Z]); |
if(type(Z=eval(Z))>1) return todf(os_md.mytan,[Z]); |
if((Im=imag(Z))==0) return dsin(Z); |
if((Im=imag(Z))==0) return dtan(Z); |
V=myexp(2*Z*@i); |
V=myexp(2*Z*@i); |
return @i*(1-V)/(1+V); |
return @i*(1-V)/(1+V); |
} |
} |
Line 12721 def polroots(L,V) |
|
Line 12968 def polroots(L,V) |
|
Lim=Lim2=[]; |
Lim=Lim2=[]; |
if(type(L)<4){ |
if(type(L)<4){ |
if(type(Lim=getopt(lim))==4){ |
if(type(Lim=getopt(lim))==4){ |
if(type(Lim[0])!=4) Lim=[Lim]; |
if(type(Lim[0])!=4){ |
|
if(!isvar(Lim[0])) Lim=cons(V,[Lim]); |
|
Lim=[Lim]; |
|
} |
|
if(!isvar(Lim[0][0])) Lim=[cons(V,Lim)]; |
Lim=delopt(Lim,V|inv=1); |
Lim=delopt(Lim,V|inv=1); |
if(Lim!=[]){ |
if(Lim!=[]){ |
Lim=Lim[0]; |
Lim=Lim[0]; |
Line 12809 def polroots(L,V) |
|
Line 13060 def polroots(L,V) |
|
for(SS=[];R!=[];R=cdr(R)){ |
for(SS=[];R!=[];R=cdr(R)){ |
RS=(N==2)?[car(R)]:car(R); |
RS=(N==2)?[car(R)]:car(R); |
for(I=0,L0=L[0];I<N-1;I++) L0=mysubst(L0,[V1[I],RS[I]]); |
for(I=0,L0=L[0];I<N-1;I++) L0=mysubst(L0,[V1[I],RS[I]]); |
|
if(L0==0) return 0; |
S0=polroots(L0,V[0]|option_list=OL); |
S0=polroots(L0,V[0]|option_list=OL); |
if(type(S0)<2) return S0; |
if(type(S0)<2) return S0; |
for(S=S0;S!=[];S=cdr(S)){ |
for(S=S0;S!=[];S=cdr(S)){ |
Line 13007 def cutf(F,X,VV) |
|
Line 13259 def cutf(F,X,VV) |
|
} |
} |
} |
} |
|
|
def fsum(F,L,X) |
def fsum(F,L) |
{ |
{ |
|
if(getopt(df)==1){ |
|
F=f2df(F); |
|
}else Sub=getopt(subst); |
if(type(L[0])==2){ |
if(type(L[0])==2){ |
X=L[0]; |
X=L[0]; |
L=cdr(L); |
L=cdr(L); |
Line 13016 def fsum(F,L,X) |
|
Line 13271 def fsum(F,L,X) |
|
V=(length(L)>2)?L[2]:1; |
V=(length(L)>2)?L[2]:1; |
for(R=0,I=L[0];;I+=V){ |
for(R=0,I=L[0];;I+=V){ |
if(V==0||(I-L[1])*V>0) return R; |
if(V==0||(I-L[1])*V>0) return R; |
R+=os_md.myfeval(F,X?[X,I]:I); |
R+=(Sub==1)?subst(F,X?X:x,I):os_md.myfeval(F,X?[X,I]:I); |
} |
} |
} |
} |
|
|
Line 13026 def periodicf(F,L,X) |
|
Line 13281 def periodicf(F,L,X) |
|
else L=eval(L); |
else L=eval(L); |
if(isvar(X)){ |
if(isvar(X)){ |
Y=makenewv([X,V]); |
Y=makenewv([X,V]); |
if(type(F)==5) return [Y,[Y,os_md.periodicf,[F],L,X]]; |
|
Z=makenewv([X,Y,V]); |
Z=makenewv([X,Y,V]); |
return [Z,[Z,os_md.periodicf,[mysubst(F,[x,Y])],[L],[[Y,X]]]]; |
return [Z,[Z,os_md.periodicf,[mysubst(F,[x,Y])],(type(L)==4)?[L]:L,[[Y,X]]]]; |
} |
} |
X=eval(X); |
if(type(X)==4){ |
if(type(F)==5) |
V=X[0]; |
return myfeval(F[floor(X/L)%length(F)],X-floor(X/L)*L); |
X=X[1]; |
|
}else V=x; |
|
if(type(F)==5){ |
|
X=eval(X); |
|
return myfeval(F[floor(X/L)%length(F)],[V,X-floor(X/L)*L]); |
|
} |
if(type(L)==4){ |
if(type(L)==4){ |
if(type(X)==4){ |
|
V=X[0]; |
|
X=X[1]; |
|
}else V=x; |
|
X-=floor((X-L[0])/(L[1]-L[0]))*(L[1]-L[0]); |
X-=floor((X-L[0])/(L[1]-L[0]))*(L[1]-L[0]); |
return myfeval(F,[V,X]); |
return myfeval(F,[V,X]); |
} |
} |
|
|
else Hline=subst(Hline,z,S); |
else Hline=subst(Hline,z,S); |
for(VV=[],VT=Hline;VT!=[];VT=cdr(VT)){ |
for(VV=[],VT=Hline;VT!=[];VT=cdr(VT)){ |
if(type(T=car(VT))==4 && T[1]>0){ |
if(type(T=car(VT))==4 && T[1]>0){ |
for(I=T[0];I<=CS;I+=T[1]) VV=cons(I,VV); |
for(I=T[0];I<=S;I+=T[1]) VV=cons(I,VV); |
}else VV=cons(T,VV); |
}else VV=cons(T,VV); |
} |
} |
Hline=qsort(VV); |
Hline=qsort(VV); |
|
|
} |
} |
str_tb("\\end{tabular}\n",Out); |
str_tb("\\end{tabular}\n",Out); |
}else if(Op==11){ /* graph */ |
}else if(Op==11){ /* graph */ |
Width=8; Hight=3; WRet=1/2; HMerg=0.2; |
if(type(Strip=getopt(strip))!=1) Strip=0; |
|
if(type(MX=getopt(max))!=1) MX=0; |
|
if(type(ML=getopt(mult))!=1) ML=0; |
|
if((REL=getopt(relative))!=1) REL=0; |
|
CL=getopt(color); |
|
OL=delopt(getopt(),["color","strip","mult"]); |
|
if(ML==1&&type(CL)==4){ |
|
LL=L[1];L=L[0];K=length(L);S=T=""; |
|
if(!MX){ |
|
MX=vector(length(L[0])); |
|
for(LT=L;LT!=[];LT=cdr(LT)){ |
|
for(I=0,LTT=car(LT);LTT!=[];I++,LTT=cdr(LTT)){ |
|
if(REL==1) MX[I]+=car(LTT); |
|
else if(MX[I]<car(LTT)) MX[I]=car(LTT); |
|
} |
|
} |
|
MX=lmax(MX); |
|
OL=cons(["max",MX],OL); |
|
} |
|
if(REL==1) MX=newvect(length(L[0])); |
|
for(I=0;I<K;I++){ |
|
for(R=[],J=length(L[I]);--J>=0;){ |
|
if(REL==1){ |
|
R=cons([MX[J],V=MX[J]+L[I][J]],R); |
|
MX[J]=V; |
|
}else R=cons([(!I)?0:L[I-1][J],L[I][J]],R); |
|
} |
|
OP=cons(["color",CL[I]],OL); |
|
S+=ltotex([R,LL]|option_list=cons(["value",0],cons(["strip",(!I)?1:2],OP))); |
|
T+=ltotex([R,LL]|option_list=cons(["strip",3],OP)); |
|
} |
|
return(!Strip)?xyproc(S+T):(S+T); |
|
}else if(!TikZ) CL=0; |
|
if(type(Line=getopt(line))!=1){ |
|
if(type(Line)==4){ |
|
if(type(Line[0])==1 && (type(Line[1])==7 || type(Line[1])==1)){ |
|
Opt=Line[1]; Line=Line[0]; |
|
}else if(ML==1){ |
|
OL=delopt(OL,"line"); |
|
LL=L[1];L=L[0];K=length(L);S=""; |
|
if(!MX){ |
|
MX=newvect(length(L[0])); |
|
for(LT=L;LT!=[];LT=cdr(LT)){ |
|
for(I=0,LTT=car(LT);LTT!=[];I++,LTT=cdr(LTT)){ |
|
if(REL==1) MX[I]+=car(LTT); |
|
else if(MX[I]<car(LTT)) MX[I]=car(LTT); |
|
} |
|
} |
|
MX=lmax(MX); |
|
OL=cons(["max",MX],OL); |
|
} |
|
for(I=0;I<K;I++) |
|
S+=ltotex([L[I],LL]|option_list |
|
=cons(["line",Line[I]],cons(["strip",(!I)?1:2],OL))); |
|
return(!Strip)?xyproc(S):S; |
|
} |
|
}else Line=0; |
|
}else Opt="@{-}"; |
|
Width=8; Hight=3; WRet=1/2; HMerg=(getopt(horiz)==1)?0.3:0.2; |
if(!TikZ){ |
if(!TikZ){ |
Width*=10; Hight*=10; HMerg*=10; |
Width*=10; Hight*=10; HMerg*=10; |
} |
} |
|
VMerg=HMerg; |
|
if(type(Shift=getopt(shift))!=1) |
|
Shift=0; |
if(type(V=getopt(size))==4){ |
if(type(V=getopt(size))==4){ |
Width=V[0];Hight=V[1]; |
Width=V[0];Hight=V[1]; |
if(Hight<0) Hight=-Hight*lmax(L[0]); |
|
if(length(V)>2) WRet=V[2]; |
if(length(V)>2) WRet=V[2]; |
if(length(V)>3) HMerg=V[3]; |
if(length(V)>3) VMerg=VMerg=V[3]; |
|
if(length(V)>4) HMerg=V[4]; |
} |
} |
Val=getopt(value); |
Val=getopt(value); |
if(!isint(Val)) Val=-1; |
if(!isint(Val)) Val=-1; |
if(type(Shift=getopt(shift))!=1) |
|
Shift=0; |
|
if(type(Line=getopt(line))!=1){ |
if(type(Line=getopt(line))!=1){ |
if(type(Line)==4 && type(Line[0])==1 && (type(Line[1])==7 || type(Line[1])==1)){ |
if(type(Line)==4 && type(Line[0])==1 && (type(Line[1])==7 || type(Line[1])==1)){ |
Opt=Line[1]; Line=Line[0]; |
Opt=Line[1]; Line=Line[0]; |
|
|
if((S=car(LT))<=0) return 0; |
if((S=car(LT))<=0) return 0; |
Sum+=S; |
Sum+=S; |
} |
} |
for(R=[],LT=L;LT!=[];LT=cdr(LT)) |
for(R=[],LT=L;LT!=[];LT=cdr(LT)) R=cons(car(LT)/Sum,R); |
R=cons(car(LT)/Sum,R); |
|
R=reverse(R); |
R=reverse(R); |
Opt0=Opt*2/3; |
Opt0=Opt*2/3; |
Out=str_tb(xyproc(1),0); |
Out=str_tb((Strip>0)?0:xyproc(1),0); |
str_tb(xylines(ptpolygon(6,Opt)|close=1,curve=1),Out); |
if(type(CL)!=4) str_tb(xylines(ptpolygon(6,Opt)|close=1,curve=1),Out); |
for(S=0,RT=R,LT=LL;RT!=[];RT=cdr(RT)){ |
for(S=0,RT=R,LT=LL;RT!=[];RT=cdr(RT)){ |
str_tb(xyline([0,0],[Opt*dsin(S*6.2832),Opt*dcos(S*6.2832)]),Out); |
SS=S+RT[0]; |
T=S+RT[0]/2; |
if(type(CL)==4){ |
S+=RT[0]; |
str_tb(xyang(Opt,[0,0],(0.25-SS)*6.2832,(0.25-S)*6.2832|ar=1,opt=car(CL)),Out); |
|
if(length(CL)>0) CL=cdr(CL); |
|
}else str_tb(xyline([0,0],[Opt*dsin(S*6.2832),Opt*dcos(S*6.2832)]),Out); |
|
T=(S+SS)/2; |
|
S=SS; |
if(LT!=[]){ |
if(LT!=[]){ |
str_tb(xyput([Opt0*dsin(T*6.2832),Opt0*dcos(T*6.2832),SS]),Out); |
str_tb(xyput([Opt0*dsin(T*6.2832),Opt0*dcos(T*6.2832),car(LT)]),Out); |
LT=cdr(LT); |
LT=cdr(LT); |
} |
} |
} |
} |
str_tb(xyproc(0),Out); |
if(!Strip) str_tb(xyproc(0),Out); |
return str_tb(0,Out); |
return str_tb(0,Out); |
} |
} |
if(type(MX=getopt(max))!=1) |
|
MX=0; |
|
if(MX==0){ |
if(MX==0){ |
for(MX=0,LT=L; LT!=[]; LT=cdr(LT)) |
for(MX=0,LT=L; LT!=[]; LT=cdr(LT)) |
if(car(LT)>MX) MX=car(LT); |
if(car(LT)>MX) MX=car(LT); |
|
|
S=length(L); |
S=length(L); |
WStep=Width/S; |
WStep=Width/S; |
WWStep=WStep*WRet; |
WWStep=WStep*WRet; |
HStep=Hight/MX; |
HStep=(Hight<0)?-Hight:Hight/MX; |
if(LL!=[]&&length(LL)==S-1) WS2=WStep/2; |
if(LL!=[]&&length(LL)==S-1) WS2=WStep/2; |
else WS2=0; |
else WS2=0; |
Out=str_tb(xyproc(1),0); |
Out=str_tb((Strip>0)?0:xyproc(1),0); |
str_tb(xyline([0,0],[Width-WStep+WWStep,0]),Out); |
Hori=getopt(horiz); |
if(TikZ) CL=getopt(color); |
if(Strip<2){ |
else CL=0; |
if(Hori==1) str_tb(xyline([0,0],[0,Width-WStep+WWStep]),Out); |
|
else str_tb(xyline([0,0],[Width-WStep+WWStep,0]),Out); |
|
} |
for(I=0,LT=L;LT!=[]; LT=cdr(LT),I++){ |
for(I=0,LT=L;LT!=[]; LT=cdr(LT),I++){ |
XP=WStep*I; XPM=XP+WWStep/2; YP=(car(LT)-Shift)*HStep; |
XP=WStep*I; XPM=XP+WWStep/2; |
if(Line!=0){ |
if(type(LTT=car(LT))==4){ |
if(I>0) |
YP0=(car(LTT)-Shift)*HStep;YP=(LTT[1]-Shift)*HStep; |
str_tb(xyarrow([XPM-WStep,YPP],[XPM,YP]|opt=Opt),Out); |
VL=LTT[1]; |
if(Val!=0) |
if(REL) VL-=LTT[0]; |
str_tb(xyput([XPM,YP+HMerg,car(LT)]),Out); |
}else{ |
if(Line==2) |
YP0=0;YP=(LTT-Shift)*HStep;VL=LTT; |
str_tb(xyput([XPM,YP,"$\\bullet$"]),Out); |
} |
YPP=YP; |
if(Hori==1){ |
}else if(YP!=0 || Val==1){ |
if(Line!=0){ |
if(CL) str_tb(xybox([[XP,0],[XP+WWStep,YP]]|color=CL),Out); |
if(I>0) |
else str_tb(xybox([[XP,0],[XP+WWStep,YP]]),Out); |
str_tb(xyarrow([XPM,YP],[XPM-WStep,YPP]|opt=Opt),Out); |
if(Val!=0){ |
if(Val!=0) |
str_tb(xyput([XPM,(YP<0)?(YP-HMerg):(YP+HMerg),car(LT)]),Out); |
str_tb(xyput([YP+HMerg, XPM,car(LT)]),Out); |
|
if(Line==2) |
|
str_tb(xyput([YP,XPM,"$\\bullet$"]),Out); |
|
YPP=YP; |
|
}else if(YP!=0 || Val==1){ |
|
if(Strip!=3){ |
|
if(CL) str_tb(xybox([[YP,XP+WWStep], [YP0,XP]]|color=CL),Out); |
|
else str_tb(xybox([[YP,XP+WWStep],[YP0,XP]]),Out); |
|
} |
|
if(Val!=0) str_tb(xyput([(YP<0||REL==1)?(YP-HMerg):(YP+HMerg),XPM,VL]),Out); |
} |
} |
|
if(LL!=[]&&I<length(LL)&&Strip<2) str_tb(xyput([-VMerg,XPM+WS2,LL[I]]),Out); |
|
}else{ |
|
if(Line!=0){ |
|
if(I>0) |
|
str_tb(xyarrow([XPM-WStep,YPP],[XPM,YP]|opt=Opt),Out); |
|
if(Val!=0) |
|
str_tb(xyput([XPM,YP+HMerg,car(LT)]),Out); |
|
if(Line==2) |
|
str_tb(xyput([XPM,YP,"$\\bullet$"]),Out); |
|
YPP=YP; |
|
}else if(YP!=0 || Val==1){ |
|
if(Strip!=3){ |
|
if(CL) str_tb(xybox([[XP,YP0],[XP+WWStep,YP]]|color=CL),Out); |
|
else str_tb(xybox([[XP,YP0],[XP+WWStep,YP]]),Out); |
|
} |
|
if(Val!=0) str_tb(xyput([XPM,(YP<0||REL==1)?(YP-HMerg):(YP+HMerg),VL]),Out); |
|
} |
|
if(LL!=[]&&I<length(LL)&&Strip<2) str_tb(xyput([XPM+WS2,-VMerg,LL[I]]),Out); |
} |
} |
if(LL!=[]&&I<length(LL)) str_tb(xyput([XPM+WS2,-HMerg,LL[I]]),Out); |
|
} |
} |
str_tb(xyproc(0),Out); |
if(!Strip)str_tb(xyproc(0),Out); |
}else if(Op==12){ /* coord */ |
}else if(Op==12){ /* coord */ |
Out=str_tb("(",0); |
Out=str_tb("(",0); |
for(LT=L;;){ |
for(LT=L;;){ |
Line 18259 def ntable(F,II,D) |
|
Line 18602 def ntable(F,II,D) |
|
{ |
{ |
F=f2df(F|opt=-1); |
F=f2df(F|opt=-1); |
Df=getopt(dif); |
Df=getopt(dif); |
if(Df!=1) Df=0; |
|
Str=getopt(str); |
Str=getopt(str); |
L=[];T=II[1]-II[0]; |
if(Df!=1) Df=0; |
|
L=[]; |
|
if(type(D)==4){ |
|
if(type(II[0])==4){ |
|
T1=II[0][1]-II[0][0];T2=II[1][1]-II[1][0]; |
|
for(L0=[],I=0;I<D[0];I++){ |
|
for(R=[],J=0;J<D[1];J++) |
|
R=cons(myf2eval(F,II[0][0]+I*T1/D[0],II[1][0]+J*T2/D[1]),R); |
|
L=cons(reverse(R),L);L0=cons(II[0][0]+I*T1/D[0],L0); |
|
} |
|
}else{ |
|
for(T=II[1]-II[0],L0=[],I=0;I<D[0];I++){ |
|
for(R=[],J=0;J<D[1];J++) |
|
R=cons(myfdeval(F,II[0]+I*T/D[0]+J*T/D[0]/D[1]),R); |
|
L=cons(reverse(R),L);L0=cons(II[0]+I*T/D[0],L0); |
|
} |
|
} |
|
L=reverse(L);L0=reverse(L0); |
|
if(type(Str)==4){ |
|
L0=mtransbys(os_md.sint,L0,[Str[0]]|str=1,zero=0); |
|
L=mtransbys(os_md.sint,L,[Str[1]]|str=1,zero=0); |
|
if(Df==1){ |
|
for(DT=[],RT=L,I=0;RT!=[];){ |
|
for(LT=[],TT=car(RT);TT!=[];TT=cdr(TT)){ |
|
VV=car(TT); |
|
if((J=str_char(VV,0,"."))>=0){ |
|
if(J==0) VV=str_cut(VV,1,10000); |
|
else VV=str_cut(VV,0,J-1)+str_cut(VV,J+1,10000); |
|
} |
|
V1=eval_str(VV); |
|
if(I++) LT=cons(V1-V0,LT); |
|
V0=V1; |
|
} |
|
DT=cons(LT,DT); |
|
if((RT=cdr(RT))==[]){ |
|
VE=rint(myfdeval(F,II[1])*10^Str[1]); |
|
DT=cons([VE-V0],DT); |
|
} |
|
} |
|
for(I=0,D=[],TT=DT;TT!=[];TT=cdr(TT)){ |
|
if(!I++) V=car(TT)[0]; |
|
else{ |
|
T1=reverse(cons(V,car(TT))); |
|
V=car(T1); |
|
if(length(TT)>1) T1=cdr(T1); |
|
D=cons(T1,D); |
|
} |
|
} |
|
for(DD=[],TT=D;TT!=[];TT=cdr(TT)) |
|
DD=cons([os_md.lmin(car(TT)),os_md.lmax(car(TT))],DD); |
|
DD=reverse(DD); |
|
L=lsort(L,DD,"append"); |
|
} |
|
} |
|
L=lsort(L,L0,"cons"); |
|
if(type(Top=getopt(top))==4||getopt(TeX)==1){ |
|
if(type(Top)==4){ |
|
K=length(L[0])-length(Top); |
|
if(K>0&&K<4){ |
|
if(K>1){ |
|
Top=append(Top,["",""]); |
|
K-=2; |
|
} |
|
if(K) Top=cons("",Top); |
|
} |
|
L=cons(Top,L); |
|
} |
|
if(type(H=getopt(hline))!=4) H=[0,1,z]; |
|
if(type(V=getopt(vline))!=4) V=[0,1,(DF)?z-2:z]; |
|
if(type(T=getopt(title))!=7) Out=ltotex(L|opt="tab",hline=H,vline=V); |
|
else Out=ltotex(L|opt="tab",hline=H,vline=V,title=T); |
|
if(Df) Out=str_subst(Out,"\\hline","\\cline{1-"+rtostr(length(L[0])-2)+"}"); |
|
return Out; |
|
} |
|
return L; |
|
} |
for(L=[],I=0;I<=D;I++){ |
for(L=[],I=0;I<=D;I++){ |
X=II[0]+I*T/D; |
X=II[0]+I*T/D; |
L=cons([X,myfdeval(F,X)],L); |
L=cons([X,myfdeval(F,X)],L); |
Line 18273 def ntable(F,II,D) |
|
Line 18690 def ntable(F,II,D) |
|
} |
} |
L=reverse(LD); |
L=reverse(LD); |
} |
} |
if(type(Str=getopt(str))==4){ |
if(type(Str)==4){ |
if(length(Str)==1) Str=[Str[0],Str[0]]; |
if(length(Str)==1) Str=[Str[0],Str[0]]; |
if(Df==1 && length(Str)==2) Str=[Str[0],Str[1],Str[2]]; |
if(Df==1 && length(Str)==2) Str=[Str[0],Str[1],Str[1]]; |
for(S=Str,Str=[];S!=[];S=cdr(S)){ |
for(S=Str,Str=[];S!=[];S=cdr(S)){ |
if(type(car(S))!=4) Str=cons([car(S),3],Str); |
if(type(car(S))!=4) Str=cons([car(S),3],Str); |
else Str=cons(car(S),Str); |
else Str=cons(car(S),Str); |
|
|
} |
} |
|
|
def init() { |
def init() { |
LS=["DIROUT","DVIOUTA","DVIOUTB","DVIOUTH","DVIOUTL","FCAT","TeXLim","TeXEq","TikZ", |
LS=["DIROUT","DVIOUTA","DVIOUTB","DVIOUTH","DVIOUTL","TeXLim","TeXEq","TikZ", |
"XYPrec","XYcm","Canvas"]; |
"XYPrec","XYcm","Canvas"]; |
if(!access(get_rootdir()+"/help/os_muldif.dvi")||!access(get_rootdir()+"/help/os_muldif.pdf")) |
if(!access(get_rootdir()+"/help/os_muldif.dvi")||!access(get_rootdir()+"/help/os_muldif.pdf")) |
mycat(["Put os_muldif.dvi and os_muldif.pdf in", get_rootdir()+(isMs()?"\\help.":"/help.")]); |
mycat(["Put os_muldif.dvi and os_muldif.pdf in", get_rootdir()+(isMs()?"\\help.":"/help.")]); |
|
|
DVIOUTB=str_subst(DVIOUTB,[["\\","/"],[".bat",".sh"]],0); |
DVIOUTB=str_subst(DVIOUTB,[["\\","/"],[".bat",".sh"]],0); |
DVIOUTL=str_subst(DVIOUTL,[["\\","/"],[".bat",".sh"]],0); |
DVIOUTL=str_subst(DVIOUTL,[["\\","/"],[".bat",".sh"]],0); |
DVIOUTH="%ASIRROOT%/help/os_muldif.pdf"; |
DVIOUTH="%ASIRROOT%/help/os_muldif.pdf"; |
FCAT=str_subst(DVIOUTB,"\\","/"); |
|
} |
} |
Home=getenv("HOME"); |
Home=getenv("HOME"); |
if(type(Home)!=7) Home=""; |
if(type(Home)!=7) Home=""; |
|
|
else if(P[0]==2) DVIOUTB=SS; |
else if(P[0]==2) DVIOUTB=SS; |
else if(P[0]==3) DVIOUTH=SS; |
else if(P[0]==3) DVIOUTH=SS; |
else if(P[0]==4) DVIOUTL=SS; |
else if(P[0]==4) DVIOUTL=SS; |
else if(P[0]==5) CATF=SS; |
|
} |
} |
} |
} |
if(P0<0 || P1<P0+2) mycat(["Error! Definiton of", LS[P[0]], |
if(P0<0 || P1<P0+2) mycat(["Error! Definiton of", LS[P[0]], |
"in .muldif"]); |
"in .muldif"]); |
}else{ |
}else{ |
SV=eval_str(str_cut(S,P0+1,str_len(S)-1)); |
SV=eval_str(str_cut(S,P0+1,str_len(S)-1)); |
if(P[0]==6) TeXLim=SV; |
if(P[0]==5) TeXLim=SV; |
else if(P[0]==7) TeXEq=SV; |
else if(P[0]==6) TeXEq=SV; |
else if(P[0]==8) TikZ=SV; |
else if(P[0]==7) TikZ=SV; |
else if(P[0]==9) XYPrec=SV; |
else if(P[0]==8) XYPrec=SV; |
else if(P[0]==10) XYcm=SV; |
else if(P[0]==9) XYcm=SV; |
else if(P[0]==11) XYcm=Canvas; |
else if(P[0]==10) XYcm=Canvas; |
} |
} |
} |
} |
} |
} |
close_file(Id); |
close_file(Id); |
} |
} |
if(type(TEMP=getenv("temp"))!=7) TEMP=""; |
|
if(type(HOME=getenv("HOME"))!=7) HOME=""; |
|
FCAT=str_subst(FCAT,[["%TEMP%",TEMP],["%HOME%",HOME],["%ASIRROOT%",get_rootdir()]],0); |
|
chkfun(1,0); |
chkfun(1,0); |
} |
} |
|
|