Mathematica 9 is now available
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.
Mathematica > Mathematics and Algorithms > Calculus > Discrete Calculus > Recurrence and Sum Functions >
Mathematica > Mathematics and Algorithms > Discrete Mathematics > Discrete Calculus > Recurrence and Sum Functions >
Mathematica > Mathematics and Algorithms > Mathematical Functions > Integer Functions > Recurrence and Sum Functions >

HarmonicNumber

HarmonicNumber[n]
gives the n^(th) harmonic number H_n.
HarmonicNumber[n, r]
gives the harmonic number of order r.
  • Mathematical function, suitable for both symbolic and numerical manipulation.
  • The harmonic numbers are given by with .
First ten harmonic numbers:
Plot harmonic numbers:
Carry out sums involving harmonic numbers:
First ten harmonic numbers:
In[1]:=
Click for copyable input
Out[1]=
 
Plot harmonic numbers:
In[1]:=
Click for copyable input
Out[1]=
 
Carry out sums involving harmonic numbers:
In[1]:=
Click for copyable input
Out[1]=
Evaluate exact values at large arguments:
Non-integer arguments:
Complex arguments:
Evaluate to high precision:
The precision of the output tracks the precision of the input:
HarmonicNumber threads element-wise over lists and arrays:
Series expansion at any point:
TraditionalForm formatting:
Series expansion at infinity:
HarmonicNumber can be applied to power series:
Evaluate at exact arguments:
Series expansion at any point:
Series expansion at infinity:
The average number of comparisons in Quicksort:
Plot over the complex plane:
Book stacking with the maximal overhang:
Picking the best candidate out of n after x evaluated choices [more info]:
Evaluate for n=100:
Plot as a function of harem size:
Use FullSimplify to simplify expressions containing harmonic numbers:
Expand in simpler functions:
Sums:
Generate from sums and integrals:
Generating function:
Large arguments can give results too large to be computed explicitly:
Machine-number inputs can give high-precision results:
Often results are expressed in PolyGamma instead of HarmonicNumber:
New in 4
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team