# pdf function

The density of a distribution at a point, or the probability of a value for a discrete one.

## How to write it

### pdf(distribution, x)

The density, or the probability of a whole number for a discrete distribution.

**distribution**

A distribution such as normal_distribution(0, 1). Takes an expression.

**x**

The point, or the value. Takes an expression.

### pdf(process, y)

The density of a stochastic process at a time.

**process**

A process at a time, written construct(p, t), or p(t) for a stored process p. Takes an expression.

**y**

The value of the process. Takes an expression.

## Examples

- $\displaystyle f_{X}(x),\ X \sim \mathcal{N}(0, 1) = \frac{\sqrt{2}}{2 \sqrt{\pi} e^{\frac{x^{2}}{2}}}$

  `pdf(normal_distribution(0, 1), x)`

  In the solver, `pdf(normal_distribution(0, 1), x)` gives `(1/2)sqrt(2)*e^(-x^2/2)/sqrt(pi)`.

  [Open in the solver](https://hilberon.com/?q=pdf%28normal_distribution%280%2C%201%29%2C%20x%29)
- $\displaystyle f_{X}(2),\ X \sim \mathrm{B}\left(5, \frac{1}{3}\right) = \frac{80}{243}$

  `pdf(binomial_distribution(5, 1/3), 2)`

  In the solver, `pdf(binomial_distribution(5, 1/3), 2)` gives `80/243`.

  [Open in the solver](https://hilberon.com/?q=pdf%28binomial_distribution%285%2C%201%2F3%29%2C%202%29)
- $\displaystyle \operatorname{pdf}(\operatorname{construct}(\operatorname{OU}(\mu, \sigma, \theta, x_{0}), t), y) = \begin{cases} \frac{\sqrt{2}}{2 e^{\frac{\left(y-\left(\frac{x_{0}-\mu}{e^{t \theta}}+\mu\right)\right)^{2}}{2 \left(\frac{\sigma^{2}}{2 \theta}-\frac{\sigma^{2}}{2 \theta e^{2 t \theta}}\right)}} \sqrt{\pi \left(\frac{\sigma^{2}}{2 \theta}-\frac{\sigma^{2}}{2 \theta e^{2 t \theta}}\right)}} & \text{if } \theta \neq 0 \end{cases}$

  `pdf(construct(ornstein_uhlenbeck_process(mu, sigma, theta, x0), t), y)`

  In the solver, `pdf(construct(ornstein_uhlenbeck_process(mu, sigma, theta, x0), t), y)` gives `(1/2)sqrt(2)*e^((-1/2)*(y - (e^(-t*theta)*(x0 - mu) + mu))^2/((1/2)sigma^2/theta - (1/2)sigma^2*e^(-2t*theta)/theta))/sqrt(pi*((1/2)sigma^2/theta - (1/2)sigma^2*e^(-2t*theta)/theta)) if theta != 0`.

  [Open in the solver](https://hilberon.com/?q=pdf%28construct%28ornstein_uhlenbeck_process%28mu%2C%20sigma%2C%20theta%2C%20x0%29%2C%20t%29%2C%20y%29)

## Functions its examples use

- [normal_distribution](https://hilberon.com/library/normal_distribution)

  The normal distribution with mean mu and standard deviation sigma.
- [binomial_distribution](https://hilberon.com/library/binomial_distribution)

  The number of successes in n independent trials that each succeed with chance p.
- [construct](https://hilberon.com/library/construct)

  Apply a head that is itself computed to arguments, as in f'(0) or (x => body)(a).
- [ornstein_uhlenbeck_process](https://hilberon.com/library/ornstein_uhlenbeck_process)

  A process pulled toward mu at rate theta, with noise sigma, started at x0.

## Related functions

- [poisson_distribution](https://hilberon.com/library/poisson_distribution)

  The number of events in a period when they come at an average rate lambda.
- [probability](https://hilberon.com/library/probability)

  The probability that a condition holds for a variable with a distribution.
- [quantile](https://hilberon.com/library/quantile)

  The smallest value with at least a share q of a list, or a chance q of a distribution, at or below it.
- [mode](https://hilberon.com/library/mode)

  The most frequent value of a list, or a list of them when several are equally frequent.
- [standard_deviation](https://hilberon.com/library/standard_deviation)

  The sample standard deviation of a list of numbers, or that of a distribution.
- [median](https://hilberon.com/library/median)

  The middle value of a list of numbers, or the mean of the two middle ones.

---
Source: https://hilberon.com/library/pdf
