equal problem



A remark to the equal test implemented in Maxima.

The test is(equal(a,b)) uses the implemented $sign function and checks if the
difference a-b is zero. There are no special simplifications for expressions
implemented. One point is that the $sign function does a numerically evaluation
of the expression.

Therefore the algorithm compares for the given example two floating point
numbers. The result is false, because the accurarcy of the numerical evaluation
differ:

(%i11) t:%e^(log(2)/2)-1;
(%o11) %e^(log(2)/2)-1
(%i12) s:sqrt(2)-1;
(%o12) sqrt(2)-1
(%i13) float(s-t);
(%o13) 2.2204460492503131E-16
(%i14) is(equal(float(s),float(t)));
(%o14) false

Dieter Kaiser

-----Urspr?ngliche Nachricht-----
Von: maxima-bounces at math.utexas.edu [mailto:maxima-bounces at math.utexas.edu] Im
Auftrag von Leo Butler
Gesendet: Mittwoch, 25. Februar 2009 13:39
An: 'Maxima List'
Betreff: [Maxima] equal problem

Hello,
I wonder if someone can explain the following:

(%i2) t : %e^(log(2)/2)-1; s : sqrt(2)-1;

(%o2) %e^(log(2)/2)-1
(%o3) sqrt(2)-1
(%i4) is(equal(t,s));

(%o4) false
(%i5) build_info();

Maxima version: 5.17.1
Maxima build date: 20:42 2/2/2009
host type: i686-pc-linux-gnu
lisp-implementation-type: GNU Common Lisp (GCL)
lisp-implementation-version: GCL 2.6.8

Why does maxima decide these two expressions are not equal?

Leo

-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

_______________________________________________
Maxima mailing list
Maxima at math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima