Syntax

Description

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 floating-point 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 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 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.

Environment Interactions

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

Examples

Example 1

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

Example 2

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:

Example 3

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: