Dependence table with all properties of an expression
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.
property::depends(ex, …
)
property::depends(...)
returns a table which
contains all information about the properties of the whole input.
This table can be used to determine any change of the properties of
an expression.
The returned table is mainly used inside the MuPAD^{®} library, to ensure the validity of remembered results of the remember mechanism.
A MuPAD expression can have different properties at different times, without changing its value.
Note: The kernel remember mechanism cannot determine the change of the properties and returns wrong results, when the result depends on the properties of the input. 
In this case the extended remember mechanism provided by prog::remember
should
be used together with property::depends
.
A compare of the dependence table at different times detects changes of the properties of an expression.
The first call to the defined function has_changed
initializes
the table DEPENDS
that keeps the dependence information:
DEPENDS := table(): has_changed := proc(ex) begin if not contains(DEPENDS, ex) or property::depends(ex) <> DEPENDS[ex] then DEPENDS[ex] := property::depends(ex); TRUE else FALSE end_if end_proc: has_changed(sin(x*PI)):
The properties has not changed:
has_changed(sin(x*PI))
Every change is detected:
assume(x, Type::Integer): has_changed(sin(x*PI))
assume(x, Type::PosInt): has_changed(sin(x*PI))
assume(x >= 0): has_changed(sin(x*PI))
unassume(x): has_changed(sin(x*PI))
delete DEPENDS, has_changed:
The next example shows the problems with the kernel remember mechanism:
pos := proc(x) option remember; begin is(x > 0) end: pos(x)
The result UNKNOWN
was stored for the input x
and
is returned, although the properties of x
are changed:
assume(x > 0): pos(x); assume(x < 0): pos(x)
This problem can only be solved by the extended remember mechanism together
with property::depends
(x
still
is less than zero):
pos := proc(x) begin is(x > 0) end: pos := prog::remember(pos, property::depends): pos(x)
After changing the properties of the input, the defined function recomputes the result:
assume(x > 0): pos(x); unassume(x): pos(x)

Any MuPAD expression 
Table that can be compared with another dependence table