fasttimes bug



Thanks

fasttimes helps my application (the gf package in Maxima for
finite fields) a lot.
I use it extensively and it makes the computation much faster.



   Fabrizio


On Thu, 14 Feb 2008, R Fateman wrote:

> Try  fasttimes(rat(1,x), rat(x)).
>
> Fasttimes may not be especially fast, depending on your inputs.  You should 
> test it to see if it helps your application.
> It was not intended to be generally useful, but simply an interface to a 
> program that might be worth testing,
> a "Karatsuba" style multiplier.  If you need to multiply many  large and 
> dense polynomials fast,
> there are lots of other methods around (not all in Maxima).
>
> Fabrizio Caruso wrote:
>>  Hi
>>
>>  fasttimes has a very old bug which makes it less usable
>>  because it won't work if its first argument is $rat(1)$
>>  because
>>  (1) rat(1) is given an empty list of variables
>>  unless it has been the result of some computation
>>  involving some variables;
>>  (2) fasttimes assumes that list of variables of the product
>>  should be the same as the one of its first argument
>>  instead of taking the union of the variables of both arguments
>> 
>>
>>  In fact we have:
>>
>>  (%i324) fasttimes(rat(1),rat(x));
>>  Use `fasttimes' only on CRE polynomials with same varlists
>>    -- an error.  To debug this try debugmode(true);
>>  (%i325) fasttimes(rat(x),rat(1));
>>  Evaluation took 0.00 seconds (0.00 elapsed) using 776 bytes.
>>  (%o325)/R/                             x
>>  (%i326)
>> 
>>
>>  Despite the fact that rat(1) should be the same as remainder(1,rat(x))
>>  they are different when used inside fasttimes because it seems
>>  that remainder give to "1" the right list of variables
>> 
>>
>>  (%i328) rat(1);
>>  Evaluation took 0.00 seconds (0.00 elapsed) using 232 bytes.
>>  (%o328)/R/                             1
>>  (%i329) remainder(rat(1),rat(x));
>>  Evaluation took 0.00 seconds (0.00 elapsed) using 1.070 KB.
>>  (%o329)/R/                             1
>>  (%i330) is(%=%o328);
>>  Evaluation took 0.00 seconds (0.00 elapsed) using 600 bytes.
>>  (%o330)                              true
>>  (%i331) fasttimes(remainder(rat(1),rat(x)),rat(x));
>>  Evaluation took 0.00 seconds (0.00 elapsed) using 1.523 KB.
>>  (%o331)/R/                             x
>> 
>> 
>>
>>  Its code is in ratout.lisp but I am not enough Lisp savy to debug it
>>
>>  (defmfun $fasttimes (x y)
>>     (cond ((and (not (atom x)) (not (atom y))
>>                 (equal (car x) (car y)) (equal (caar x) 'mrat)
>>                 (equal (cddr x) 1) (equal (cddr y) 1))
>>           (cons (car x)(cons (fptimes (cadr x)(cadr y))1)))
>>           (t (merror "Use `fasttimes' only on CRE polynomials with same
>>  varlists"))))
>> 
>> 
>>
>>  Any suggestions on how to fix it other than circumvent it?
>>  Possibly a fix in the Lisp code?
>>
>>      Fabrizio
>> 
>>
>>  _______________________________________________
>>  Maxima mailing list
>>  Maxima at math.utexas.edu
>>  http://www.math.utexas.edu/mailman/listinfo/maxima
>> 
>