length of genvar & speed



The quotient is not exact error message
comes from a bad GCD calculation:  basically
the expression a/b is formed, but g=gcd(a,b) is
computed to reduce to
(a/g)  / (b/g)

but one of those quotients "is not exact".
This could happen sometimes if something odd is
done with the genvars / varlist  stuff between the
gcd computation and the division, but it is an
annoying bug.  Perhaps because there is a simple
but naive cure for all of them, which is to insist,
contrary to the user's specification, that all variables
be ordered in a particular way by the system.
Other CAS do not have this problem because they do
not have the facility to re-order, or they do not have
rational canonical forms, or they do not allow different
expressions to have different orders at the same time.

On some systems (e.g. Allegro CL) there is extensive
support for profiling, in which case we could find
out where the time is spent. For example, if the
time is spent sorting (uselessly) some list, there
might be some work-around, once the bottleneck is
identified.

RJF


Barton Willis wrote:

>Each time the DE solver attempts a solution, it
>must generate a polynomial with unknown coefficients.
>I used gensyms for the coefficients; most members of
>the genvar list are these gensyms. So yes, to solve
>fifty DEs, my code generates 100s of symbols.  But
>each CRE expression only has about ten variables.
>
>In my testing code, I inserted a kill(all) after
>each run.  That fixed the slowdown problem.  So
>yes, I think the lengthy genvar list caused the
>slowdown.  (My testing code runs in its own
>read-eval-print loop.)  It seems  that kill(all)
>sets genvar to nil.  But doing kill(all) after
>each run has its own problems---I now get a
>few “quotient is not exact” errors that I didn’t
>have before.  Ick. (It’s possible that something
>else changed...)
>
>I’ll try your method of cleaning up CRE expressions;
>if that does not work, I’ll try recycling gensyms
>between runs.
>
>Barton
>
>
>
>-----Richard Fateman <fateman@cs.berkeley.edu> wrote: -----
>
>To: Barton Willis <willisb@unk.edu>
>From: Richard Fateman <fateman at cs>
>Date: 07/24/2004 12:43AM
>cc: maxima <maxima@www.ma.utexas.edu>
>Subject: Re: [Maxima] length of genvar & speed
>
>It is not clear why you would get such growth unless you
>have hundreds of distinct symbols. Is that the case?  If you
>look at your CRE form in lisp, does it have a huge list of
>variables as well as a huge list of gensyms?
>