Test whether at least one of equations and inequalities represented as elements of symbolic array is valid

Create vector `V`

that contains the symbolic equation and inequalities
as its elements:

syms x real V = [x ~= x + 1, abs(x) >= 0, x == x];

Use `any`

to test whether at least one of them is valid for all values
of `x`

:

any(V)

ans = logical 1

Create this matrix of symbolic equations and inequalities:

syms x real M = [x == 2*x, x == abs(x); abs(x) >= 0, x == 2*x]

M = [ x == 2*x, x == abs(x)] [ 0 <= abs(x), x == 2*x]

Use `any`

to test equations and inequalities of this matrix. By
default, `any`

tests whether any element of each column is valid for all
possible values of variables. If at least one equation or inequality in the column is valid
(returns logical `1`

), then `any`

returns logical
`1`

for that column. Otherwise, it returns logical `0`

for the column. Thus, it returns `1`

for the first column and
`0`

for the second column:

any(M)

ans = 1×2 logical array 1 0

Create this matrix of symbolic equations and inequalities:

syms x real M = [x == 2*x, x == abs(x); abs(x) >= 0, x == 2*x]

M = [ x == 2*x, x == abs(x)] [ 0 <= abs(x), x == 2*x]

For matrices and multidimensional arrays, `any`

can test elements along
the specified dimension. To specify the dimension, use the second argument of
`any`

. For example, to test elements of each column of a matrix, use the
value 1 as the second argument:

any(M, 1)

ans = 1×2 logical array 1 0

To test elements of each row, use the value 2 as the second argument:

any(M, 2)

ans = 2×1 logical array 0 1

Test whether any element of this vector returns logical
`1`

. Note that `any`

also converts all numeric values
outside equations and inequalities to logical `1`

s and
`0`

s. The numeric value 0 becomes logical `0`

:

syms x any([0, x == x + 1])

ans = logical 0

All nonzero numeric values, including negative and complex values, become logical
`1`

s:

any([-4 + i, x == x + 1])

ans = logical 1

If

`A`

is an empty symbolic array,`any(A)`

returns logical`0`

.If some elements of

`A`

are just numeric values (not equations or inequalities),`any`

converts these values as follows. All nonzero numeric values become logical`1`

. The value 0 becomes logical`0`

.If

`A`

is a vector and any of its elements returns logical`1`

,`any(A)`

returns logical`1`

. If all elements are zero,`any(A)`

returns logical`0`

.If

`A`

is a multidimensional array,`any(A)`

treats the values along the first dimension that is not equal to 1 (non-singleton dimension) as vectors, returning logical`1`

or`0`

for each vector.