Main Content

eulergamma

Euler-Mascheroni constant

Syntax

``eulergamma``

Description

example

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

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 $\gamma =-\Psi \left(1\right).$

`-psi(sym(1))`
```ans = eulergamma```

Show that $\gamma =-\Gamma \text{'}\left(x\right)|{}_{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:

`$\gamma =\underset{n\to \infty }{\mathrm{lim}}\left(\left(\sum _{k=1}^{n}\frac{1}{k}\right)-\mathrm{ln}\left(n\right)\right)$`

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`.

See Also

Introduced in R2014a

Symbolic Math Toolbox Documentation

Mathematical Modeling with Symbolic Math Toolbox

Get examples and videos