// LIBRERIA DI FUNZIONI E COSTANTI PER USARE SIMBOLOGIA MATEMATICA
// IN UNA PAGINA WEB.
// a cura di Giovanni Nicco
// USO:
// la funzione ww() ammette un numero qualsiasi di stringhe-argomento
// esempio ww("ciao"," come ", "stai?"); viene stampato "ciao come stai?"
// al fine di usare particolari caratteri, questi sono stati memorizzati in alcune
// variabili il cui nome si richiama vagamente al linguaggio latex
// es. ww(exist,"x",inset,"A",bar,"x",ge,"1")
// consente di scrivere : simbolo di esistenza x incluso in A tale che x >= 1
// in particolare per risparmiare virgolette, simboli quali x,y,z,a,b,c con
// relative maiuscole sono state dichiarate con un valore uguale al loro
// nome in modo che si puo' anche scrivere:
// es. ww(exist,x,inset,A,bar,x,ge,1)
// wlc() ha uso analogo ma forza la scrittura in una unica linea (necessaria a
// causa del rimando a capo automatico che html impone all'apertura di una tabella
// usata per costruzioni grafiche come le frazioni.
// esempio la somma di due frazioni:
// wlc(frac(1,2),frac(1,3))
// wl() è simile ma forza l'allineamento in basso (utile per le potenze)
// es wl(pow("a+b",2),eq,pow(a,2),p,2,a,b,p,pow(b,2))
//
// Le funzioni l, lc non stampano ma costruiscono una stringa in linea contenente gli
// argomenti: possono servire nel caso si vada costruendo una espressione che solo
// alla fine andrà stampata.
// es ww(l(agBig,mat31(lc(x,p,y,eq,frac(1,3),p,frac(2,3))," ",lc(x,m,y,eq,frac(1,3),t,frac(2,3)) )
function fontChar(f,c){ return ""+String.fromCharCode(c)+""}
var p="+",t="*",m="-",d=":"; // operatori aritmetici
var x="x",y="y",z="z",a="a",b="b",c="c",e="e",o="o";A="A",B="B",C="C"; // variabili
var sx=" x ",sy=" y ",sz=" z ",sa=" a ",sb=" b ",sc=" c ",se=" e ",so=" o ";sA=" A ",sB=" B ",sC=" C "; // variabili con spazio
var comma=",";eq="=";bar="|"; // simboli comunque accessibili da tastiera
var ag="{",cg="}",aq="[",cq="]",at="(",ct=")"; // parentesi (a)perte e (c)hiuse
var s=" ",sp=s+s;spa=s+s+s;spac=s+s+s+s;space=s+s+s+s+s; // spazi più o meno lunghi
// abbreviazioni di comandi html
var hr="
";var br="
"
var pp=".
"; // punto e a capo
var pc=".
"; // punto e a capo
var ac="
"; // a capo
// LETTERE GRECHE MINUSCOLE*****************
var Abar =fontChar("Arial",256);var alpha =fontChar("Symbol",97);
var beta =fontChar("Symbol",98);var chi =fontChar("Symbol",99);
var delta =fontChar("Symbol",100);var epsilon =fontChar("Symbol",101);
var psi =fontChar("Symbol",102);var gamma =fontChar("Symbol",103);
var eta =fontChar("Symbol",104);var iota =fontChar("Symbol",105);
var phi =fontChar("Symbol",106);var kappa =fontChar("Symbol",107);
var lambda =fontChar("Symbol",108);var mu =fontChar("Symbol",109);
var nu =fontChar("Symbol",110);var pi =fontChar("Symbol",112);
var theta =fontChar("Symbol",113);var rho =fontChar("Symbol",114);
var sigma =fontChar("Symbol",115);var tau =fontChar("Symbol",116);
var omega =fontChar("Symbol",119);
// SIMBOLI MATEMATICI **********************
var forall =fontChar("Symbol",34);var exists =fontChar("Symbol",36);
var cong =fontChar("Symbol",64);var leq =fontChar("Symbol",163);
var root =fontChar("Symbol",214);var subset =fontChar("Symbol",204);
var subseteq =fontChar("Symbol",205);var cup =fontChar("Symbol",200);
var cap =fontChar("Symbol",199);var empty =fontChar("Symbol",198);
var wedge =fontChar("Symbol",217);var neq =fontChar("Symbol",185);
var mid =fontChar("Symbol",239);var biimp =fontChar("Symbol",219);
var t =fontChar("Symbol",215);var inset =fontChar("Symbol",206);
var notinset =fontChar("Symbol",207);var cross =fontChar("Symbol",180);
// PARENTESI GRANDI **************
var atUP = fontChar("Symbol",230);var atMIDDLE = fontChar("Symbol",231);
var atBOTTOM = fontChar("Symbol",232);var ctUP = fontChar("Symbol",246);
var ctMIDDLE = fontChar("Symbol",247);var ctBOTTOM = fontChar("Symbol",248);
var atBig= mat31(atUP,atMIDDLE,atBOTTOM)
var ctBig= mat31(ctUP,ctMIDDLE,ctBOTTOM)
var aqUP = fontChar("Symbol",233);var aqMIDDLE = fontChar("Symbol",234);
var aqBOTTOM = fontChar("Symbol",235);var cqUP = fontChar("Symbol",249);
var cqMIDDLE = fontChar("Symbol",250);var cqBOTTOM = fontChar("Symbol",251);
var aqBig = mat31(aqUP,aqMIDDLE,aqBOTTOM)
var cqBig = mat31(cqUP,cqMIDDLE,cqBOTTOM)
var agUP = fontChar("Symbol",236);var agMIDDLE = fontChar("Symbol",237);
var agBOTTOM = fontChar("Symbol",238);var cgUP = fontChar("Symbol",252);
var cgMIDDLE = fontChar("Symbol",253);var cgBOTTOM = fontChar("Symbol",254);
var agBig = mat31(agUP,agMIDDLE,agBOTTOM)
var cgBig = mat31(cgUP,cgMIDDLE,cgBOTTOM)
// **********************************************
function pow(a,b){ return a+""+b+"" }
function w(x){document.writeln(x)}
function wln(x){w(x+"
")}
// FUNZIONI A NUMERO DI ARGOMENTI VARIABILE
function compatta(x){var s="";for(var i=0;i","",arguments,"")} // compatta con prefisso, infisso e suffisso
function mat31(a,b,c){ // restituisce 3 dati incolonnati
return ""
}
function red(){return compattaABvC("","",arguments,"")}
function frac(num,den){ return mat31(num,"
",den)} // frazione
function ww(){w(compattaABvC("","",arguments,""))}// stampa tutte le stringhe-argomenti passate
function wl(){w(l(arguments))}; // idem ma forzatamente in linea
function wlc(){w(lc(arguments))};// idem ma centrata (utile per le frazioni)
function l(){return compattaABvC("")} //restituisce in linea
function lc(){return compattaABvC("")}// idem centrata