harmonic number, which is the sum of the reciprocals of the positive integers up to integer
n
. If the
n
is non-integer, the calculator computes the approximate harmonic number by using the digamma function and the Euler–Mascheroni constant.
Calculation
Inputs
n
:5.00
Output
Hn
:2.28
Integer
n
Hn=∑k=1nk1
Non-Integer
n
Hn≈ψ(n+1)+γ
Explanation
The harmonic series approximates the natural logarithm plus the Euler-Mascheroni constant, that is:
Hn≈ln(n)+γ
This approximation becomes more accurate as
n
becomes larger. Because the harmonic series approximates the natural logarithm, it is a divergent series which means it grows infinitely.
Graph showing how the harmonic series is approximates the logarithmic function
The harmonic number is calculated in two different ways for integer and non-integer values of
n
:
Integer
n
Hn=∑k=1nk1
Non-Integer
n
Hn≈ψ(n+1)+γ
Where:
n
is the term at which the calculation of the harmonic number (also known as the series sum) ends. The input can be an integer or a non-integer.
Hn
is the
nth
harmonic number. For integers, it's the sum of the reciprocals of the positive integers up to integer
n
. For non-integers, it's approximated using the digamma function and the Euler–Mascheroni constant.
ψ(n+1)
is the digamma function, which is the logarithmic derivative of the gamma function, given by
ψ(x)=dxdln[Γ(x)]
. It is used to approximate
Hn
for non-integer values of
n
.
Γ(x)
is the gamma function, which extends the factorial function to complex and real number arguments, except for negative integers. It is defined for positive real numbers
x
as:
Γ(x)=∫0∞tx−1e−tdt
. The gamma function is related to factorials by
Γ(n)=(n−1)!
for any natural number
n
.
γ
is the Euler–Mascheroni constant, which is a mathematical constant approximately equal to
γ
:0.5772156649
This calculator is particularly useful in scenarios such as:
Mathematics: Harmonic numbers play a key role in analyzing series convergence and divergence.
Computer Science: Harmonic numbers are crucial for algorithm analysis, particularly in sorting and hashing, by estimating average case scenarios.
Physics: Harmonic numbers explain overtones in music and resonances in circuits, key to understanding wave patterns and vibrations.