Compare objects according to the internal order
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.
sysorder(object1, object2) returns
the MuPAD® internal order of
object1 is less
than or equal to the order of
Note: The exceptions are domains.
One should not try and use the internal order to sort objects according to specific criteria. E.g., its does not necessarily reflect the natural ordering of numbers or strings. Further, the internal order may differ between different MuPAD versions.
The only feature one may rely upon is its uniqueness. Cf. Example 2.
We give some examples how
in the current MuPAD version. For numbers, the internal order is equal
to the natural order:
sysorder(3, 4) = bool(3 <= 4), sysorder(45, 33) = bool(45 <= 33), sysorder(0, 4) = bool(0 <= 4)
sysorder(1/3, 1/4) = bool(1/3 <= 1/4), sysorder(-4, 2) = bool(-4 <= 2), sysorder(-4, -2) = bool(-4 <= -2)
We give a simple application of
Suppose, we want to implement a function
whose only known property is its skewness
f(-x) = -f(x).
f should be simplified automatically,
f(x) + f(-x) should yield zero for any argument
To achieve this, we use
sysorder to decide, whether
f(x) should return
f := proc(x) begin if sysorder(x, -x) then return(-procname(-x)) else return(procname(x)) end_if; end_proc:
For numerical arguments,
f prefers to rewrite
itself with positive arguments:
f(-3), f(3), f(-4.5), f(4.5), f(-2/3), f(2/3)
For other arguments, the result is difficult to predict:
f(x), f(-x), f(sqrt(2) + 1), f(-sqrt(2) - 1)
With this implementation, expressions involving
f(x) + f(-x) - f(3)*f(x) + f(-3)*f(-x) + sin(f(7)) + sin(f(-7))
Arbitrary MuPAD objects