Timing comparison for diffeq program in c++, Maple and Maxima
Subject: Timing comparison for diffeq program in c++, Maple and Maxima
From: Dennis Darland
Date: Thu, 9 Aug 2012 08:07:31 -0700 (PDT)
How, given the diffeq below, do you generate a Taylor series in
Maxima?
diff ( y , x , 1 ) = tan(sqrt(2.0*x + 3.0));or better, the system:
diff (x2,t,2) = 3.0 * diff(x2,t,1) - 2.0 * x2 - diff(x1,t,2) - diff (x1,t,1) + x1;
diff (x1,t,1) = 4.0 * x2 - 2.0 * diff (x2,t ,1) - 2.0 * x1;
Dennis J. Darland
dennis.darland at yahoo.com
http://dennisdarland.com/http://dennisdarland.com/dennisdaze/http://dennisdarland.com/philosophy/http://sode.sourceforge.net/
"According to the World Health Organization, the warming of the planet caused an additional 140,000 deaths in 2004, as compared with the number of deaths there would have been had average global temperatures remained as they were during the period 1961 to 1990. This means that climate change is already causing, every week, as many deaths as occurred in the terrorist attacks on September 11, 2001"
-- Peter Singer _Practical Ethics, Third Edition_, p. 216.
--- On Thu, 8/9/12, Richard Fateman <fateman at eecs.berkeley.edu> wrote:
From: Richard Fateman <fateman at eecs.berkeley.edu>
Subject: Re: [Maxima] Timing comparison for diffeq program in c++, Maple and Maxima
To: maxima at math.utexas.edu
Cc: "Rupert Swarbrick" <rswarbrick at gmail.com>
Date: Thursday, August 9, 2012, 9:09 AM
On 8/9/2012 5:32 AM, Rupert Swarbrick
wrote:
Dennis Darland <dennis.darland at yahoo.com> writes:
I ran a timing test comparison for c++, Maple and Maxima.
All three programs generated by omnisode - a set of Ruby programs.
Set time limit to 1 minute.
Maximum iteration was sufficient to solve entire problem.
Problem was sin.ode for all three.
Output was redirected to file only - none to screen
Results:
c++ solved entire problem in 23 seconds (140001 iterations)
Maple performed 11542 iterations in 60 seconds
Maxima performed 372 iterations in 60 seconds
That amounts to:
c++ 6,087 iterations/second
Maple 192 iterations/second
Maxima 6.2 iterations/second
c++ is almost 32 times faster than Maple which is almost 31 times faster than Maxima.
So c++ is almost 982 times faster than Maxima.
More info on omnisode at:
http://sode.sourceforge.net/
Right, I just tried to look up the Maxima code you're generating and
found things like [1]. Since I'm clearly not going to read through that
carefully, and I presume no-one else is either, can you explain exactly
what you're measuring?
Your code looks to me like a C/FORTRAN program translated to
Maxima. Unsurprisingly, it runs very slowly. What are you actually
trying to do? What capabilities of Maple or Maxima are you using other
than basic arithmetic?
Or should we interpret your message as
"Writing bare-metal calculations in Maple and running them is
marginally less slow that writing them in Maxima and running
them. But it would have been easier to do it in C anyway"
?
I spent 1 minute looking at the code in [1] ... It seems to me that
if you are computing Taylor
series you should use the Taylor series command and not write
something in what looks
like C.? Etc.? So you are using these enormously powerful programs
to simulate very
low level operations, as Rubert says.? So you should use C.? And if
you want it to run
faster, consider generating assembler.
(You can make Maxima run faster by adding declarations and
compiling, but that will
probably make it no more than about 100X faster.)
Rupert
[1] http://sode.sourceforge.net/omniresults/special_cases_007/diffeq.tan_sqrt_lin.mxt.txt
_______________________________________________
Maxima mailing list
Maxima at math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima
-----Inline Attachment Follows-----
_______________________________________________
Maxima mailing list
Maxima at math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima