HarmonicNumber

HarmonicNumber[n]

gives the n^(th) harmonic number TemplateBox[{n}, HarmonicNumber].

HarmonicNumber[n,r]

gives the harmonic number TemplateBox[{n, r}, HarmonicNumber2] of order r.

Details

  • Mathematical function, suitable for both symbolic and numerical manipulation.
  • For positive integers n, the harmonic numbers are given by TemplateBox[{n, r}, HarmonicNumber2]=sum_(i=1)^(n)1/i^r with TemplateBox[{n}, HarmonicNumber]=TemplateBox[{n, 1}, HarmonicNumber2].
  • For arbitrary n and r1, the numerical value of TemplateBox[{n, r}, HarmonicNumber2] is given by Zeta[r]-HurwitzZeta[r,n+1].
  • HarmonicNumber can be evaluated to arbitrary numerical precision.
  • HarmonicNumber automatically threads over lists.
  • HarmonicNumber can be used with Interval and CenteredInterval objects. »

Examples

open allclose all

Basic Examples  (7)

First ten harmonic numbers:

Plot over a subset of the integers:

Plot over a subset of the complexes:

Series expansion at the origin:

Series expansion at Infinity:

Series expansion at a singular point:

Carry out sums involving harmonic numbers:

Scope  (34)

Numerical Evaluation  (5)

Evaluate numerically:

Evaluate to high precision:

The precision of the output tracks the precision of the input:

Complex number input:

Evaluate efficiently at high precision:

HarmonicNumber can be used with Interval and CenteredInterval objects:

Specific Values  (5)

HarmonicNumber[n,a] for symbolic a:

HarmonicNumber[n,a] for symbolic n:

Value at zero:

Find a value of n for which HarmonicNumber[n]=1.5:

Express harmonic numbers of fractional arguments in terms of elementary functions:

Visualization  (3)

Plot the HarmonicNumber function:

Plot the HarmonicNumber function for various orders:

Plot the real part of HarmonicNumber:

Plot the imaginary part of HarmonicNumber:

Function Properties  (11)

Real domain of HarmonicNumber:

Complex domain:

Real range of HarmonicNumber:

HarmonicNumber threads elementwise over lists and arrays:

HarmonicNumber is not an analytic function:

However, it is meromorphic:

HarmonicNumber is neither non-increasing nor non-decreasing:

HarmonicNumber is not injective:

HarmonicNumber is surjective:

HarmonicNumber is neither non-negative nor non-positive:

HarmonicNumber has both singularities and discontinuities for negative integers:

HarmonicNumber is neither convex nor concave:

TraditionalForm formatting:

Differentiation  (3)

First derivative with respect to n:

Higher derivatives with respect to n:

Plot the higher derivatives with respect to n:

Formula for the ^(th) derivative with respect to n:

Integration  (3)

Compute the indefinite integral using Integrate:

Verify the anti-derivative:

Definite integral:

More integrals:

Series Expansions  (2)

Find the Taylor expansion using Series:

Plots of the first three approximations around :

General term in the series expansion using SeriesCoefficient:

Function Identities and Simplifications  (2)

The defining identity for HarmonicNumber:

Recurrence identities:

Generalizations & Extensions  (5)

Harmonic Numbers  (2)

Series expansion at infinity:

HarmonicNumber can be applied to power series:

Harmonic Numbers of Order r  (3)

Evaluate at exact arguments:

Series expansion at any point:

Series expansion at infinity:

Applications  (5)

The average number of comparisons in Quicksort:

Plot over the complex plane:

Book stacking with the maximal overhang:

Pick the best candidate out of n candidates after x evaluated choices [more info]:

Evaluate for n=100:

Plot as a function of the size of the candidate pool:

A finite sum with StirlingS1 expressed in terms of HarmonicNumber:

A finite sum with StirlingS2 expressed in terms of HarmonicNumber:

Properties & Relations  (10)

HarmonicNumber can be expressed in terms of PolyGamma:

HarmonicNumber can be expressed in terms of Zeta and HurwitzZeta:

Use FullSimplify to simplify expressions containing harmonic numbers:

Expand in simpler functions:

Sums:

Generate from sums and integrals:

HarmonicNumber can be represented as a DifferenceRoot:

General term in the series expansion of HarmonicNumber:

The ordinary generating function for HarmonicNumber:

The exponential generating function for HarmonicNumber:

Possible Issues  (3)

Large arguments can give results too large to be computed explicitly:

Machine-number inputs can give highprecision results:

Results are often expressed in terms of PolyGamma instead of HarmonicNumber:

Wolfram Research (1999), HarmonicNumber, Wolfram Language function, https://reference.wolfram.com/language/ref/HarmonicNumber.html.

Text

Wolfram Research (1999), HarmonicNumber, Wolfram Language function, https://reference.wolfram.com/language/ref/HarmonicNumber.html.

CMS

Wolfram Language. 1999. "HarmonicNumber." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/HarmonicNumber.html.

APA

Wolfram Language. (1999). HarmonicNumber. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/HarmonicNumber.html

BibTeX

@misc{reference.wolfram_2023_harmonicnumber, author="Wolfram Research", title="{HarmonicNumber}", year="1999", howpublished="\url{https://reference.wolfram.com/language/ref/HarmonicNumber.html}", note=[Accessed: 18-March-2024 ]}

BibLaTeX

@online{reference.wolfram_2023_harmonicnumber, organization={Wolfram Research}, title={HarmonicNumber}, year={1999}, url={https://reference.wolfram.com/language/ref/HarmonicNumber.html}, note=[Accessed: 18-March-2024 ]}