Define equation
In previous releases, eq
in some cases
evaluated equations involving only symbolic numbers and returned logical 1
or 0
.
To obtain the same results as in previous releases, wrap equations
in isAlways
. For example, use isAlways(A
== B)
.
A == B
eq(A,B)
creates
a symbolic equation. You can use that equation as an argument for
such functions as A
== B
solve
, assume
, ezplot
,
and subs
.

Number (integer, rational, floatingpoint, complex, or symbolic), symbolic variable or expression, or array of numbers, symbolic variables or expressions. 

Number (integer, rational, floatingpoint, complex, or symbolic), symbolic variable or expression, or array of numbers, symbolic variables or expressions. 
Solve this trigonometric equation. To define the equation, use
the relational operator ==
.
syms x solve(sin(x) == cos(x), x)
ans = pi/4
Plot this trigonometric equation. To define the equation, use
the relational operator ==
.
syms x y ezplot(sin(x^2) == sin(y^2))
Test the equality of two symbolic expressions by using isAlways
.
syms x isAlways(x + 1 == x + 1)
ans = 1
isAlways(sin(x)/cos(x) == tan(x))
ans = 1
Check the equality of two symbolic matrices.
A = sym(hilb(3)); B = sym([1, 1/2, 5; 1/2, 2, 1/4; 1/3, 1/8, 1/5]); isAlways(A == B)
ans = 1 1 0 1 0 1 1 0 1
If you compare a matrix and a scalar, then ==
expands
the scalar into a matrix of the same dimensions as the input matrix.
A = sym(hilb(3)); B = sym(1/2); isAlways(A == B)
ans = 0 1 0 1 0 0 0 0 0