Re: Mathematica Vs. Matlab
From: Bill Rowe (readnewscix_at_earthlink.net.invalid)
Date: 08/19/04
- Next message: Robert Israel: "Re: subs() function in Maple V R5"
- Previous message: paul: "Re: Mathematica Vs. Matlab. It is not a superset"
- In reply to: Steven Lord: "Re: Mathematica Vs. Matlab"
- Next in thread: Leo Harten: "Re: Mathematica Vs. Matlab"
- Reply: Leo Harten: "Re: Mathematica Vs. Matlab"
- Reply: Richard Fateman: "Re: Mathematica Vs. Matlab"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 19 Aug 2004 05:21:01 GMT
In article <cfvmpd$u$1@fred.mathworks.com>,
"Steven Lord" <slord@mathworks.com> wrote:
> Now rather than having an emotional and subjective discussion about the two
> products (see my previous comment about a religious war) let's take a look
> at a benchmark that I believe is fairly well-known and impartial:
> http://www.scientificweb.com/ncrunch/
> This is Stefan Steinhaus's report comparing Mathematica, MATLAB, and a
> number of other software packages. Now since there have been changes to
> both Mathematica and MATLAB in the two years since the report was last
> compiled, it's probably about time for it to be rerun
Definitely since it appears the last report (vers 4.41) was done for
version 4.2 of Mathematica and the current version is 5.0
> -- but as of the last time it ran MATLAB scored higher than
> Mathematica in every category except platform support, where they
> were tied with 100% each.
While this does appear to be true, it really isn't as significant as it
might seem. For example, consider the loop test benchmark shown in
section 7 of the report. Here Matlab out performs Mathematica with a
score showing Matlab to be ~300 times faster than Mathematica.
Looking at the Mathematica code I see the loop implemented is a Do loop
using an iterator in the form {n,1, nmax,1}
Now consider the following results I just got using Mathematica
n = 1000000;
data = Table[Random[Real], {n}];
a = 0; Timing[Do[a += data[[i]], {i, 1, n, 1}]]
{12.54*Second, Null}
Ia = 0; Timing[Do[a += data[[i]], {i, n}]]
11.967*Second, Null}I
a = 0; Timing[Do[a = a + data[[i]], {i, n}]]
{9.27*Second, Null}I
All three of the above loops are exactly equivalent in terms of what
they do. But by simply specifying the iterator differently or using
different syntax, there is a definite difference in performance but not
enough to show Mathematica does better than Matlab.
But now consider replacing the Do loop with Mathematica's functional
equivalent
Timing[Plus @@ data]
{1.39*Second, 499736.342054831}
An order of magnitude improvement in performance. And using built-in
specialized functions
Timing[Tr[data]]
{0.03*Second, 499736.342054831}I
Timing[Total[data]]
{0.02*Second, 499736.342054831}
Two orders of magnitude improvement over the functional equivalent.
Now, it really isn't fair to compare a specialized function in one
software package for with a general loop in another. So, the fact I can
get such a significant improvement doesn't mean Mathematica is faster
than Matlab.
But it also isn't useful argue Matlab is significantly faster than
Mathematica for Do loops even though true when there are much faster
ways to achieve the same result in Mathematica. In general loops of this
nature are the slowest way to do something in Mathematica.
Note, I am not arguing the comparison done isn't impartial or
construction with an intent to deceive. It is extremely difficult to
develop meaningful benchmarks for significantly different software
packages despite the fact there is overlap in some of the functionality
of the packages.
For a specific application when the benchmark tests that specific
application, then the benchmark *might* serve as a useful criteria to
choose one package over the other. But in general such benchmarks do not
offer a good basis for choosing one package over another.
> Now are there some problems that Mathematica can handle that MATLAB cannot?
> I don't know. I will admit that I haven't used Mathematica that much. It
> may be that you can find a problem that MATLAB can't handle _easily_ (never
> underestimate the coding ingenuity of some of our long-time users :) but
> there are just as many problems that I would bet Mathematica can't handle
> easily that MATLAB breezes through -- signal processing, filter design, and
> control design being some that in my mind are more oriented to numerical
> calculations rather than symbolic.
I've used Mathematica for sometime but have essentially no experience
with Matlab. So while I've no way to check the specific tasks you
mention, I am quite certain there are tasks for which Matlab is more
suitable and there are tasks for which Mathematica is more suitable.
I think Richard Fateman offered some of the best advice in this thread.
It is quite difficult to arrive at a meaningful comparison of
Mathematica and Matlab independent of knowledge of the intended
application. While there is some overlap in functionality, these
packages are not truly equivalent. Probably the most important criteria
for choosing a CAS package is what your instructors, peers etc are
using. For it is these people who you will be seeking help from first.
-- To reply via email subtract one hundred nine
- Next message: Robert Israel: "Re: subs() function in Maple V R5"
- Previous message: paul: "Re: Mathematica Vs. Matlab. It is not a superset"
- In reply to: Steven Lord: "Re: Mathematica Vs. Matlab"
- Next in thread: Leo Harten: "Re: Mathematica Vs. Matlab"
- Reply: Leo Harten: "Re: Mathematica Vs. Matlab"
- Reply: Richard Fateman: "Re: Mathematica Vs. Matlab"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|