[Maxima] ezgcd bug / fix

Barton Willis willisb at unk.edu
Sun Nov 29 17:18:53 CST 2009


I'll test ezgcd more before I commit the change. I was thinking about a fix
to the
broken lcm (try lcm(0,1,0)) function:

(%i2) xlcm([l]) := llcm(l)$

(%i3) llcm(l) := block([ratfac : true], (if listp(l) or setp(l) then
   rreduce(lambda([a,b], xreduce("*", ezgcd(a, b))),l, rat(1)) else
   error("The argument to 'llcm' must be a list")))$

(%i4) showtime : true$

(%i17) l : makelist((x - random(10)) * (x-random(10)),i,1,100)$

(%i18) a : apply('xlcm,l)$
Evaluation took 0.0300 seconds (0.0300 elapsed)

(%i19) b : apply('lcm,l)$
Evaluation took 2.4700 seconds (2.4700 elapsed)

(%i20) rat(a-b);
Evaluation took 0.0000 seconds (0.0000 elapsed)
(%o20) 0

Barton

-----maxima-bounces at math.utexas.edu wrote: -----

>To: Barton Willis <willisb at unk.edu>
>From: Richard Fateman <fateman at cs.berkeley.edu>
>Sent by: maxima-bounces at math.utexas.edu
>Date: 11/29/2009 03:26PM
>cc: maxima at math.utexas.edu
>Subject: Re: [Maxima] ezgcd bug / fix
>
>The fix looks good to me.  The function $ezgcd, a function intended to
>be called  from the top level, is surely used almost never.
>Maybe gcd with some gcd flag set to ezgcd would happen, but not this.
>RJF
>
>_______________________________________________
>Maxima mailing list
>Maxima at math.utexas.edu
>http://www.math.utexas.edu/mailman/listinfo/maxima




More information about the Maxima mailing list