)abbrev package MATHSYM MathematicalSymbols
++ Author: J. Grabmeier, modifications by W. Hebisch
++ Description:
++  MathematicalSymbols defines several mathematical symbols,
++  mostly Greek letters and multiletter Greek symbols.
MathematicalSymbols() : with
     newGreek : () -> Symbol
       ++ newGreek() returns the next greek symbol.
     resetNewGreek : () -> Void
       ++ resetNewGreek() resets the internals counters that newGreek()
       ++ used to return distinct symbols every time.
     partial: constant -> Symbol
       ++ partial() returns symbol for partial derivative.
     alpha: constant -> Symbol
       ++ alpha() returns symbol for small greek letter alpha.
     beta: constant -> Symbol
       ++ beta() returns symbol for small greek letter beta.
     gamma: constant -> Symbol
       ++ gamm() returns symbol for small greek letter gamma.
     delta: constant -> Symbol
       ++ delta() returns symbol for small greek letter delta.
     epsilon: constant -> Symbol
       ++ epsilon() returns symbol for small greek letter epsilon.
     zeta: constant -> Symbol
       ++ zeta() returns symbol for small greek letter zeta.
     eta: constant -> Symbol
       ++ eta() returns symbol for small greek letter eta.
     theta: constant -> Symbol
       ++ theta() returns symbol for small greek letter theta.
     iota: constant -> Symbol
       ++ iota() returns symbol for small greek letter iota.
     kappa: constant -> Symbol
       ++ kappa() returns symbol for small greek letter kappa.
     lambda: constant -> Symbol
       ++ lambda() returns symbol for small greek letter lambda.
     mu: constant -> Symbol
       ++ mu() returns symbol for small greek letter mu.
     nu: constant -> Symbol
       ++ nu() returns symbol for small greek letter nu.
     xi: constant -> Symbol
       ++ xi() returns symbol for small greek letter xi.
     omicron: constant -> Symbol
       ++ omicron() returns symbol for small greek letter omicron.
     pi: constant -> Symbol
       ++ pi() returns symbol for small greek letter pi.
     rho: constant -> Symbol
       ++ rho() returns symbol for small greek letter rho.
     sigma: constant -> Symbol
       ++ sigma() returns symbol for small greek letter sigma.
     tau: constant -> Symbol
       ++ tau() returns symbol for small greek letter tau.
     upsilon: constant -> Symbol
       ++ upsilon() returns symbol for small greek letter upsilon.
     phi: constant -> Symbol
       ++ phi() returns symbol for small greek letter phi.
     chi: constant -> Symbol
       ++ chi() returns symbol for small greek letter chi.
     psi: constant -> Symbol
       ++ psi() returns symbol for small greek letter psi.
     omega: constant -> Symbol
       ++ omega() returns symbol for small greek letter omega.
     Alpha: constant -> Symbol
       ++ Alpha() returns symbol for capital greek letter alpha.
     Beta: constant -> Symbol
       ++ Beta() returns symbol for capital greek letter beta.
     Gamma: constant -> Symbol
       ++ Gamm() returns symbol for capital greek letter gamma.
     Delta: constant -> Symbol
       ++ Delta() returns symbol for capital greek letter delta.
     Epsilon: constant -> Symbol
       ++ Epsilon() returns symbol for capital greek letter epsilon.
     Zeta: constant -> Symbol
       ++ Zeta() returns symbol for capital greek letter zeta.
     Eta: constant -> Symbol
       ++ Eta() returns symbol for capital greek letter eta.
     Theta: constant -> Symbol
       ++ Theta() returns symbol for capital greek letter theta.
     Iota: constant -> Symbol
       ++ Iota() returns symbol for capital greek letter iota.
     Kappa: constant -> Symbol
       ++ Kappa() returns symbol for capital greek letter kappa.
     Lambda: constant -> Symbol
       ++ Lambda() returns symbol for capital greek letter lambda.
     Mu: constant -> Symbol
       ++ Mu() returns symbol for capital greek letter mu.
     Nu: constant -> Symbol
       ++ Nu() returns symbol for capital greek letter nu.
     Xi: constant -> Symbol
       ++ Xi() returns symbol for capital greek letter xi.
     Omicron: constant -> Symbol
       ++ Omicron() returns symbol for capital greek letter omicron.
     Pi: constant -> Symbol
       ++ Pi() returns symbol for capital greek letter pi.
     Rho: constant -> Symbol
       ++ Rho() returns symbol for capital greek letter rho.
     Sigma: constant -> Symbol
       ++ Sigma() returns symbol for capital greek letter sigma.
     Tau: constant -> Symbol
       ++ Tau() returns symbol for capital greek letter tau.
     Upsilon: constant -> Symbol
       ++ Upsilon() returns symbol for capital greek letter upsilon.
     Phi: constant -> Symbol
       ++ Phi() returns symbol for capital greek letter phi.
     Chi: constant -> Symbol
       ++ Chi() returns symbol for capital greek letter chi.
     Psi: constant -> Symbol
       ++ Psi() returns symbol for capital greek letter psi.
     Omega: constant -> Symbol
       ++ omega() returns symbol for capital greek letter omega.
  == add

    greekCount : Integer := 0

    greek_str(i : Integer) : String ==
        ns : String := ""
        repeat
            qr := divide(i, 24)
            i  := qr.quotient
            ns := concat(ucodeToString(qr.remainder + 946), ns)
            if zero?(i) then return ns

    newGreek() ==
        sym := greek_str(greekCount)
        greekCount := greekCount + 1
        sym :: Symbol

    resetNewGreek() ==
        greekCount := 0

    getUTF(i : PositiveInteger): Symbol == ucodeToString(i)::Symbol
    partial(): Symbol == getUTF(8706)
    alpha(): Symbol ==  getUTF(945)
    beta(): Symbol ==  getUTF(946)
    gamma(): Symbol ==  getUTF(947)
    delta(): Symbol ==  getUTF(948)
    epsilon(): Symbol ==  getUTF(949)
    zeta(): Symbol ==  getUTF(950)
    eta(): Symbol ==  getUTF(951)
    theta(): Symbol ==  getUTF(952)
    iota(): Symbol ==  getUTF(953)
    kappa(): Symbol ==  getUTF(954)
    lambda(): Symbol ==  getUTF(955)
    mu(): Symbol ==  getUTF(956)
    nu(): Symbol ==  getUTF(957)
    xi(): Symbol ==  getUTF(958)
    omicron(): Symbol ==  getUTF(959)
    pi(): Symbol ==  getUTF(960)
    rho(): Symbol ==  getUTF(961)
    sigma(): Symbol ==  getUTF(963)
    tau(): Symbol ==  getUTF(964)
    upsilon(): Symbol ==  getUTF(965)
    phi(): Symbol ==  getUTF(966)
    chi(): Symbol ==  getUTF(967)
    psi(): Symbol ==  getUTF(968)
    omega(): Symbol ==  getUTF(669)
    Alpha(): Symbol ==  getUTF(913)
    Beta(): Symbol ==  getUTF(914)
    Gamma(): Symbol ==  getUTF(915)
    Delta(): Symbol ==  getUTF(916)
    Epsilon(): Symbol ==  getUTF(917)
    Zeta(): Symbol ==  getUTF(918)
    Eta(): Symbol ==  getUTF(919)
    Theta(): Symbol ==  getUTF(920)
    Iota(): Symbol ==  getUTF(921)
    Kappa(): Symbol ==  getUTF(922)
    Lambda(): Symbol ==  getUTF(923)
    Mu(): Symbol ==  getUTF(924)
    Nu(): Symbol ==  getUTF(925)
    Xi(): Symbol ==  getUTF(926)
    Omicron(): Symbol ==  getUTF(927)
    Pi(): Symbol ==  getUTF(928)
    Rho(): Symbol ==  getUTF(929)
    Sigma(): Symbol ==  getUTF(931)
    Tau(): Symbol ==  getUTF(932)
    Upsilon(): Symbol ==  getUTF(933)
    Phi(): Symbol ==  getUTF(934)
    Chi(): Symbol ==  getUTF(935)
    Psi(): Symbol ==  getUTF(936)
    Omega(): Symbol ==  getUTF(937)

