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.
_subtract(x, y) subtracts
The difference operator
- does not call
y). The difference
x - y is equivalent
x + (-y) = _plus (x, _negate(y)).
To implement the slot
d::_subtract for your
d, use the following convention:
d, the slot must return an appropriate
difference of type
not an element of
d and cannot be converted to
an element of
d, the slot must return
not an element of
d, but can be converted to type
use the following approach. This object must be converted to an element
d only if the mathematical semantics is obvious
to all users of
d, including the users who treat
this domain as a "black box". For example, you can regard
integers as rational numbers because of the natural mathematical embedding,
but you must make sure that all users are aware of this approach.
"_subtract" method must return
of using implicit conversions. If you use implicit conversions for
the elements of your domain, document these conversions.
In the MuPAD® standard installation, most of the library domains comply with this convention.
_subtract can subtract polynomials of the
from a polynomial of the same type. The polynomials must have the
same indeterminates and the same coefficient ring.
_subtract can subtract finite sets from a
finite set. For finite sets
the difference is the set
Compute the difference of the following arithmetical expressions
by using the
_subtract method. Then, compute the
difference of the same expressions by using the difference operator:
_subtract(x, y), x - y
_subtract and the difference
operator return the same result for these expressions, the
is not equivalent to
x - y:
type(hold(x - y)), type(hold(_subtract(x, y)))
_subtract function when combining
the following lists:
zip([a, b, c, d], [1, 2, 3, 4], _subtract)