Probability density function of the Cauchy 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.


stats::cauchyPDF(a, b)


stats::cauchyPDF(a, b) returns a procedure representing the probability density function

of the Cauchy distribution with median a and scale parameter b > 0.

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

  • If x is a floating-point number and a and b can be converted to suitable floating-point numbers, then f(x) returns a floating-point number.

  • In all other cases, the symbolic expression b/PI * 1/((x-a)^2 + b^2) is returned.

Numerical values of a and b are only accepted if they are real and b is positive.

Environment Interactions

The function is sensitive to the environment variable DIGITS which determines the numerical working precision.


Example 1

We calculate the Cauchy density with a = 2 and at various points:

f := stats::cauchyPDF(2, 3/4):
f(-infinity), f(9/10), f(0.9), f(2), f(infinity)

delete f:

Example 2

We use symbolic arguments:

f := stats::cauchyPDF(a, b):
f(x), f(2), f(2.0)

When a and b evaluate to numbers, the function f starts to produce numerical values:

a := PI:
b:= 1/8:
f(2), f(2.0)

delete f, a, b:



The median: an arithmetical expression representing a real value


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

Return Values