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, in(n, 'integer')]
The syntax in(n, 'integer') indicates n is an integer.
To see the assumptions set on the variable x, enter:
ans = [ -100 <= n*x, n*x <= 100, in(x, 'rational')]
To see the assumptions set on all variables, use assumptions without any arguments:
ans = [ -100 <= n*x, n*x <= 100, in(n, 'integer'), in(x, 'rational')]
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, in(x, 'real')]
The syntax in(x, 'real') indicates x is real.
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: