Discontinuities of a function

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.


discont(f, x)
discont(f, x, <Undefined>)
discont(f, x, <Real>)
discont(f, x = a .. b)
discont(f, x = a .. b, <Undefined>)
discont(f, x = a .. b, <Real>)


discont(f, x) computes the set of all discontinuities of the function f(x).

discont(f, x = a..b) computes the set of all discontinuities of f(x) lying in the interval [a, b].

discont(f, x) returns a set of numbers containing all discontinuities of f when f is regarded as a function of x on the set of all complex numbers that may be attained by x as values, as specified by the assumptions on x. Please note that a real number that is a discontinuity of a complex function need not be a discontinuity of the restriction of that function to the set of real numbers: consider, for example, a function that has its branch cut on the real axis, as in Example 2 below.

Discontinuities include points where the function is not defined as well as points where the function is defined but not continuous. If the option Undefined is used, only points where the function is not defined are returned.

If the option Real is used, it is assumed that f and all of its subexpressions represent real numbers.

If a range a..b is given, it is assumed that x can take on values only in the interval [a, b].

The set returned by discont may contain numbers that are not discontinuities of f. See Example 7.

If discont is unable to compute the discontinuities, then a symbolic discont call is returned; see Example 8.

discont can be extended to user-defined mathematical functions via overloading. To this end, embed the mathematical function in a function environment and assign the set of real discontinuities to its "realDiscont" slot, the set of its complex discontinuities to its "complexDiscont" slot, and the set of points where the function is not defined to its "undefined" slot. See solve for an overview of the various types of sets. See also Example 8 below.

Environment Interactions

discont reacts to properties of free parameters both in f as well as in a and b. discont sometimes reacts to properties of x.


Example 1

The gamma function has poles at all integers less or equal to zero. Hence x -> gamma(x/2) has poles at all even integers less or equal to zero:

discont(gamma(x/2), x)

Example 2

The logarithm has a branch cut on the negative real axis; hence, it is not continuous there. However, its restriction to the real numbers is continuous at every point except zero:

discont(ln(x), x), discont(ln(x), x, Real)

Example 3

The function sign is defined everywhere; it is not continuous at zero:

discont(sign(x), x), discont(sign(x), x, Undefined)

Example 4

If a range is given, only the discontinuities in that range are returned.

discont(1/x/(x - 1), x = 0..1/2)

Example 5

A range may have arbitrary arithmetical expressions as boundaries. discont implicitly assumes that the right boundary is greater or equal to the left boundary:

discont(1/x, x = a..b)

Example 6

As can be seen from the previous example, discont reacts to properties of free parameters (because piecewise does). The result also depends on the properties of x: it may omit values that x cannot take on anyway because of its properties.

assume(x > 0):
discont(1/x, x)

delete x:

Example 7

Sometimes, discont returns a proper superset of the set of discontinuities:

discont(piecewise([x<>0, x*sin(1/x)], [x=0, 0]), x)

Example 8

If discont cannot determine the discontinuities of a given function, then discont assumes the function is continuous and returns an empty set:

delete f: discont(f(x), x)

You can provide the necessary information by adding slots to f. For example, assume that f is not continuous at 1 but everywhere else; and that also its restriction to the real numbers remains discontinuous at 1. After adding the corresponding slots, discont takes care to handle f correctly also if it appears in a more complicated expression:

f:= funcenv(x->procname(x)): 
f::realDiscont:= {1}: 
f::complexDiscont:= {1}:
discont(f(sin(x)), x=-4..34)

Example 9

We define a function that implements the logarithm to base 2. For simplicity, we let it always return the unevaluated function call. The logarithm has a branch cut on the negative real axis; its restriction to the reals is continuous everywhere except at zero:

binlog := funcenv(x -> procname(x)):
binlog::realDiscont := {0}:
binlog::undefined := {0}:
binlog::complexDiscont := Dom::Interval(-infinity, [0]):
discont(binlog(x), x);
discont(binlog(x), x=-2..2, Real);
discont(binlog(x), x=-2..2, Undefined)



An arithmetical expression representing a function in x


An identifier

a, b

Interval boundaries: arithmetical expressions



Return only those points where f is not defined (and not just discontinuous).


Assume that all subexpressions of f are real.

Return Values

Set—see the help page for solve for an overview of all types of sets—or a symbolic discont call.

Overloaded By


See Also

MuPAD Functions