////////// KETlib ////////// use("KetCindyPlugin"); Dircdy=loaddirectory; setdirectory(gethome()); import("ketcindy.ini"); ansflg=0; resetflg=0; ////////// figure ////////// Ketinit(); Setketcindyjs(["Label=[]","Color=offwhite"]);//no ketjs Seteditable(50,["","Size=18","Width=30"]); Seteditable(51,["","Size=18","Width=50"]); Setwindow([-0.2,1.1],[-0.2,1.1]); Setmarklen(0.1); Slider("N",[0,YMIN-0.1],[1,YMIN-0.1]); Expr([0,YMIN-0.2+0.01],"w1","n="); forall(0..10, Listplot("t"+text(#),[[#/10,YMIN-0.1+0.02],[#/10,YMIN-0.1-0.02]],["Num=1"]); Expr([#/10,YMIN-0.2],"c",text(#)); ); Deffun("f(x)",["regional(y)","y=x^2","y"]); if(resetflg==1, Subsedit(50,""); Subsedit(51,""); resetflg=0; ); str1="0";//no ketjs //str1=Textedit(50); //only ketjs if(length(str1)>0, N.x=parse(str1)/10; ); str2="2";//no ketjs //str2=Textedit(51); //only ketjs if(length(str2)>0, ans=parse(str2); ); Mf(ss):=( regional(nn); nn=floor(ss); if(ss>0, forall(1..nn, Framedata("u"+text(#),[[(#-1)/nn,0],[#/nn,f(#/nn)]],["corner","Color=blue"]); Framedata("l1",[[0,0],[1/nn,f(0)]],["corner","Color=red"]); if(nn>1, Framedata("l"+text(#),[[(#-1)/nn,0],[#/nn,f((#-1)/nn)]],["corner","Color=red"]); ); if(nn<18, if(#