generalized_harmonic_numbers

generalized_harmonic_numbers(n, p=-1.0)[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

Return type

ndarray

Returns

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