least common multiple by hand is much faster than maxima implementation
Subject: least common multiple by hand is much faster than maxima implementation
From: andre maute
Date: Tue, 20 Sep 2011 00:22:31 +0200
On 09/19/2011 10:55 PM, Stavros Macrakis wrote:
> Try ratfac:true, which preserves factors in rational expressions. Result is
> instantaneous.
I have already implemented my by hand algorithm,
nevertheless thank you for the quick reply.
Regards
Andre
> It also has the advantage that it is correct.
>
> There is a bug in GCD when ratfac:false in this case (I tried all the
> algorithms). I will follow up with a message to the whole list about this
> case.
>
>
> (%i94) factor(gcd((a2+a1+1)^2*(d+b2-1)*(l2+1)^2*(l2-a2-a1)^2*(l2-b2-1)*(l2-d+(-2)*a2-a1-1)*(l2-d+(-2)*a2-a1),(a2+a1+1)^2*(d+b2-1)*(l2+1)^2*(l2-d+(-2)*a2-a1))),ratfac:false;
> (%o94) (a2+a1+1)^2*(l2+1)^2*(l2-d-2*a2-a1)<<<< wrong
>
> (%i95) factor(gcd((a2+a1+1)^2*(d+b2-1)*(l2+1)^2*(l2-a2-a1)^2*(l2-b2-1)*(l2-d+(-2)*a2-a1-1)*(l2-d+(-2)*a2-a1),(a2+a1+1)^2*(d+b2-1)*(l2+1)^2*(l2-d+(-2)*a2-a1))),ratfac:true;
> (%o95) (a2+a1+1)^2*(d+b2-1)*(l2+1)^2*(l2-d-2*a2-a1)<<<< correct
>
> -s
>
> On Mon, Sep 19, 2011 at 14:53, andre maute<andre.maute at gmx.de> wrote:
>
>> Hi list,
>>
>> I have the following attached least common multiple test,
>> which I canceled after half an hour of computation.
>> Doing it by hand can be done easily in 2 minutes,
>> because the terms are factored.
>>
>> Does somebody have a faster implementation?
>>
>> Andre
>>
>> ------------------------------**-------
>> [user at home ~]$ maxima -v
>> + '[' sbcl = clisp ']'
>> + '[' sbcl = cmucl ']'
>> + '[' sbcl = scl ']'
>> + '[' sbcl = gcl ']'
>> + '[' sbcl = acl ']'
>> + '[' sbcl = openmcl ']'
>> + '[' sbcl = ecl ']'
>> + '[' sbcl = sbcl ']'
>> + exec sbcl --core /home/user/opt/maxima/lib/**maxima/5.19.2/binary-sbcl/*
>> *maxima.core --noinform --end-runtime-options --eval '(cl-user::run)'
>> --end-toplevel-options -v '' '' '' '' '' '' '' ''
>> Maxima 5.19.2 http://maxima.sourceforge.net
>> Using Lisp SBCL 1.0.40-1.fc14
>> Distributed under the GNU Public License. See the file COPYING.
>> Dedicated to the memory of William Schelter.
>> The function bug_report() provides bug reporting information.
>>
>>
>>
>>
>>
>> _______________________________________________
>> Maxima mailing list
>> Maxima at math.utexas.edu
>> http://www.math.utexas.edu/mailman/listinfo/maxima
>>
>>