Maxima's rat package and "quotient is not exact"



On 5/11/06, Andrej Vodopivec <andrej.vodopivec at gmail.com> wrote:
> Hi,
>
> it looks like rational package uses f<, f+, ... macros on coefficients
> of polynomials in a lot of places.

Well, maybe I want to take this back - it looks like they are used on
the exponents.

Anyway, there are bugs in the way %i is handled:

(%i4) :lisp (trace testdivide)
(TESTDIVIDE)
(%i4) ratsimp((%i*a-1)/(a^2+1)^2), ratfac=true;

[ some text deleted ]

  1> (TESTDIVIDE (#:A33664 1 1 0 (#:%I33664 1 1)) (#:%I33664 1 1))
  <1 (TESTDIVIDE (#:A33664 1 (#:%I33664 1 -1) 0 1))
  1> (TESTDIVIDE (#:A33664 1 (#:%I33664 1 -1) 0 1) (#:%I33664 1 1))
  <1 (TESTDIVIDE (#:A33664 1 -1 0 (#:%I33664 1 -1)))
  1> (TESTDIVIDE (#:A33664 1 -1 0 (#:%I33664 1 -1)) (#:%I33664 1 1))
  <1 (TESTDIVIDE (#:A33664 1 (#:%I33664 1 1) 0 -1))
  1> (TESTDIVIDE (#:A33664 1 (#:%I33664 1 1) 0 -1) (#:%I33664 1 1))
  <1 (TESTDIVIDE (#:A33664 1 1 0 (#:%I33664 1 1)))
  1> (TESTDIVIDE (#:A33664 1 1 0 (#:%I33664 1 1)) (#:%I33664 1 1))
  <1 (TESTDIVIDE (#:A33664 1 (#:%I33664 1 -1) 0 1))
  1> (TESTDIVIDE (#:A33664 1 (#:%I33664 1 -1) 0 1) (#:%I33664 1 1))
  <1 (TESTDIVIDE (#:A33664 1 -1 0 (#:%I33664 1 -1)))
  1> (TESTDIVIDE (#:A33664 1 -1 0 (#:%I33664 1 -1)) (#:%I33664 1 1))
  <1 (TESTDIVIDE (#:A33664 1 (#:%I33664 1 1) 0 -1))
  1> (TESTDIVIDE (#:A33664 1 (#:%I33664 1 1) 0 -1) (#:%I33664 1 1))
Maxima encountered a Lisp error:

 Console interrupt.

Automatically continuing.
To reenable the Lisp debugger set *debugger-hook* to nil.

Maxima knows that dividing with %i is multiplying with -%i and goes
into infinite loop (I think it is in lgcd1). Maybe the %i in your
expression is causing errors.

Andrej