// // FUNZIONI GRAFICHE // setColor(c); // setPoint(x,y);drawLine(x0,y0,x1,y1); // drawRect(x0,y0,l,h);fillRect(x0,y0,l,h){ // drawOval(x,y,l,h);fillOval(x,y,l,h) // drawArc(x,y,l,h,alpha0,alpha1);fillArc(x,y,l,h,alpha0,alpha1) // drawString(s,x,y);// drawimage(x,y,nomeFile) // debug() ;listato(funzione); i1n(n,istr) // // tabulaFunzione(f,x0,x1,deltaX) // tabella2x2(a1,a2,a3,a4) // w(x);wln(x);nprompt // // // tabella();nuovaRiga();nuovoDato(x);fineTabella() // quadrato(x);cubo(x);quartaPotenza(x); // radice(x) // dimezza(x);doppio(x);triplo(x);quadruplo(x) // somma(a,b) // sin(x);cos(x);tan(x) // sol(a,b,c) function testgnLib(){ alert("gnLib is on work") } function trunc(x,n){ eval("y=10E"+(n-1)) return parseInt(x*y)/y } function fontChar(f,c){ return ""+String.fromCharCode(c)+""} var simbols=[ "a","a","a","a","a","a","a","a","a","a" ,"a","a","a","a","a","a","a","a","a","a" ,"a","a","a","a","a","a","a","a","a","a" ,"a","a","a","pe","forall","diesis","exist","pc","and","nolispe" ,"at","ct","star","plus","comma","minus","point","slash","n0","n1" ,"n2","n3","n4","n5","n6","n7","n8","n9","dp","pv" ,"lt","eq","gt","qp","approx","A","B","X","Delta","E" ,"Phi","Gamma","H","I","Jota","Kappa","Lambda","M","N","O" ,"PI","Omega","P","Sigma","T","Y","Csi","Omega","Csi","Psi" ,"Z","aq","tp","cq","Tr","underscore","overscore","alpha","beta","csi" ,"delta","epsilon","phi","gamma","eta","iota","psi","kappa","lambda","mu" ,"nu","o","pi","teta","rho","sigma","tau","nu","omegabar","omega" ,"yupsilon","psi","zeta","ag","bar","cg","tilde","a","a","a" ,"a","a","a","a","a","a","a","a","a","a" ,"a","a","a","a","a","a","a","a","a","a" ,"a","a","a","a","a","a","a","a","a","a" ,"a","erba","apix","le","a","infty","f","fiori","quadri","cuori" ,"picche","bifreccia","leftarrow","a","rightarrow","downarrow","grades","pm","biapix","gt" ,"times","prop","diff","dot","tra","ne","coincide","bitilde","dots","Bar" ,"line","ret","aleph","imm","Re","p","tx","tp","empty","cap" ,"cup","include","includeeq","noinclude","included","includedeq","inset","notinset","angle","nablagiu" ,"registered","cr","tm","PPI","root","dot","not","vel","lev","biimp" ,"Lefttarrow","Uparrow","Rigtharrow","diamond","bra","a","a","a","SSigma", ,"atTOP","atMIDDLE","ctBOTTOM","aqTOP","aqMIDDLE","aqBOTTOM","agTOP","agMIDDLE","agBOTTOM","a" ,"square","ket","int","intTOP","intMIDDLE","intBOTTOM","ctTOP","ctMIDDLE","ctBOTTOM" ,"cqTOP","cqMIDDLE","cqBOTTOM","cgTOP","cgMIDDLE","cgBOTTOM","a","a","a" ]; for(var k=33;k<255;k++){ if(k==39){nolispe=fontChar("Symbol",39);continue} zz=( "var "+ simbols[k] + "='" +fontChar("Symbol",k) +"';" ) eval(zz); } var autodefiniti=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]; for(var k=0;ktable border=0 align=left valign=bottom >","",arguments,"")} function line(){return compattaABvC("","
",arguments,"
")} function lc(){return compattaABvC("","
",arguments,"
")} function pow(a,b){ return a+""+b+"" } function sub(a,b){ return a+""+b+"" } function toVett(){return arguments} function compatta(x){var s="";for(var i=0;iv.length;i++){s+=B+v[i];}return s+C} function bold(){return compattaABvC("","",arguments,"")} function mat31(a,b,c){ // restituisce 3 dati incolonnati return "
"+a+ "
"+b+ "
"+c+"
" } function red(){return compattaABvC("","",arguments,"")} function frac(num,den){ return mat31(num,"
",den)} // frazione function overline(x){ return ""+ ""+ "

"+ x+"
" } function printSet(){ document.write(".
 ") for(var j=0;j<10;j++){document.write(""+j)} for(var i=0;i<=25;i++){ document.write("
"+i*10) for(var j=0;j<10;j++){ k=(i*10+j*1); document.write(""+eval(simbols[k])+"
"+simbols[k]) } } document.write("
") } function intero(a,b){x=parseInt(Math.random()*(b-a)+a); return x;} function scegli(a){return ' '+a[intero(0,a.length)]+' '} function E(x){ return ' 10'+x+' '} function w(x){ document.write(x)} function mischia(v){ // scambia (lunghezza Vettore*4) volte coppie del vettore l=v.length; for(var i=1;i<=v.length*4;i++){ a=parseInt(Math.random()*l); b=parseInt(Math.random()*l); x=v[a];y=v[b]; v[b]=x;v[a]=y; } return v; } function drawimage(x,y,i) { document.writeln(''); } function inputVettore2D(){ // By Amateis per inserire un vettore (x,y) c=new Array(2); c[0]=prompt('Inserisci la x'); c[1]=prompt('Inserisci la y'); return c; } function fillRect(x0,y0,l,h){ if(l<0){l=-l;x0=x0-l;} if(h<0){h=-h;y0=y0-h;} x0=Math.floor(x0);y0=Math.floor(y0); l=Math.ceil(l);h=Math.ceil(h); for(var x=x0;x<=x0+l;x++){ for(var y=y0;y<=y0+h;y++){ document.write('.'); } } } function fillOval(x,y,l,h){ rx=l/2;ry=h/2; xc=x+rx;yc=y+ry for(var xx=x+l;xx>=-x;xx--){ alpha=Math.acos((xx-x)/l) drawLine(xc+rx*Math.cos(alpha),yc-ry*Math.sin(alpha),xc+rx*Math.cos(-alpha),yc-ry*Math.sin(-alpha)); } } function fillArc(x,y,l,h,alpha0,alpha1){ rx=l/2;ry=h/2; xc=x+rx;yc=y+ry da=Math.PI/180 for(var alpha=alpha0;alpha<=alpha1;alpha+=da){ drawLine(xc,yc,xc+rx*Math.cos(alpha+da),yc-ry*Math.sin(alpha+da)); } } function drawArc(x,y,l,h,alpha0,alpha1){ rx=l/2;ry=h/2; xc=x+rx;yc=y+ry da=Math.PI/360 for(var alpha=alpha0;alpha<=alpha1;alpha+=da){ drawLine(xc+rx*Math.cos(alpha),yc-ry*Math.sin(alpha),xc+rx*Math.cos(alpha+da),yc-ry*Math.sin(alpha+da)); } } function drawOval(x,y,l,h){ rx=l/2;ry=h/2; xc=x+rx;yc=y+ry da=Math.PI/360 for(var alpha=0;alpha<=6.29;alpha+=da){ drawLine(xc+rx*Math.cos(alpha),yc- ry*Math.sin(alpha),xc+rx*Math.cos(alpha+da),yc- ry*Math.sin(alpha+da)); } } function punto(x,y){ // By Nicco: Fa un puntino in coordinate x,y (Obsoleta) w(' . ' ); } function setPoint(x,y){ // By Nicco:Fa un puntino in coordinate x,y (In futuro restera' solo questa) w(' . ' ); } function tabulaFunzione(f,x0,x1,deltaX) { //By Gamba document.writeln(''); document.writeln('
'+'x'+''+f); for(var x=x0;x<=x1;x+=deltaX){ document.writeln('
'+x+''+eval (f)); } document.writeln('
') } function setColor(c){ document.write(''); } function drawRect(x0,y0,l,h){ x0=Math.floor(x0);y0=Math.floor(y0); l=Math.ceil(l);h=Math.ceil(h); drawLine(x0,y0,x0+l,y0); drawLine(x0,y0,x0,y0+h); drawLine(x0+l,y0+h,x0+l,y0); drawLine(x0+l,y0+h,x0,y0+h); } function drawLine(x0,y0,x1,y1){ dx=x1-x0;dy=y1-y0; if(y1>=y0){versoy=1}else{versoy=-1} if(x1>=x0){versox=1}else{versox=-1} npx=Math.abs(dx);npy=Math.abs(dy); var i=0; if( dx*dx >= dy*dy){ // tg <= 45 gradi deY=dy/npx; with(document){ while(i++<=npx){ write( '.'); x0+=versox;y0+=deY } } } else{ // tg > 45 gradi deX=dx/npy; with(document){ while(i++<=npy){ write( '.'); y0+=versoy;x0+=deX; } } } } function interactive() {// By Nicco:Apre una finestra nella quale si possono lanciare istruzioni javascript (utile se si vogliono provare le nuove funzioni o se si vuol vedere lo stato delle variabili) query=' '; while (query !="exit"){ query=prompt('Fornire comando (exit per uscire)',""); if(query!="exit")eval(query); } } function drawString(s,x,y){ document.write( ''+s+''); } // ------------- Utilities Stampa ------------------- // By Polistina : Stampa x (per non scrivere ogni volta document.writeln(x) ) function w(x){document.writeln(x)} function wln(x){w(x+'
')}// By Lopiano e Banfo:Stampa x e va a capo // ------------- Gestione Tabelle ------------------ function tabella() { w('') } // By Contotti: Apre un ambiente tabella function nuovaRiga(){ w('') } // By Cordiano function nuovoDato(x){ w('
'+x) } // By Cordiano function fineTabella(){ w('
') } // By Contotti function intero(a,b){x=parseInt(Math.random()*(b-a)+a); return x;} function scegli(a){return ' '+a[intero(0,a.length)]+' '} function E(x){ return ' 10'+x+' '} function w(x){ document.write(x)} function mischia(v){ // scambia (lunghezza Vettore*4) volte coppie del vettore l=v.length; for(var i=1;i<=v.length*4;i++){ a=parseInt(Math.random()*l); b=parseInt(Math.random()*l); x=v[a];y=v[b]; v[b]=x;v[a]=y; } return v; } //------------------ Matematiche ------------------ function sum(a,b){return Number(Number(a)+Number(b))} // By Napolitano function sin(x){return Math.sin(x)} function cos(x){return Math.cos(x)} function tan(x){return Math.tan(x)} function listato(f){ w(''+f.toString()+'</X'+'MP>' ); } //COSTANTI: var PIGRECO=Math.PI; var PIGRECOMEZZI=(Math.PI)/2; INFINITO =1/0;