Loading
/custom-emojis/emojis/contour-map.png
Templates
📚
Articles & Resources
📖
Guides & Support
🎖️
Bounty Program
🌵
CalcTree
This calculator computes the

harmonic number, which is the sum of the reciprocals of the positive integers up to integer

. If the

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


  1. 
    
    
Non-Integer


  1. 
    
    

Explanation

The harmonic series approximates the natural logarithm plus the Euler-Mascheroni constant, that is:

Hnln(n)+γH_n \approx ln(n)+\gamma
This approximation becomes more accurate as

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

:
Integer


  1. 
    
    
Non-Integer


  1. 
    
    
Where:
  1. 
    
    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.
  2. 
    
    is the
    
    harmonic number. For integers, it's the sum of the reciprocals of the positive integers up to integer
    
    . For non-integers, it's approximated using the digamma function and the Euler–Mascheroni constant.
  1. 
    
    is the digamma function, which is the logarithmic derivative of the gamma function, given by
    
    . It is used to approximate
    
    for non-integer values of
    
    .
  2. 
    
    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
    
    as:
    
    . The gamma function is related to factorials by
    
    for any natural number
    
    .
  1. 
    
    is the Euler–Mascheroni constant, which is a mathematical constant approximately equal to
    
    γ
    :0.5772156649
    

This calculator is particularly useful in scenarios such as:
  1. Mathematics: Harmonic numbers play a key role in analyzing series convergence and divergence.
  1. Computer Science: Harmonic numbers are crucial for algorithm analysis, particularly in sorting and hashing, by estimating average case scenarios.
  1. Physics: Harmonic numbers explain overtones in music and resonances in circuits, key to understanding wave patterns and vibrations.

Related Resources

  1. Harmonic Mean Calculator
  2. Hexadecimal to Binary Converter
  3. Poisson Distribution Calculator
  4. Prime Number Checker
Check out our full library of CalcTree templates here!