Skip to content

HarmonicNumber

The harmonic number , exact at a non-negative integer ; with a second argument, the generalized . Continued off the integers by . Provided by `@enumeratio/analytic`.

FungrimHarmonicNumberFungrim entry00c02af50c74Wolfram LanguageHarmonicNumber
HarmonicNumber(n)the harmonic number .
HarmonicNumber(n, r)the generalized harmonic number .

Domain: Special functions

Details
  • At a non-negative integer (and an integer of either sign, in the two-argument form) the sum is exact: , , , .
  • Continued off the lattice by the standard digamma identity (PolyGamma, EulerGamma) and its generalization (Zeta, HurwitzZeta) — both reduce to the same exact values at the integers, so there is one formula, not a case split.
  • Negative integer has no sum and is a pole: , in both the one- and two-argument forms — matching Wolfram, which does not extend the sum by the continuation there.
  • Complex and complex/non-integer are supported numerically, via PolyGamma's digamma ( absent) and HurwitzZeta ( present).
  • A non-integer (or non-integer with present) stays symbolic under plain evaluation even at an otherwise-exact — the sum has no rational value there — and only reduces under N() or a floating-point argument, the same gate every head in this package uses.

Examples

Implementation

referenceenginenotatio

The one-argument digamma identity; exact at the integers too (ψ(n+1) + γ = Hₙ), so it doubles as the oracle at both.

nativeenginetypescriptpackages/analytic/src/harmonic.ts
mappedexternalwolfram / mpmathpackages/oracle/src/mappings.ts

HarmonicNumber[n] / HarmonicNumber[n, r]; mpmath.harmonic(n) (one-argument only — mpmath has no generalized order).

See also: PolyGamma, EulerGamma, Zeta, HurwitzZeta