Exponentiation used in division? & Some extrordinary slowness is some problems.
Subject: Exponentiation used in division? & Some extrordinary slowness is some problems.
From: Richard Fateman
Date: Tue, 31 Dec 2013 06:39:53 -0800
On 12/31/2013 12:57 AM, Dennis Darland - student wrote:
> Exponentiation is very inefficient compared to division!
> Why is it used here in maxima? (or appear to be)
very inefficient??
a/b is a* b^(-1) by definition. b^(-1) is the same as 1/b. One
division.
Then a* (1/b) is one multiplication.
The advantage of treating a/b as a*b^(-1) is that one only has one case
to worry about,
whether it was written as a/b or a*b^n with n=-1.
> Example:
> ------------------------------------------------------------------------------------
>
> Maxima 5.30.0 http://maxima.sourceforge.net
> using Lisp GNU Common Lisp (GCL) GCL 2.6.8 (a.k.a. GCL)
> 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.
> (%i1) (4.0/0.0);
> expt: undefined: 0 to a negative exponent.
> -- an error. To debug this try: debugmode(true);
> (%i2)
> ------------------------------------------------------------------------------------------------
>
> I do not expect maxima to be comparable to c at number crunching,
> but there are two examples in my tests that it appears would take over
> one day to complete using maxima, but take only 4 and 5 seconds
> respectively in c.
You are probably not using Maxima in its most efficient way.
> Most of my tests take under one minute even in maxima.
> The algorithms are the same for maxima and c.
Maxima is probably doing something much more generally than necessary.
> As I don't know the internals of maxima, I cannot tackle it. Perhaps it
> is worth someones time to look into. I wouldn't be surprised if it were
> related to the problem above, but do not know.
This is unlikely, since it probably would not happen if it were compiled
with proper declarations
and compilation
> My test results and source code are at:
> http://sode.sourceforge.net/
/You will have to be WAY more specific if you want someone to look at
some specific source code.
A simple question: have you used modedeclare and compile in Maxima?
Where in your code exactly?
RJF
/
> ------------------------------------------------------------------------------------------------------
>
>
>
> Dennis Darland
> student at dennisdarland.com
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima