harmonic - Maple Help

# Online Help

###### All Products    Maple    MapleSim

harmonic

calculate the harmonic function

 Calling Sequence harmonic(x) harmonic(x, y)

Parameters

 x - expression y - expression

Description

 • The harmonic function is defined in terms of the Psi and Zeta functions as follows.
 > FunctionAdvisor(definition, harmonic);
 $\left[{\mathrm{harmonic}}{}\left({z}\right){=}{\mathrm{\Psi }}{}\left({z}{+}{1}\right){+}{\mathrm{\gamma }}{,}{\mathrm{with no restrictions on}}{}\left({z}\right)\right]{,}\left[{\mathrm{harmonic}}{}\left({a}{,}{z}\right){=}{\mathrm{\zeta }}{}\left({z}\right){-}{\mathrm{\zeta }}{}\left({0}{,}{z}{,}{a}{+}{1}\right){,}{\mathrm{with no restrictions on}}{}\left({a}{,}{z}\right)\right]$ (1)
 • When the first parameter is a non-negative integer n, the harmonic function admits a Sum representation
 > FunctionAdvisor(sum_form, harmonic(n));
 $\left[{\mathrm{harmonic}}{}\left({n}\right){=}{\sum }_{{\mathrm{_k1}}{=}{1}}^{{n}}{}\frac{{1}}{{\mathrm{_k1}}}{,}{n}{::}{'}{\mathrm{nonnegint}}{'}\right]{,}\left[{\mathrm{harmonic}}{}\left({n}\right){=}{\sum }_{{\mathrm{_k1}}{=}{1}}^{{\mathrm{\infty }}}{}\frac{{n}}{{\mathrm{_k1}}{}\left({\mathrm{_k1}}{+}{n}\right)}{,}{n}{::}\left({¬}{'}{\mathrm{negint}}{'}\right)\right]{,}\left[{\mathrm{harmonic}}{}\left({n}\right){=}{\sum }_{{\mathrm{_k2}}{=}{0}}^{{\mathrm{\infty }}}{}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{\sum }_{{\mathrm{_k1}}{=}{0}}^{{\mathrm{\infty }}}{}\frac{{\left({-1}\right)}^{{\mathrm{_k1}}}{}{{n}}^{{\mathrm{_k1}}{+}{1}}}{{\left({\mathrm{_k2}}{+}{1}\right)}^{{\mathrm{_k1}}{+}{2}}}{,}\left|{n}\right|{<}{1}\right]$ (2)
 > FunctionAdvisor(sum_form, harmonic(n,z));
 $\left[{\mathrm{harmonic}}{}\left({n}{,}{z}\right){=}{\sum }_{{\mathrm{_k1}}{=}{1}}^{{n}}{}\frac{{1}}{{{\mathrm{_k1}}}^{{z}}}{,}{n}{::}{'}{\mathrm{nonnegint}}{'}\right]{,}\left[{\mathrm{harmonic}}{}\left({n}{,}{z}\right){=}\left({\sum }_{{\mathrm{_k1}}{=}{1}}^{{\mathrm{\infty }}}{}\frac{{1}}{{{\mathrm{_k1}}}^{{z}}}\right){-}\left({\sum }_{{\mathrm{_k1}}{=}{0}}^{{\mathrm{\infty }}}{}\frac{{1}}{{\left({n}{+}{1}{+}{\mathrm{_k1}}\right)}^{{z}}}\right){,}{1}{<}{\mathrm{\Re }}{}\left({z}\right)\right]{,}\left[{\mathrm{harmonic}}{}\left({n}{,}{z}\right){=}{\sum }_{{\mathrm{_k1}}{=}{1}}^{{\mathrm{\infty }}}{}\left({-}\frac{{\mathrm{pochhammer}}{}\left({z}{,}{\mathrm{_k1}}\right){}{\mathrm{\zeta }}{}\left({z}{+}{\mathrm{_k1}}\right){}{{n}}^{{\mathrm{_k1}}}{}{\left({-1}\right)}^{{\mathrm{_k1}}}}{{\mathrm{_k1}}{!}}\right){,}\left|{n}\right|{<}{1}{\wedge }{1}{<}{\mathrm{\Re }}{}\left({z}\right)\right]$ (3)
 • When the first parameter is a negative integer an exception (error) is raised, signaling the event 'division_by_zero'. This behavior can be controlled using a NumericEventHandler, which will be passed complex infinity as the default value.
 • When the first parameter is a small non-negative integer and the second parameter, if present, is a non-negative integer, harmonic returns a rational number.

Examples

 > $\mathrm{harmonic}\left(3\right)$
 $\frac{{11}}{{6}}$ (4)
 > $\mathrm{harmonic}\left(3,2\right)$
 $\frac{{49}}{{36}}$ (5)
 > $\mathrm{harmonic}\left(r,s\right)$
 ${\mathrm{harmonic}}{}\left({r}{,}{s}\right)$ (6)
 > $=\mathrm{convert}\left(,\mathrm{Sum}\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{assuming}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}r::'\mathrm{nonnegint}'$
 ${\mathrm{harmonic}}{}\left({r}{,}{s}\right){=}{\sum }_{{\mathrm{_k1}}{=}{1}}^{{r}}{}\frac{{1}}{{{\mathrm{_k1}}}^{{s}}}$ (7)
 > $=\mathrm{convert}\left(,\mathrm{\zeta }\right)$
 ${\mathrm{harmonic}}{}\left({r}{,}{s}\right){=}{\mathrm{\zeta }}{}\left({s}\right){-}{\mathrm{\zeta }}{}\left({0}{,}{s}{,}{r}{+}{1}\right)$ (8)
 > $=\mathrm{convert}\left(,\mathrm{\Psi }\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{assuming}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}s::'\mathrm{posint}'$
 ${\mathrm{harmonic}}{}\left({r}{,}{s}\right){=}\frac{{\left({-1}\right)}^{{s}}{}\left({\mathrm{\Psi }}{}\left({-}{1}{+}{s}{,}{1}\right){-}{\mathrm{\Psi }}{}\left({-}{1}{+}{s}{,}{r}{+}{1}\right)\right)}{\left({-}{1}{+}{s}\right){!}}$ (9)
 > $\mathrm{diff}\left(,r\right)$
 ${s}{}{\mathrm{\zeta }}{}\left({0}{,}{s}{+}{1}{,}{r}{+}{1}\right){=}{-}\frac{{\left({-1}\right)}^{{s}}{}{\mathrm{\Psi }}{}\left({s}{,}{r}{+}{1}\right)}{\left({-}{1}{+}{s}\right){!}}$ (10)
 > $\mathrm{evalf}\left(\mathrm{eval}\left(,\left[r=\frac{10}{43}+\frac{I}{2},s=4\right]\right)\right)$
 ${-0.2942981267}{-}{0.9671639794}{}{I}{=}{-0.2942981267}{-}{0.9671639794}{}{I}$ (11)

Special values for the harmonic function

 > $\mathrm{FunctionAdvisor}\left(\mathrm{special_values},\mathrm{harmonic}\right)$
 $\left[{\mathrm{harmonic}}{}\left({0}\right){=}{0}{,}{\mathrm{harmonic}}{}\left({1}\right){=}{1}{,}{\mathrm{harmonic}}{}\left({-1}\right){=}{\mathrm{\infty }}{+}{\mathrm{\infty }}{}{I}{,}{\mathrm{harmonic}}{}\left({\mathrm{\infty }}\right){=}{\mathrm{\infty }}{,}{\mathrm{harmonic}}{}\left({-}{\mathrm{\infty }}\right){=}{\mathrm{\infty }}{,}{\mathrm{harmonic}}{}\left({0}{,}{z}\right){=}{0}{,}{\mathrm{harmonic}}{}\left({1}{,}{z}\right){=}{1}{,}{\mathrm{harmonic}}{}\left({a}{,}{0}\right){=}{a}{,}{\mathrm{harmonic}}{}\left({a}{,}{1}\right){=}{\mathrm{harmonic}}{}\left({a}\right){,}{\mathrm{harmonic}}{}\left({-1}{,}{z}\right){=}{\mathrm{\infty }}{+}{\mathrm{\infty }}{}{I}\right]$ (12)
 > 

 See Also