in

Symbolic membership relation: tests that an expression lies in a set.

Category: Symbolic Computations in MATLAB > Operators and Elementary Operations

Syntax

c = in(x, set)

Builds the relation "x belongs to set".

Description

in expresses that a quantity belongs to a set, for example in(x, 'integer'), and is mostly used to state assumptions about a variable for later simplification or solving. Here 'real' means real numbers, 'rational' the rational numbers and 'integer' the integers.

The relation prints in the form in(x, 'integer').

Input arguments

x
Symbolic variable or expression.
set
Name of the set: 'real', 'integer', 'rational' or 'positive'.

Output arguments

c
Symbolic relation, usable with assume, assumeAlso or isAlways.

Example

Build the relations

syms x
in(x, 'integer')
in(x, 'real')
Output
ans = in(x, 'integer')
ans = in(x, 'real')

Notes

In MatLivre in only builds the relation; it is not evaluated for known values (in(sym(3), 'integer') stays unevaluated) and isAlways does not resolve it.

See also

assume isAlways isreal sym