@sym
: find (x)
¶@sym
: find (x, n)
¶@sym
: find (x, n, dir)
¶@sym
: [i, j] =
find (…)
¶@sym
: [i, j, v] =
find (…)
¶Find non-zero or true entries of a symbolic matrix.
Example:
syms x y positive find ([0 x 0 y]) ⇒ 2 4
Note its enough that an expression could be non-zero:
syms x y find ([x 0 0 1 x+y]) ⇒ 1 4 5
For matrices containing equalities, inequalities and boolean
expressions, find
looks for True
(but does not
simplify):
syms x y A = [x == x; or(x == y, x*(y+1) >= x*y+x); x^2-y^2 == (x-y)*(x+y)] ⇒ A = (sym 3×1 matrix) ⎡ True ⎤ ⎢ ⎥ ⎢x = y ∨ x⋅(y + 1) ≥ x⋅y + x⎥ ⎢ ⎥ ⎢ 2 2 ⎥ ⎣ x - y = (x - y)⋅(x + y) ⎦ find (A) ⇒ 1
find (simplify (A)) ⇒ 1 2 3
See also: find, @sym/logical, @sym/isAlways.
Package: symbolic