Problem with is and equal testing equality of expressions
Subject: Problem with is and equal testing equality of expressions
From: Henry Lenzi
Date: Sat, 13 May 2006 13:11:43 -0300
Dear All --
I tried using this "is" operator today, and I failed miserably:
(%i27) is(equal ((x + 1)^2, x^2 + 2*x + 1));
(%o27) true
But...
(%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))
-- an error. Quitting. To debug this try debugmode(true);
(%i29)
I don't grok the debugger, so I've got no usefull output.
(%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
Is it me or is Maxima?
Here's what the nice documentation little man inside my computer said:
(%i9) describe(equal)
;
0: (maxima.info)Inequality.
1: equal :Definitions for Operators.
2: equalp :Definitions for Fourier Series.
3: notequal :Definitions for Operators.
4: setequalp :Definitions for Sets.
Enter space-separated numbers, `all' or `none': 1
-- 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'). Thus `is
(equal ((x + 1)^2, x^2 + 2*x + 1))' returns `true' whereas if `x'
is unbound `is ((x + 1)^2 = x^2 + 2*x + 1)' returns `false'. Note
also that `is(rat(0)=0)' yields `false' but `is (equal (rat(0),
0))' yields `true'.
If a determination can't be made, then `is (equal (a, b))' returns
a simplified but equivalent expression, whereas `is (a=b)' always
returns either `true' or `false'.
All variables occurring in <expr_1> and <expr_2> are presumed to
be real valued.
The negation of `equal' is `notequal'. Note that because of the
rules for evaluation of predicate expressions (in particular
because `not <expr>' causes evaluation of <expr>), `notequal' is
not equivalent to `not equal' in some cases.
`ev (<expr>, pred)' is equivalent to `is (<expr>)'.
(%i1) is (x^2 >= 2*x - 1);
(%o1) true
(%i2) assume (a > 1);
(%o2) [a > 1]
(%i3) is (log (log (a+1) + 1) > 0 and a^2 + 1 > 2*a);
(%o3) true
Completely bewildered, gratefull in advance for any help,
regs,
Henry Lenzi