This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.


Cumulative distribution function of the uniform distribution

MuPAD® notebooks are not recommended. 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::uniformCDF(a, b)


stats::uniformCDF(a, b) returns a procedure representing the cumulative distribution function

of the uniform distribution on the interval [a, b].

The procedure f := stats::uniformCDF(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 < a can be decided, then f(x) returns 0. If x > b can be decided, then f(x) returns the value 1. If ax and xb can be decided, then f(x) returns the value (x - a)/(b - a).

If x is a real floating-point number and both a and b can be converted to real 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 xa, or xb, or ax and xb, then the corresponding values are returned.

f(x) returns the symbolic call stats::uniformCDF(a, b)(x) if it cannot be decided whether x lies in the interval [a, b].

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

Environment Interactions

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


Example 1

We evaluate the cumulative distribution function on the interval [- 3, 2 π] at various points:

f := stats::uniformCDF(-3, 2*PI):
f(-infinity), f(-3), f(0.5), f(2/3), f(3.0), f(PI), f(infinity)

delete f:

Example 2

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

f := stats::uniformCDF(a, b): f(x)

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

assume(x < a): f(x)

Note that assume(x < a) attached properties both to a and x. With the next call, we overwrite the property attached to x. However, the property attached to a has to be 'unassumed' as well to avoid inconsistent assumptions x < a and x > b:

unassume(a): assume(x > b): f(x)

assume(a <= x <= b): f(x)

assume(b > a): f(a + (b - a)/3)

unassume(x): unassume(a): unassume(b): delete f:

Example 3

We use symbolic arguments:

f := stats::uniformCDF(a, b): f(3), f(3.0)

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

a := 0: b := PI: f(3), f(3.0)

delete f, a, b:


a, b

arithmetical expressions representing real values; ab is assumed.

Return Values


Was this topic helpful?