stdlib icon indicating copy to clipboard operation
stdlib copied to clipboard

RFC: Add Generalized Hyperbolic distribution (tracking issue)

Open Planeshifter opened this issue 9 months ago • 2 comments

Description

This RFC proposes adding a full implementation of the Generalized Hyperbolic statistical distribution to stdlib, including all standard distribution properties and functions.

Planeshifter avatar Feb 27 '25 02:02 Planeshifter

Hey, I would like to work on this issue!

jalajk3004 avatar Feb 27 '25 16:02 jalajk3004

Hi @Planeshifter,

I've been reviewing the requirements for the Generalized Hyperbolic distribution and noticed that sub-issue #5487 is currently blocked because stdlib lacks the Modified Bessel function of the second kind (besselk) for real-valued orders.

Given the context of my recent work on special functions (like asechf), I would be interested in tackling the implementation of this Bessel function as a standalone package (@stdlib/math/base/special/besselk) to help unblock the distribution.

Implementation Plan: I understand that direct computation using the standard definition is unstable for integer orders. My plan is to research and port a stable numerical algorithm (likely referencing logic from Cephes or AMOS) to correctly handle:

  1. Both integer and non-integer (real-valued) orders.
  2. Asymptotic expansions for large inputs.
  3. Domain errors and edge cases (NaN, Infinity).

Should I open a new RFC/issue to track the implementation of besselk separately, or would you prefer I track it here?

Amansingh0807 avatar Dec 06 '25 09:12 Amansingh0807