# [Maxima] Problem with IS and EQUAL in evaluating equality of expressions

Robert Dodier robert.dodier at gmail.com
Sat May 13 12:09:25 CDT 2006

```Hello Henry,

Summary:
(1) a = b is more or less equivalent to testing whether a and b
have the same internal structure
(2) equal (a, b) is more or less equivalent to ratsimp (b - a) = 0
(3) is (...) causes predicates to be evaluated

There's more, but I'll let that be enough for now.

> (%i27) is(equal ((x + 1)^2, x^2 + 2*x + 1));
> (%o27)                               true

Yes, because ratsimp (x^2 + 2*x + 1 - (x + 1)^2); => 0 .

> (%i28) is(equal(sin(a+b),sin(a)*cos(b)+cos(a)*sin(b)));
> Maxima was unable to evaluate the predicate:
> equal(sin(b + a), cos(a) sin(b) + sin(a) cos(b))

Yes, because ratsimp (sin(a)*cos(b)+cos(a)*sin(b) - sin(a+b)); =>
something not 0.
(Note that trigexpand knows the identity needed here --
is(equal(sin(a+b),sin(a)*cos(b)+cos(a)*sin(b))), trigexpand; => true .)

> (%i18) is((cos(t))**2=(1+cos(2*t))/2);
> (%o18)                               false
> (%i19) is(sin(a+b)=sin(a)*cos(b)+cos(a)*sin(b));
> (%o19)                               false

Yes, because the right and left side of = have different structures.

>  -- Function: equal (<expr_1>, <expr_2>)
>      Used with an `is', returns `true' (or `false') if and only if
>      <expr_1> and <expr_2> are equal (or not equal) for all possible
>      values of their variables (as determined by `ratsimp').

Well, that's not so helpful, isn't it. I'll put it on my to-do list ...

best,
Robert Dodier

```