### The Maxima on-line user's manual

Algebra Calculator

#### Equal

Function: equal (<a>, <b>) Represents equivalence, that is, equal value.

By itself, equal does not evaluate or simplify. The function is attempts to evaluate equal to a Boolean value. is(equal(<a>, <b>)) returns true (or false) if and only if <a> and <b> are equal (or not equal) for all possible values of their variables, as determined by evaluating ratsimp(<a> - <b>); if ratsimp returns 0, the two expressions are considered equivalent. Two expressions may be equivalent even if they are not syntactically equal (i.e., identical).

When is fails to reduce equal to true or false, the result is governed by the global flag prederror. When prederror is true, is complains with an error message. Otherwise, is returns unknown.

In addition to is, some other operators evaluate equal and notequal to true or false, namely if, and, or, and not.

The negation of equal is notequal.

Examples:

By itself, equal does not evaluate or simplify.

(%i1) equal (x^2 - 1, (x + 1) * (x - 1));
2
(%o1)            equal(x  - 1, (x - 1) (x + 1))
(%i2) equal (x, x + 1);
(%o2)                    equal(x, x + 1)
(%i3) equal (x, y);
(%o3)                      equal(x, y)

The function is attempts to evaluate equal to a Boolean value. is(equal(<a>, <b>)) returns true when ratsimp(<a> - <b>) returns 0. Two expressions may be equivalent even if they are not syntactically equal (i.e., identical).

(%i1) ratsimp (x^2 - 1 - (x + 1) * (x - 1));
(%o1)                           0
(%i2) is (equal (x^2 - 1, (x + 1) * (x - 1)));
(%o2)                         true
(%i3) is (x^2 - 1 = (x + 1) * (x - 1));
(%o3)                         false
(%i4) ratsimp (x - (x + 1));
(%o4)                          - 1
(%i5) is (equal (x, x + 1));
(%o5)                         false
(%i6) is (x = x + 1);
(%o6)                         false
(%i7) ratsimp (x - y);
(%o7)                         x - y
(%i8) is (equal (x, y));
(%o8)                        unknown
(%i9) is (x = y);
(%o9)                         false

When is fails to reduce equal to true or false, the result is governed by the global flag prederror.

(%i1) [aa : x^2 + 2*x + 1, bb : x^2 - 2*x - 1];
2             2
(%o1)             [x  + 2 x + 1, x  - 2 x - 1]
(%i2) ratsimp (aa - bb);
(%o2)                        4 x + 2
(%i3) prederror : true;
(%o3)                         true
(%i4) is (equal (aa, bb));
Maxima was unable to evaluate the predicate:
2             2
equal(x  + 2 x + 1, x  - 2 x - 1)
-- an error.  Quitting.  To debug this try debugmode(true);
(%i5) prederror : false;
(%o5)                         false
(%i6) is (equal (aa, bb));
(%o6)                        unknown

Some operators evaluate equal and notequal to true or false.

(%i1) if equal (y, y - 1) then FOO else BAR;
(%o1)                          BAR
(%i2) eq_1 : equal (x, x + 1);
(%o2)                    equal(x, x + 1)
(%i3) eq_2 : equal (y^2 + 2*y + 1, (y + 1)^2);
2                   2
(%o3)             equal(y  + 2 y + 1, (y + 1) )
(%i4) [eq_1 and eq_2, eq_1 or eq_2, not eq_1];
(%o4)                  [false, true, true]

Because not <expr> causes evaluation of <expr>, not equal(<a>, <b>) is equivalent to is(notequal(<a>, <b>)).

(%i1) [notequal (2*z, 2*z - 1), not equal (2*z, 2*z - 1)];
(%o1)            [notequal(2 z, 2 z - 1), true]
(%i2) is (notequal (2*z, 2*z - 1));
(%o2)                         true

There are also some inexact matches for equal. Try ?? equal to see them.

(%o1)                                true
(%i2)

### Related Examples

##### equal-makelist-sin-subst

RESPONSE : [1/2*x-3/4...

LONCAPALIST : [cos];

eingabe : RESPONSE[1];

Calculate

p1:x+y+z-3;

p2:x^2+y^2+z^2-5;

Calculate

##### equal-lambda-mat_norm-matrix-matrixmap-sum

ans1:matrix([1,2,3],[...

sum:(mat_norm(matrixm...

Calculate

##### equal-makelist-primep-unknown

makelist(makelist((f(...

Calculate

##### equal-ev-grind-is-or-sqrt-subst

h:((equal(x , (5**(1/...

g:(((subst([x=-(11/2)...

grind(g);

Calculate

##### equal

eq1 = R*RC/(R+RC) + RL;

eq2 = (R*RL + R*RC + ...

equal(eq1, eq2);

Calculate

##### equal-is

is(equal(15,(7+8)));

Calculate

a: 1;

b: 2;

c: 3;

Calculate

##### equal-equiv_classes

equiv_classes ({{1,2}...

Calculate