which set x
equal to y
. Here we discuss equations
, which test
equality. The equation tests
is equal to y
are equal. The result is the symbol True
It is very important that you do not confuse
is an imperative
statement that actually causes an assignment to be done,
are equal, and causes no explicit action. If you have used the C programming language, you will recognize that the notation for assignment and testing in Mathematica
is the same as in C.
|x=y||assigns x to have value y|
|x==y||tests whether x and y are equal|
Assignments and tests.
to have value
If you ask for
, you now get
is equal to
. In this case, it is.
This removes the value assigned to
The tests we have used so far involve only numbers, and always give a definite answer, either True
. You can also do tests on symbolic expressions.
cannot get a definite result for this test unless you give
a specific numerical value.
If you replace
by the specific numerical value
, the test gives False
Even when you do tests on symbolic expressions, there are some cases where you can get definite results. An important one is when you test the equality of two expressions that are identical
. Whatever the numerical values of the variables in these expressions may be, Mathematica
knows that the expressions must always be equal.
The two expressions are identical
, so the result is True
, whatever the value of
does not try to tell whether these expressions are equal. In this case, using Expand
would make them have the same form.
. There are many functions in Mathematica
for manipulating and solving equations.
You can assign a name to the equation.
If you ask for
, you now get the equation.