# [Maxima] Strange thing in Maxima: reduction of fraction

Stavros Macrakis macrakis
Thu Dec 7 11:17:54 CST 2006

```On 12/7/06, Leo <sdl.web at gmail.com> wrote:
> On THU, 7 DEC 2006, Raymond Toy wrote:
> But what about %o1 output? Isn't that a bug?

Maxima's general simplifier does not simplify many cases.  In
particular, it does not perform GCD's of numerators and denominators
-- it just looks for *surface* (syntactic) common factors, e.g.
(a-1)/(a-1) => 1 but (a-1)/(1-a) => (a-1)/(1-a).  To do fuller
algebraic simplification, use ratsimp.

As for why abs(p-q) simplifies to abs(q-p)... Maxima is trying to
normalize the form of the argument to abs to allow certain
simplifications to be easy, e.g. abs(p-q)/abs(q-p) => 1.  This is at
the cost of making other simplifications harder.

Of course, this is not to say that Maxima's simplifier is the best
possible simplifier.  You might think, for example, that if it can
simplify a/abs(a^2) => a, it could also simplify abs(a)/a^2 =>
abs(1/a), but it (currently) can't at all (there is not even a
special-purpose simplifier for this case).  You can do this "by hand"
by writing a simplification rule which rewrites abs(x) as signum(x)*x,
but that's still not perfect... signum(a)/a - 1/(a*signum(a)) will not
simplify to 0, even if you declare a to be nonzero.

-s

```