fredrik-johansson / fungrim

Fungrim: the Mathematical Functions Grimoire
MIT License
113 stars 15 forks source link

Formula language: naming and calling conventions #22

Open fredrik-johansson opened 4 years ago

fredrik-johansson commented 4 years ago

Miscellaneous bikeshedding design issues. Comments are welcome.

ConstPi -> Pi ?
ConstE -> E ?
ConstI -> I ?
ConstGamma -> ? EulerGamma?
ConstCatalan -> CatalanConstant? Catalan? CatalanG?
GammaFunction -> Gamma ?
DigammaFunction -> Digamma ?
BetaFunction -> Beta ?
RiemannZeta -> Zeta ?

The rationale for the current names was to avoid hogging single letters and Greek letter names since the user may want to use them as variables. On the other hand, uppercase Pi, Gamma, Digamma, Beta and Zeta are not exactly commonplace variable names. E and I are much more questionable.

It's tempting to introduce aliases, but it's something I'd really prefer to avoid.

Next issue: distinguishing between numbers / polynomials / functions where names are overloaded. The Mathematica convention of Person + Symbol (like BesselJ) is nice, but hard to apply consistently (FibonacciF is ugly), and in any case not every function has a person's name associated with it).

I'm also leaning towards using separate symbols for generalizations (adding more parameters) of the same function. For example, Mathematica uses BernoulliB for both Bernoulli numbers and Bernoulli polynomials, but I think I'd rather have separate symbols.

Currently (not very consistent):

BernoulliB / BernoulliPolynomial / GeneralizedBernoulliB /
Fibonacci / HarmonicNumber / LegendrePolynomial / PartitionsP

Alternatives:

Bernoulli / Fibonacci / Harmonic
BernoulliB / FibonacciF / HarmonicH
BernoulliNumber / FibonacciNumber / HarmonicNumber

LegendrePolynomial -> LegendreP ?

This also ties into the question of Gamma and Zeta above: I'd rather not use the same symbol for the complete and incomplete gamma functions, and RiemannZeta is nice because there are multiple ways to generalize this function to several variables (HurwitzZeta, MultiZetaValue, ...).

Derivatives: some functions currently take an optional extra parameter to denote differentiation with respect to the "main" variable (which is the main variable depends on each function). Possible alternatives:

Similarly with non-principal branches: LambertW currently takes two parameters (or three for a derivative); these should perhaps be LambertW and LambertWBranch instead. What about other functions with branch cuts? What about analytic continuation paths? There is now a special Path object; one idea is to allow LambertW(Path(0, -ConstI, -1)) to represent an analytic continuation.

Trivial things:

ArgMinUnique -> UniqueArgMin
ArgMaxUnique -> UniqueArgMax

for consistency with the other operators (or the other way around)

Also:

PP -> Primes ?
HH -> ?

Other functions:

EllipticK / EllipticE

Not really a naming issue; should the argument be m or k? Separate functions?