You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 3b0889c
Browse filesBrowse the repository at this point in the historyBrowse files
The polygamma functions and the harmonic numbers compile (#2215)
polygamma, digamma and harmonicnumber compile in both compilers,
through PolygammaFunction, a double-precision kernel by the
interpreter's algorithm: reflected left of Re z = 1/2 near the axis,
moved right by the recurrence to Re w >= 16 + n, and summed by the
asymptotic series with the Bernoulli numbers from the tangent numbers.
Off the axis the recurrence is taken without the reflection, whose
cotangent polynomial cancels there to all but a few digits, and cot is
taken with its argument reduced, since at a half-whole z its rounding is
magnified by pi^(n + 1) and the polynomial's coefficients. The harmonic
numbers are the sum for a whole n and the polygamma form elsewhere, as
the interpreter has them.
Both compilers agree with evaluation on a grid of orders and arguments,
and both, with evaluation, agree with mpmath at 7,170 polygamma points
and 2,997 harmonic ones.
Part of #2195
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
@@ -866,6 +867,7 @@ no others. Where that proof does not go through, or a bound is symbolic, the int
866
867
- **Derivatives.** Each order differentiates to the next. The derivative of `x!`, which was left unevaluated, is `x! * digamma(x + 1)` ([#171](https://github.com/asc-community/AngouriMath/issues/171)).
867
868
- **Integrals.** Each order integrates to the one before, and `digamma(x)` to `ln((x - 1)!)`.
868
869
- **Exact values.** An odd order at a whole or half-whole argument is a rational times a power of `pi` plus a rational: `polygamma(1, 1)` is `1/6 * pi ^ 2`. The digamma function there is a rational less Euler's constant, and at a half-whole argument less `2 ln 2` as well: `digamma(1)` is `-eulergamma`.
870
+
- **Compiled forms.** Each compiles, in double precision and by the same reflection, recurrence and asymptotic series, in both compilers ([#2195](https://github.com/asc-community/AngouriMath/issues/2195)).
public static System.Numerics.Complex LambertW(System.Numerics.Complex a, System.Numerics.Complex b) => AngouriMath.Numerics.LambertWFunction.LambertW(a, b);
238
238
public static double LambertW(double a, double b) => AngouriMath.Numerics.LambertWFunction.LambertW(a, b);
239
239
240
+
// The polygamma functions of a whole order, and the harmonic numbers.
public static System.Numerics.Complex Polygamma(System.Numerics.Complex a, System.Numerics.Complex b) => AngouriMath.Numerics.PolygammaFunction.Polygamma(a, b);
243
+
public static double Polygamma(double a, double b) => AngouriMath.Numerics.PolygammaFunction.Polygamma(a, b);
244
+
public static System.Numerics.Complex HarmonicNumber(System.Numerics.Complex a, System.Numerics.Complex b) => AngouriMath.Numerics.PolygammaFunction.HarmonicNumber(a, b);
245
+
public static double HarmonicNumber(double a, double b) => AngouriMath.Numerics.PolygammaFunction.HarmonicNumber(a, b);
246
+
240
247
/// <summary>
241
248
/// True where <c>System.Numerics.Complex.IsNaN</c> is, spelled out because that overload is
242
249
/// .NET 7 and later and this assembly also targets netstandard2.0. A complex number is NaN
0 commit comments