@, _fconcat

Compose functions

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.


f @ g @ ...
_fconcat(f, g, …)


f@g represents the composition of the functions f and g.

In MuPAD®, functions are usually represented by procedures of type DOM_PROC, functionenvironments, or functional expressions such as f@g@exp + id^2. In fact, practically any MuPAD object may serve as a function.

f @ g is equivalent to the function call _fconcat(f, g).

_fconcat() returns the identity map id; _fconcat(f) returns f.


Example 1

The following function h is the composition of the system functions abs and sin:

h := abs@sin

h(x), h(y + 2), h(0.5)

The following functional expressions represent polynomials:

f := id^3 + 3*id - 1: f(x), (f@f)(x)

The random generator random produces nonnegative integers with 12 digits. The following composition of float and random produces random floating-point numbers between 0.0 and 1.0:

rand := float@random/10^12: rand() $ k = 1..12

In conjunction with the function map, the composition operator @ is a handy tool to apply composed functions to the operands of a data structure:

map([1, 2, 3, 4], (PI + id^2)@sin),
map({1, 2, 3, 4}, cos@float)

delete h, f, rand:

Example 2

Some simplifications of functional expressions are possible via simplify:

exp@ln + cos@arccos = simplify(cos@arccos + exp@ln)


f, g, …


Return Values

Expression of type "_fconcat".

Overloaded By

f, g

See Also

MuPAD Functions