2
$\begingroup$

The Debye functions are defined like so: ${D_n\left(x\right)} = {\frac{n}{x^n} \cdot {\int_0^x{\frac{t^n}{e^t - 1}dt}}}$.

I'm trying to evaluate the functions for $n$ from one to four and for $\left\lvert x \right\rvert < 10$. The required number of evaluations is great, and I require hundreds of bits of accuracy.

Using Julia and the Julia package QuadGK, implementing the integral in the definition is simple enough, however it's slow for tiny values of $x$, and the integrand even overflows (due to the MPFR exponent not being wide enough) for very tiny values of $x$.

I wonder if there's a way compute $D_1$, $D_2$, $D_3$, $D_4$ without resorting to generic numeric integration, perhaps it would be possible to design a custom algorithm for evaluating the functions that would be faster?

$\endgroup$
9
  • 1
    $\begingroup$ That Wikipedia page shows series expansion for $D_n(x)$. Why not try it instead of integration, if the series converges fast then that would be the way to go. $\endgroup$ Commented Mar 7 at 19:26
  • 5
    $\begingroup$ What application requires you to have hundreds of bits of accuracy? $\endgroup$ Commented Mar 7 at 20:32
  • 5
    $\begingroup$ Separately, the underflow of $e^t-1$ should be addressed by using the function expm1 instead of computing exp(t)-1. $\endgroup$ Commented Mar 7 at 20:33
  • 2
    $\begingroup$ There is a question (with answer) about a continued fraction expansion for $D_{3}$ on Mathematics Stackexchange which looks worthy of exploration. The paper by Guseinov and Mamedov linked on the Wikipedia page likewise looks worthy of followup, as it relates the Debye functions to the incomplete gamma functions, and various arbitrary-precision packages (e.g. ARB) have support for those. $\endgroup$
    – njuffa
    Commented Mar 7 at 20:58
  • 1
    $\begingroup$ Tentatively, Wolfgang's suggestion to use expm1 seems to solve all my problems so far. $\endgroup$ Commented Mar 8 at 7:08

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.