Documentation Center

  • Trial Software
  • Product Updates

assumptions

Show assumptions set on symbolic variable

Syntax

Description

example

assumptions(var) returns all assumptions set on variable var.

example

assumptions returns all assumptions set on all variables in MATLAB® Workspace.

Examples

Assumptions on Several Variables

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:

assumptions(n)
ans =
[ -100 <= n*x, n*x <= 100, n in Z_]

To see the assumptions set on the variable x, enter:

assumptions(x)
ans =
[ -100 <= n*x, n*x <= 100, x in Q_]

To see the assumptions set on all variables, use assumptions without any arguments:

assumptions
ans =
[ -100 <= n*x, n*x <= 100, n in Z_, x in Q_]

For further computations, clear the assumptions:

syms n x clear

Multiple Assumptions on One Variable

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_]

Input Arguments

expand all

var — Variable for which to show assumptionssymbolic variable | array of symbolic variables | vector of symbolic variables | matrix of symbolic variables

Variable for which to show assumptions, specified as a symbolic variable or array, vector, or matrix of symbolic variables.

More About

expand all

Tips

  • 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:

    sym('var','clear')
  • 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:

    clear all

See Also

| | | | | | | | | |

Related Examples

Was this topic helpful?