infinite loop on gcd()



Some command could be written this way. It was certainly considered.

 My guess is that what
would make more sense is to have some general rules like...

If there are more than k polynomial variables, use spmod.
If the largest numerical coefficients  are relatively small, use spmod.
If the polynomials are small, dense, small coeffs, few variables,
use subres.
There may also be tradeoff regarding the leading coeffs.
(Large is generally bad for modular or spmod, but then it is not
so good for subres, either).

There are other conditions to choose between algorithms but
you don't know them until after the gcd.   E.g. if the gcd is 1,
then subres is relatively slow.  if the gcd is large, subres gets
it faster.

Maple uses a "heuristic gcd" and then falls back to something else
maybe like spmod.  In my tests, subres was generally (much) faster
than heuristic gcd, at least implemented in lisp.

RJF


C Y wrote:

>I don't suppose some command could be written which :
>
>a) tries subres for (say) 5 sec and if no answer has been returned
>b) aborts subres and tries spmod for (say) 5 sec.
>c) if neither solves it quickly, print a warning and then start one of
>them (subres?) cranking with no time limit.
>
>Would that be useful (or possible, for that matter?)  This way, if
>there is a method which provides a quick answer (for some definition of
>quick) the user always gets it immediately.
>
>CY
>
>--- "Viktor T. Toth"  wrote:
>  
>
>>Well, the algorithm may be mathematically correct but the fact is,
>>subres
>>often fails to produce a result even when you wait for hours, whereas
>>spmod
>>pops up the result in seconds or, perhaps, fails with a memory error
>>within
>>some reasonable amount of time.
>>
>>Having said that, I'm happy to accept the consensus, if there's one,
>>that
>>subres represents the "lesser of two evils", so long as spmod remains
>>there
>>for cases that subres cannot deal with!
>>
>>
>>Viktor
>>
>>
>>
>> 
>>
>>-----Original Message-----
>>From: Richard Fateman [mailto:fateman at cs] 
>>Sent: Tuesday, May 10, 2005 5:57 PM
>>To: Viktor T. Toth; maxima
>>Subject: Re: [Maxima] infinite loop on gcd()
>>
>>1. I don't believe there is a software algorithm bug.
>>2. Commercial macsyma gave up (illegal mem ref.) probably because
>>it ran out of stack or memory. (A "system" bug?)
>>3. Subres works better  / faster much of the time.
>>4. spmod has its own regimes of bad performance, and I think
>>that there are a number of reports of bugs in it, typically
>>manifested by "polynomial quotient not exact" messages.
>>
>>(What this means is someone computed p=gcd(r,s)  and then
>>expected to produce a polynomial by exactly dividing r by p.
>>But it didn't divide.)
>>
>>
>>RJF
>>
>>
>>Viktor T. Toth wrote:
>>
>>    
>>
>>>I pretty much got used to switching gcd to spmod for large
>>>      
>>>
>>calculations.
>>    
>>
>>>I've been meaning to ask, why does gcd default to subres (with all
>>>      
>>>
>>the
>>bugs)
>>    
>>
>>>instead of the apparently far more reliable spmod algorithm?
>>>
>>>
>>>Viktor
>>>
>>> 
>>>
>>>      
>>>
>>_______________________________________________
>>Maxima mailing list
>>Maxima@www.math.utexas.edu
>>http://www.math.utexas.edu/mailman/listinfo/maxima
>>
>>    
>>