stats
::uniformPDF
Probability density 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::uniformPDF(a
, b
)
stats::uniformPDF(a, b)
returns a procedure
representing the probability density function
of the uniform distribution on the interval [a, b].
The procedure f := stats::uniformPDF(a, b)
can
be called in the form f(x)
with an arithmetical
expression x
. The return value of f(x)
is
either a floatingpoint number or a symbolic expression:
If x < a or x > b can
be decided, then f(x)
returns 0.
If a ≤ x and x ≤ b can
be decided, then f(x)
returns the value 1/(b
 a)
.
If x is a real floatingpoint number and both a and b can be converted to real floatingpoint numbers, then these values are returned as floatingpoint 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 < a,
or x > b,
or a ≤ x and x ≤ b,
then the corresponding values are returned.
f(x)
returns the symbolic call stats::uniformPDF(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 a ≤ b.
The function is sensitive to the environment variable DIGITS
which
determines the numerical working precision.
We evaluate the probability density function on the interval [ 3, 2 π] at various points:
f := stats::uniformPDF(3, 2*PI): f(infinity), f(PI), f(3.0), f(1/2), f(0.5), f(PI), f(infinity)
delete f:
If x
is a symbolic object without properties,
then it cannot be decided whether a ≤ x ≤ b hold.
A symbolic function call is returned:
f := stats::uniformPDF(a, b): f(x)
With suitable properties, it can be decided whether a ≤ x ≤ b 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:
We use symbolic arguments:
f := stats::uniformPDF(a, b): f(x)
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:

arithmetical expressions representing real values; a ≤ b is assumed. 