generalized_harmonic_numbers

generalized_harmonic_numbers(n: int, p: float = -1.0) ndarray[source]

Calculate the generalized harmonic numbers from 1 to n (both inclusive).

\[H_p(n) = \sum \limits_{i=1}^{n} i^{-p}\]
Parameters:
  • n (int) – the maximum number for which the generalized harmonic numbers are calculated

  • p (float) – the power, typically negative

Returns:

shape: (n,) the first \(n\) generalized harmonic numbers

Return type:

ndarray