Julia: math functions to move to SpecialFunctions.jl

Created on 6 Jun 2018  Â·  17Comments  Â·  Source: JuliaLang/julia

  • lgamma
  • gamma
  • lfact
  • beta
  • lbeta
excision

Most helpful comment

I do think that lbeta, lgamma, lfactorial and lbinomial are fine names.

All 17 comments

Sounds good. Where should they go?

SpecialFunctions.jl?

[l]gamma and [l]beta should likely go in https://github.com/JuliaMath/SpecialFunctions.jl with the rest of the *gamma functions. lfact should probably be called lfactorial and live there as well, largely because it's implemented in terms of the lgamma function.

Or better loggamma, logfactorial etc.

The lfunction convention is pretty standard but sure. We could also do log(gamma)(x)... not entirely sure if :trollface:ing or not...

log(gamma) is a neat idea.

+1 on log(gamma)

FWIW, they're called lbeta, lgamma in R and Tensorflow

I do think that lbeta, lgamma, lfactorial and lbinomial are fine names.

log(gamma) is a fun idea in theory but you then lose the ability to sensibly overload lgamma, since log(gamma) would then return an anonymous function.

It doesn't have to be anonymous. You could have Base.log(::typeof(gamma)) = lgamma

Then what's the point of having log(gamma) if you still have lgamma...

It looks better and lgamma doesn't need to be exported.

(log∘gamma) would be more sensible than log(gamma), but having this overload of ∘ would also be a very-hard-to-discover feature...

Let's just stick with the more traditional names, i.e. lgamma, etc.

Speaking of lgamma, I have a port of openlibm's lgamma that can be used in SpecialFunctions.jl.

lgamma etc. are pretty much standard, and tend to be more useful then their non-log counterparts (since they're harder to overflow) so should have convenient names. In fact, the gamma in C originally gave the log version, which is why C has a tgamma ("true gamma") function

Was this page helpful?
0 / 5 - 0 ratings

Related issues

manor picture manor  Â·  3Comments

TotalVerb picture TotalVerb  Â·  3Comments

m-j-w picture m-j-w  Â·  3Comments

sbromberger picture sbromberger  Â·  3Comments

yurivish picture yurivish  Â·  3Comments