Strange thing in Maxima: reduction of fraction



On Thu, 2006-12-07 at 11:42 -0500, Raymond Toy wrote:
>     >> (%i2) (q - p) / abs(q - p)^2;
>     >> 
>     >>                                        1
>     >> (%o2)                                -----
>     >>                                      q - p
>     >> 
>     >> Obviously, the output of (%o1) is correct, because I've not
> made any 
>     >> assumptions about p & q in advance. However, why did Maxima
> produce the 
>     >> output of (%o2) when I swapped the order of p & q as in the
> above?
>     >> 
>     >> Thanks a lot!
> 
>     Leo> Looks like a bug.
> 
> Is it?  Maxima doesn't always simplify everything that you type in.
> Isn't %o2 correct, independent of any assumptions on p & q (except
> that I think maxima is implicitly assuming p and q are real)?

Sure, if (q - p) is real, then, abs(q - p)^2 = (q - p)(q - p)
but that makes me wonder about the following:
(%i3) a/a;
(%o3) 1
this seems to me true only if a is not zero. %i3 is not the same as
(%i4) limit(a/a,a,0);
(%o4) 1
which I believe is correct.

Jaime