///////////////////////// ketnamelib.txt ///////////////////////// Str=""; StrL=[]; Strnow=""; Strt=""; Strc=""; Strnq=""; Texstr=""; Nfun=1; npos=2; dispflg=0; tpos=[11,9.8]; dpos=[0,-1]; ch=2; // ["BS","CL","<",">",">>"], Keyname():=( regional(nL); nL=[ ["^(","sin","cos","(",")"], ["7","8","9","x","t",], ["4","5","6","+","-"], ["1","2","3","*","/"], ["0","$\pi$","$e$","fr(",","] ]; nL; ); ///////////////////////// initialize/KETlib ///////////////////////// use("KetCindyPlugin"); Dircdy=loaddirectory; setdirectory(gethome()); import("ketcindy.ini"); setdirectory(Dircdy); import("ketcindylibkey.cs");//funflg=0; import("keynamelib.txt"); Seteditable(10,["","Size=18","Width=200"]); Text10.xy=[6.4,6.8];//関数式の入力窓 //Seteditable(51,["","Size=18","Width=200"]); Text11.xy=[7,-9];//「線を引く」ボタン Text12.xy=[10,-9];//「リセット」ボタン Text13.xy=[5.5,10.25];//「問題」ボタン wflg=0; rflg=0; ky=""; ansflg=0; fnflg=0; detflg=0; stage=0; Str=""; Strnow=""; M1strnq=""; M2strnq=""; drwt(line,str):=( drawtext([-5,poy],text(line)+" "+str,size->15); poy=poy-0.8; ); ky=""; flg=-1; Pxy=[6.1,5.33]; Bx=[1.28,0]; By=[0,-0.91]; inspect(Text20,"button.script","funflg=1;name="+Dq+"Delete()"+Dq+";"); Text20.xy=Pxy; inspect(Text21,"button.script","funflg=1;name="+Dq+"Allclear()"+Dq+";"); Text21.xy=Pxy+Bx; inspect(Text22,"button.script","funflg=1;name="+Dq+"Left()"+Dq+";"); Text22.xy=Pxy+Bx*2; inspect(Text23,"button.script","funflg=1;name="+Dq+"Right()"+Dq+";"); Text23.xy=Pxy+Bx*3; inspect(Text23,"button.script","funflg=1;name="+Dq+"RRight()"+Dq+";"); Text24.xy=Pxy+Bx*4; inspect(Text30,"button.script","funflg=1;name="+Dq+"^("+Dq+";"); Text30.xy=Pxy+By; inspect(Text31,"button.script","funflg=1;name="+Dq+"sin("+Dq+";"); Text31.xy=Pxy+By+Bx; inspect(Text32,"button.script","funflg=1;name="+Dq+"cos("+Dq+";"); Text32.xy=Pxy+By+Bx*2; inspect(Text33,"button.script","funflg=1;name="+Dq+"("+Dq+";"); Text33.xy=Pxy+By+Bx*3; inspect(Text34,"button.script","funflg=1;name="+Dq+")"+Dq+";"); Text34.xy=Pxy+By+Bx*4; inspect(Text35,"button.script","funflg=1;name="+Dq+"7"+Dq+";"); Text35.xy=Pxy+By*2; inspect(Text36,"button.script","funflg=1;name="+Dq+"8"+Dq+";"); Text36.xy=Pxy+By*2+Bx; inspect(Text37,"button.script","funflg=1;name="+Dq+"9"+Dq+";"); Text37.xy=Pxy+By*2+Bx*2; inspect(Text38,"button.script","funflg=1;name="+Dq+"x"+Dq+";"); Text38.xy=Pxy+By*2+Bx*3; inspect(Text39,"button.script","funflg=1;name="+Dq+"t"+Dq+";"); Text39.xy=Pxy+By*2+Bx*4; inspect(Text40,"button.script","funflg=1;name="+Dq+"4"+Dq+";"); Text40.xy=Pxy+By*3; inspect(Text41,"button.script","funflg=1;name="+Dq+"5"+Dq+";"); Text41.xy=Pxy+By*3+Bx; inspect(Text42,"button.script","funflg=1;name="+Dq+"6"+Dq+";"); Text42.xy=Pxy+By*3+Bx*2; inspect(Text43,"button.script","funflg=1;name="+Dq+"+"+Dq+";"); Text43.xy=Pxy+By*3+Bx*3; inspect(Text44,"button.script","funflg=1;name="+Dq+"-"+Dq+";"); Text44.xy=Pxy+By*3+Bx*4; inspect(Text45,"button.script","funflg=1;name="+Dq+"1"+Dq+";"); Text45.xy=Pxy+By*4; inspect(Text46,"button.script","funflg=1;name="+Dq+"2"+Dq+";"); Text46.xy=Pxy+By*4+Bx; inspect(Text47,"button.script","funflg=1;name="+Dq+"3"+Dq+";"); Text47.xy=Pxy+By*4+Bx*2; inspect(Text48,"button.script","funflg=1;name="+Dq+"*"+Dq+";"); Text48.xy=Pxy+By*4+Bx*3; inspect(Text49,"button.script","funflg=1;name="+Dq+"/"+Dq+";"); Text49.xy=Pxy+By*4+Bx*4; inspect(Text50,"button.script","funflg=1;name="+Dq+"0"+Dq+";"); Text50.xy=Pxy+By*5; inspect(Text51,"button.script","funflg=1;name="+Dq+"pi"+Dq+";"); Text51.xy=Pxy+By*5+Bx; inspect(Text52,"button.script","funflg=1;name="+Dq+"e"+Dq+";"); Text52.xy=Pxy+By*5+Bx*2; inspect(Text53,"button.script","funflg=1;name="+Dq+"fr("+Dq+";"); Text53.xy=Pxy+By*5+Bx*3; inspect(Text54,"button.script","funflg=1;name="+Dq+","+Dq+";"); Text54.xy=Pxy+By*5+Bx*4; ///////////////////////// Draw/figures ////////////////////////// Ketinit(1.5); Setketcindyjs(["Sc=1.2"]); Setwindow([-5,5],[-9,9]); Addax(0); /////////////// キーボード入力 ////////////// nameL1=[["BS","AC","<",">",">>"]]; Keytable(5,12.7,1,9,[6,5.1],[0,1,0],nameL1,[0,-0.2],20); nameL2=Keyname(); Keytable(5,12.7,5,9,[6,0.58],[1,1,0],nameL2,[0,-0.2],20); if(funflg==1, if(contains(Manifun,name), parse(name+";"); , tmp=indexof(Str,"?"); if(tmp>0,npos=tmp,npos=length(Str)); out=Addfunstr(name,npos,Str); tmp=length(out_1)-length(Str); npos=npos+tmp; Str=out_1; //npos=out_2; if(npos0, expr=Rtexstr; Expr([5.5,8],"e","y'="+expr,["Size=1"]); Deffun("g(x)",["regional(y)","y="+Rcdystr+"-5","y"]); Plotdata("1","g(x)","x",["Num=100","nodisp"]); gL=[]; forall(1..length(gr1), yf=(gr1_#)_2; if((yf>YMIN-1)&(yfYMAX-9), fL=append(fL,gr2_#); ); ); Listplot("2",fL,["dr,1.5","Color=red"]); Putoncurve("Q","gr2"); Q.x=X.x; Q.y=f(X.x); dc=g(X.x)+5; fn=Assign("mm*(x-x0)+f(x0)",["mm",dc,"x0",P.x]); xrng=Assign("x=[aa,bb]",["aa",P.x-0.5,"bb",P.x+0.5]); Plotdata("3",fn,xrng,["Color=blue"]); if(Q.y