# probability function

The probability that a condition holds for a variable with a distribution.

## How to write it

### probability(condition, distribution)

**condition**

A condition on the variable, such as x > 1 or -1 \< x \< 1. Takes a condition, true or false.

**distribution**

The variable and its distribution, written distributed(x, d). Takes an expression.

## Examples

- $\displaystyle P(x > 1),\ x \sim \mathcal{N}(0, 1) = \frac{1-\operatorname{erf}\left(\frac{\sqrt{2}}{2}\right)}{2}$

  `probability(x > 1, distributed(x, normal_distribution(0, 1)))`

  In the solver, `probability(x > 1, distributed(x, normal_distribution(0, 1)))` gives `(1 - erf(sqrt(2)/2))/2`.

  [Open in the solver](https://hilberon.com/?q=probability%28x%20%3E%201%2C%20distributed%28x%2C%20normal_distribution%280%2C%201%29%29%29)
- $\displaystyle P(x^{2} > 1),\ x \sim \mathcal{N}(0, 1) = 1-\operatorname{erf}\left(\frac{\sqrt{2}}{2}\right)$

  `probability(x^2 > 1, distributed(x, normal_distribution(0, 1)))`

  In the solver, `probability(x^2 > 1, distributed(x, normal_distribution(0, 1)))` gives `1 - erf(sqrt(2)/2)`.

  [Open in the solver](https://hilberon.com/?q=probability%28x%5E2%20%3E%201%2C%20distributed%28x%2C%20normal_distribution%280%2C%201%29%29%29)

## Functions its examples use

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

  A variable and the distribution it follows, as probability and expectation read it.
- [normal_distribution](https://hilberon.com/library/normal_distribution)

  The normal distribution with mean mu and standard deviation sigma.

## Related functions

- [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.
- [poisson_distribution](https://hilberon.com/library/poisson_distribution)

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

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

  The density of a distribution at a point, or the probability of a value for a discrete one.
- [stationary_distribution](https://hilberon.com/library/stationary_distribution)

  The law a process settles into over time, when it has one.
- [ornstein_uhlenbeck_process](https://hilberon.com/library/ornstein_uhlenbeck_process)

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

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