I don't know what the whole story here is,
but if the factor program recognizes that a polynomial
is a cyclotomic polynomial, then its factors can be generated
rapidly. So it is using a hack on factor.
It is not a good idea to make pointergp slow since it
is used very very often. The call to pointergp is wrong.
When a polynomial in two (or more) variables x, y, ... is being
manipulated in CRE form it will have inside it several
gensyms (maybe looking like #:g12312 more or less)
each of these gensyms should appear on a gensym list, I think
called genvars, in a certain
order, say (#:g1234 #.g345) corresponding to a varlist order
($x $y) and from that order is determined
which is the main variable , next-main variable, etc.
Before ever touching the guts of a polynomial in CRE form
it is essential that each of those gensyms be set to a value
(setf #:g1234 1)
(setf #:g345 2)
and pointergp is supposed to compare these to see whether
x or y is "more main".
Now you can't actually use setf in that way because the
nature of gensyms is that they are not interned. But if
(valget a) where a is one of those gensyms returns nil,
then someone has forgotten to initialize something.
the name pointerp comes from the original hack when
we wanted a bunch of atoms that could be ordered fast,
we just generated, say, 10 gensyms. Then we sorted
them by the addresses of the symbols in memory. Then
we associated them with x,y,z,....
This meant that pointergp was one or two instructions
on a PDP-10, in assembler.
That version of pointergp turned out to be more trouble
than it was worth because we sometimes had to interpolate
between two gensym "addresses" and to do that we
had to kind of renumber too much of the universe.
Or maybe we just weren't clever enough to do it without
introducing bugs.
Probably this is more than you wanted to know, and less
than you need to know to fix the bug :(
RJF
----- Original Message -----
From: "Raymond Toy" <raymond.toy at ericsson.com>
To: <maxima at math.utexas.edu>
Sent: Thursday, March 16, 2006 2:05 PM
Subject: What is primcyclo and cyclotomic?
>
> Bug 1449163 ratsimp(exp(%pi*%i/9)/(x-2)^(1/7)) causes an error, and
> from the backtrace, I see that it's computing (primcyclo 18) (in
> src/factor.lisp), which calls cyclotomic calls pquotient which calls
> pointergp with both args equal to NIL, and then tries to compare 2 NIL
> values.
>
> I hacked pointergp to be
>
> (defun pointergp (a b)
> (let ((va (valget a))
> (vb (valget b)))
> (and (numberp va) (numberp vb)
> (f> va vb))))
>
> instead of
>
> (defun pointergp (a b) (f> (valget a) (valget b)))
>
> This fixes the problem in the bug, but I would like to know what
> pricyclo and cyclotomic are trying to do. And what is the meaning of
> the lists that are passed to pquotient.
>
> Does anyone know what these functions do?
>
> Ray
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>