Main Content

eulergamma

Euler-Mascheroni constant

Description

eulergamma represents the Euler-Mascheroni constant. To get a floating-point approximation with the current precision set by digits, use vpa(eulergamma).

example

Examples

Represent and Numerically Approximate the Euler-Mascheroni Constant

Represent the Euler-Mascheroni constant using eulergamma, which returns the symbolic form eulergamma.

eulergamma
ans =
eulergamma

Use eulergamma in symbolic calculations. Numerically approximate your result with vpa.

a = eulergamma;
g = a^2 + log(a)
gVpa = vpa(g)
g =
log(eulergamma) + eulergamma^2
gVpa =
-0.21636138917392614801928563244766

Find the double-precision approximation of the Euler-Mascheroni constant using double.

double(eulergamma)
ans =
    0.5772

Show Relation of Euler-Mascheroni Constant to Gamma Functions

Show the relations between the Euler-Mascheroni constant γ, digamma function Ψ, and gamma function Γ.

Show that γ=Ψ(1).

-psi(sym(1))
ans =
eulergamma

Show that γ=Γ'(x)|x=1.

syms x
-subs(diff(gamma(x)),x,1)
ans =
eulergamma

More About

collapse all

Euler-Mascheroni Constant

The Euler-Mascheroni constant is defined as follows:

γ=limn((k=1n1k)ln(n))

Tips

  • For the value e = 2.71828…, called Euler’s number, use exp(1) to return the double-precision representation. For the exact representation of Euler’s number e, call exp(sym(1)).

  • For the other meaning of Euler’s numbers and for Euler’s polynomials, see euler.

Version History

Introduced in R2014a

See Also

|