Sponsored links: Algebra eBooks
 

Help Index

A

B

C

D

E

F

G

H

I

J

K

L

M

N

O

P

Q

R

S

T

U

V

W

X

Y

Z

The Maxima on-line user's manual

Algebra Calculator

Search:

Equal Calculator

Equal

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

isCorrect : is(10*b=42*b);
 isCorrect;
 map(

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) 

Equal Example

Related Examples

equal-infix-lhs-notequal-rhs

e: aa + bb = cc;

lhs (e);

rhs (e);

Calculate

equal-is

is(equal(x , (5**(1/(...

Calculate

equal-map-ratsimp

isCorrect : is(ratsim...

isCorrect;

map('ratsimp, [10*b,...

Calculate

equal-ratsimp

isCorrect : is(equal(...

isCorrect;

ratsimp(10*b-2*5*b);

Calculate

equal-is-log

a : 2016+30*8-30*(log...

b : -log(s/256)/log...

is(equal(a, b));

Calculate

equal-is-sin

func(x):= sin(x);

is(equal(0, func(x1)));

Calculate

equal-is

eq1:x+5;

eq2:(2*x+10)/2;

is(equal(eq1,eq2));

Calculate

equal-is

a:2;

b:2;

c:3;

Calculate