Show assumptions set on symbolic variable
Show the assumptions set on variables n and x separately, and then show assumptions set on all variables.
Assume that the variable n is integer and the variable x is rational. In addition to that , assume that the product n*x belongs to the interval from -100 to 100:
syms n x assume(n,'integer') assume(x,'rational') assumeAlso(-100 <= n*x <= 100)
To see the assumptions set on the variable n, enter:
ans = [ -100 <= n*x, n*x <= 100, n in Z_]
To see the assumptions set on the variable x, enter:
ans = [ -100 <= n*x, n*x <= 100, x in Q_]
To see the assumptions set on all variables, use assumptions without any arguments:
ans = [ -100 <= n*x, n*x <= 100, n in Z_, x in Q_]
For further computations, clear the assumptions:
syms n x clear
Show the assumptions set by using syms and assume.
Use assumptions to return all assumptions, including those set by the syms command:
syms x real assumeAlso(x < 0) assumptions(x)
ans = [ x < 0, x in R_]
When you delete a symbolic object from the MATLAB workspace by using clear, all assumptions that you set on that object remain in the symbolic engine. If later you declare a new symbolic variable with the same name, it inherits these assumptions.
To clear all assumptions set on a symbolic variable var and the value of the variable, use this command:
syms var clear
To clear assumptions and keep the value of the variable, use this command:
To clear all objects in the MATLAB workspace and close the MuPAD® engine associated with the MATLAB workspace resetting all its assumptions, use this command: