Documentation

# `stats`::`erlangPDF`

Probability density function of the Erlang distribution

MuPAD® notebooks will be removed in a future release. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.

## Syntax

```stats::erlangPDF(`a`, `b`)
```

## Description

`stats::erlangPDF(a, b)` returns a procedure representing the probability density function of the Erlang distribution with shape parameter a > 0 and scale parameter b > 0.

The procedure `f := stats::erlangPDF(a, b)` can be called in the form `f(x)` with an arithmetical expression `x`. The return value of `f(x)` is either a floating-point number or a symbolic expression:

If x ≤ 0 can be decided, then `f(x)` returns 0. If x > 0 can be decided, then `f(x)` returns the value .

If x is a floating-point number and both a and b can be converted to positive floating-point numbers, then these values are returned as floating-point numbers. Otherwise, symbolic expressions are returned.

The function `f` reacts to properties of identifiers set via `assume`. If x is a symbolic expression with the property x ≤ 0 or x > 0, the corresponding values are returned.

`f(- infinity )` and `f( infinity )` return 0.

`f(x)` returns the symbolic call ```stats::erlangPDF(a, b)(x)``` if neither x ≤ 0 nor x > 0 can be decided.

Numerical values for `a` and `b` are only accepted if they are real and positive.

Note that, for large a, exact results may be costly to compute. If floating-point values are desired, it is recommended to pass floating-point arguments `x` to `f` rather than to compute exact results `f(x)` and convert them via `float`. Cf. Example 4.

Note that .

## Environment Interactions

The function is sensitive to the environment variable `DIGITS` which determines the numerical working precision. The procedure generated by `stats::erlangPDF` reacts to properties of identifiers set via `assume`.

## Examples

### Example 1

We evaluate the probability density function with a = 2 and b = 1 at various points:

```f := stats::erlangPDF(2, 1): f(-infinity), f(-PI), f(1/2), f(0.5), f(PI), f(infinity)```
` `
`delete f:`

### Example 2

If `x` is a symbolic object without properties, then it cannot be decided whether x > 0 holds. A symbolic function call is returned:

`f := stats::erlangPDF(a, b): f(x)`
` `

With suitable properties, it can be decided whether x > 0 holds. An explicit expression is returned:

`assume(0 < x): f(x)`
` `
`unassume(x): delete f:`

### Example 3

We use symbolic arguments:

`f := stats::erlangPDF(a, b): f(x), f(3)`
` `

When numerical values are assigned to `a` and `b`, the function `f` starts to produce numerical values:

`a := 2: b := 1: f(3), f(3.0)`
` `
`delete f, a, b:`

### Example 4

We consider an Erlang distribution with large shape parameter:

`f := stats::erlangPDF(2000, 1):`

For floating-point approximations, one should not compute an exact result and convert it via `float`. For large shape parameter, it is faster to pass a floating-point argument to `f`. The following call takes some time, because an exact computation of the huge integer is involved:

`float(f(2010))`
` `

The following call is much faster:

`f(float(2010))`
` `
`delete f:`

## Parameters

 `a` The shape parameter: an arithmetical expression representing a positive real value `b` The scale parameter: an arithmetical expression representing a positive real value

## Return Values

#### Mathematical Modeling with Symbolic Math Toolbox

Get examples and videos