is equal with realpart



On April 7, 2012, I wrote:
----------------------------------
>Here we also show that if a calling program (test) 
>gets the wrong "true" answer from is(equal(...)), 
>and then calls a subprogram (test1), an incorrect
>evaluation of realpart(expr) is found in test1.
>
>This occurs in both 5.26.0gcl and 5.25.1gcl.
-----------------------------------------------
We can avoid this bug by using a homemade
isequal function:

isequal(a23,b23) :=
 (if ratsimp(a23-b23) = 0 then true else false)$

and replacing the definition of isr in test with:

isr : isequal(aex,realpart(aex)),

with correct evaluation in the subprogram test1:
-----------------------------
(%i1) load(test);
(%o1) "c:/work2/test.mac"
(%i2) test(1/sqrt(sin(x)));
  test   
 aex =  1/sqrt(sin(x)) 
 aexr =  cos(atan2(0,sin(x))/2)/sqrt(abs(sin(x))) 
 isr =  nil 
 test1  
 bex =  1/sqrt(sin(x)) 
 bexr =  cos(atan2(0,sin(x))/2)/sqrt(abs(sin(x))) 
(%o2) cos(atan2(0,sin(x))/2)/sqrt(abs(sin(x)))
---------------------------------------
Ted Woollett