Some related cases:
sx: sqrt(x)$
cat: cos(atan2(0,x)/2)*sqrt(x)$
catab: cos(atan2(0,x)/2)*sqrt(abs(x))$
sign(sx-cat) => zero
sign(sx-catab) => zero
sign(cat-catab) => zero
is(equal(sx,cat)) => unknown <<< inconsistent with sign
is(equal(sx,catab)) => true
is(equal(cat,catab)) => true
Apparently sign/equal only compare the parts which are well-defined in the
reals. This is fairly consistent with Maxima's general approach -- namely
that things are real unless explicitly not real -- but obviously poses some
problems....
It also seems awfully clumsy to have realpart(sqrt(x))
return cos(atan2(0,x)/2)*sqrt(abs(x)) rather than say
step_function(x)*sqrt(abs(x)), but then most of Maxima isn't very clever
about step_function (or for that matter signum). In particular:
catst: step_function(x)*sqrt(abs(x));
sign(sx[,cat,catab] -catst) => pnz
is(equal(sx [,cat,catab] ,catst)) => unknown
Tested in 5.25.1 GCL 2.6.8
-s
On Sat, Apr 7, 2012 at 19:20, Edwin Woollett <woollett at charter.net> wrote:
> 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
>
> ______________________________**_________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/**mailman/listinfo/maxima<http://www.math.utexas.edu/mailman/listinfo/maxima>
>