Re: [sage-devel] Sage reviewed in "Linux Format" magazine

6 views
Skip to first unread message
Message has been deleted

William Stein

unread,
Oct 24, 2008, 11:03:17 PM10/24/08
to sage-...@googlegroups.com
Cool!! Do they explain why Sage gets a relatively low rating, e.g.
Scilab gets 9 but Sage 6? Is it because of the relative lack of our
focus on numerics?

On 10/24/08, Minh Nguyen <nguye...@gmail.com> wrote:
>
> Hi folks,
>
> This morning I received issue 109, September 2008, of "Linux Format"
> magazine (dead tree version). Down under in Australia, we do have to
> wait quite some time for overseas magazines to arrive. And when they
> appear on the news stand at my local magazines store, the "latest
> issues" of Linux related magazines tend to be rather out of date ---
> that is, if you don't have subscriptions.
>
> The September 2008 issue of "Linux Format" magazine has a review of Sage
> version 3.0.1 on page 33. This review is part of the issue's "Roundup"
> section, pp.30--35, which also reviews Matlab, Octave, Euler Math
> Toolbox, and Scilab. Unfortunately, I can't (yet) find an online version
> of the Sage review at the official home page of the magazine:
>
> http://www.linuxformat.co.uk
>
> I've reproduced the Sage review below.
>
> <magazine-review>
> Sage
>
> When the maths gets really serious.
>
> Sage is so much more than a numerical computing platform. Yes, it does
> numerics, but it also does symbolic computer algebra that makes it an
> extremely capable system for doing calculus and algebra but also
> research in cryptography, number theory, and graph theory, to name a few.
>
> Sage takes a departure from the other platforms in this review in that
> it uses Python rather than having a programming language of its own. For
> some users this will be a significant attractor, since if you already
> know and love Python you won't have to learn another language. From the
> performance checks using the SVD and FFT, Sage (using Python's Numpy
> Library) was comparable to Scilab and Octave, while the SVD test was
> blazingly fast --- faster than Matlab by a significant margin.
>
> Sage is a relative newcomer to this group but it does make use of
> software that started many years ago. Take Maxima for instance. Maxima
> has as its ancestor the Macsyma computer algebra system initially
> developed at the Massachusetts Institute of Technology in the late
> 1960s. Maxima and other components make Sage an eclectic mix of
> mathematical software.
>
> It's all about sharing
>
> One laudable goal of the Sage project is to enable the convenient
> sharing of mathematical ideas, and one way it does this is through the
> use of web-based notebooks. You can enter commands into the console
> provided by the Sage web application and then evaluate them. It really
> is like writing a math notebook online. Your notebooks can be saved and
> shared, which has many positive implications for teaching and research
> collaborations. You can try Sage without having to build or install it
> by going to www.sagenb.org, signing up for a free account and writing
> your own notebook.
>
> <image>
> [image featuring a Sage notebook session and a 3-D plot]
> [caption: "The graphics in Sage normally display in a Java applet inside
> the page. So much for the bleeding edge..."]
> </image>
> </magazine-review>
>
> The notebook in the image shows the following code, which was used to
> produce the said 3-D plot:
>
> <Sage-code>
> u,v = var('u,v')
> fx = (3 + sin(v) + cos(u)) * cos(2*v)
> fy = (3 + sin(v) + cos(u)) * sin(2*v)
> fz = sin(u) + 2 * cos(v)
> P = parametric_plot3d([fx, fy, fz], (u, 0, 2*pi), (v, 0, 2*pi), \
> frame=False, color="red")
> show(P)
> </Sage-code>
>
> Here are the ratings:
>
> Euler Math Toolbox: 5/10
> Matlab: 9/10
> Octave: 7/10
> Sage: 6/10
> Scilab: 9/10
>
> By the way, I'm not quite sure what "SVD" and "FFT" refer to.
>
> --
> Regards
> Minh Van Nguyen
>
> Web: http://nguyenminh2.googlepages.com
> Blog: http://mvngu.wordpress.com
>
> >
>


--
William Stein
Associate Professor of Mathematics
University of Washington
http://wstein.org

Craig Citro

unread,
Oct 25, 2008, 12:04:08 AM10/25/08
to sage-...@googlegroups.com
> By the way, I'm not quite sure what "SVD" and "FFT" refer to.
>

I'm guessing it's "Singular Value Decomposition" and "Fast Fourier Transform."

-cc

Minh Nguyen

unread,
Oct 25, 2008, 2:05:46 AM10/25/08
to sage-...@googlegroups.com
William Stein wrote:
> Cool!! Do they explain why Sage gets a relatively low rating, e.g.
> Scilab gets 9 but Sage 6? Is it because of the relative lack of our
> focus on numerics?

Not quite, although it must be noted that the primary focus of Will
Tribbey, the reviewer, was numerical computing. As far as I understand,
the tests had nothing to do with symbolic capabilities of the five
targeted systems. One surprise is that only Sage is praised for its
symbolic capability as well as not inventing its own programming
language. Page 35 concludes:

<quote>
Sage and the Euler Math Toolbox were only included as a matter of
diversity and choice, since one person's numerical nirvana is usually
another's sixth circle of hell. We were therefore pleasantly surprised
to find Sage a worthy contender not only for numerical computing but for
doing symbolic computing too. It stood out as the only platform to make
direct use of an existing programming language, Python. Since you can
directly create mathematics documents on the web with Sage, don't be
surprised if maths blogging becomes the next cool thing on the internet.
And remember, you read it here first...
</quote>

The evaluation of the Euler Math Toolbox (EMT), Matlab, Octave, Sage and
Scilab were conducted with the following factors in mind:

(1) ease of installation

(2) user interface

(3) documentation

(4) community support

(5) available toolboxes

Matlab was held to be the "gold standard" (an expression from the
review) against which the other four systems were measured.

A recurring theme throughout tests on the above five systems was the
issue of algorithmic performance, as measured "by computing the singular
value decomposition (SVD) and fast Fourier transform (FFT) of a 500x500
real-valued matrix 100 times and calculating the average and standard
deviation of those 100 trials" (page 30). And on page 31, we have the
following performance evaluation:

<quote>
Performance is one area where Matlab had difficulty maintaining a
commanding lead. For the SVD test --- an important matrix decomposition
in many statistical and numerical algorithms --- Matlab performance was
slightly more than 20% better than Scilab and Octave. The surprise was
that the Numpy algorithm used from within Sage was on average over 250%
faster than Matlab. It's not included in this Roundup, but this
performance difference indicates that the Numpy library for Python
deserves a closer look when performance matters. Matlab comes out the
winner in the fast Fourier transform.
</quote>

In the end, Scilab comes out with a score of 9/10. Matlab has the same
score: "[Matlab's] score was taken down because of its cost" (p.31).
Here's a list of reasons why, as a contender against Matlab, Scilab is
ahead of EMT, Octave and Sage:

(1) the large number of toolboxes

(2) visual system modelling (the Metanet toolbox) and simulation (the
Scicos toolbox)

(3) the number of built-in functions

(4) a Matlab IDE-like command window for developing and debugging functions

David Joyner

unread,
Oct 25, 2008, 6:46:10 AM10/25/08
to sage-...@googlegroups.com
(1) Sage also does FFT via the GSL. I guess they didn't try that,
but I would imaginge they would be fast since they are in C.

(2) I'm not sure what a toolbox actually *is*. Something like an
optional package with a nice gui interface?

(3) Related to this thread, I just got an email from Cesar (from
Mexico, the grad
student working on the RingCode class). He was at a big math
meeting and told people one reason why he prefers Sage over Matlab
is because in Matlab (and I quote from Cesar):

"In MatLab:

var1 = 2^10000000
var2 = 2^10000000 + 1
var1 == var2

The result of the last line will be True!!!!"

Also Cesar says Matlab will often invert without warning a singular
matrix.

So, I think it would be cool if the reviewer also changed that the
programs worked *correctly*. Apologies for the scarcasm:-)


On Sat, Oct 25, 2008 at 2:05 AM, Minh Nguyen <nguye...@gmail.com> wrote:
>

<snip>

> A recurring theme throughout tests on the above five systems was the
> issue of algorithmic performance, as measured "by computing the singular
> value decomposition (SVD) and fast Fourier transform (FFT) of a 500x500
> real-valued matrix 100 times and calculating the average and standard
> deviation of those 100 trials" (page 30). And on page 31, we have the
> following performance evaluation:
>
> <quote>
> Performance is one area where Matlab had difficulty maintaining a
> commanding lead. For the SVD test --- an important matrix decomposition
> in many statistical and numerical algorithms --- Matlab performance was
> slightly more than 20% better than Scilab and Octave. The surprise was
> that the Numpy algorithm used from within Sage was on average over 250%
> faster than Matlab. It's not included in this Roundup, but this
> performance difference indicates that the Numpy library for Python
> deserves a closer look when performance matters. Matlab comes out the
> winner in the fast Fourier transform.
> </quote>
>

<snip>

mabshoff

unread,
Oct 25, 2008, 7:04:59 AM10/25/08
to sage-devel
On Oct 25, 3:46 am, "David Joyner" <wdjoy...@gmail.com> wrote:

Hi,

> (1) Sage also does FFT via the GSL. I guess they didn't try that,
> but I would imaginge they would be fast since they are in C.

The Numpy FFT is fairly quick and AFAIK we only build a subset of the
possible libraries there. The one we ship IIRC only is really fast
when the input consists of 2^n values.

> (2) I'm not sure what a toolbox actually *is*. Something like an
> optional package with a nice gui interface?
>
> (3) Related to this thread, I just got an email from Cesar (from
> Mexico, the grad
> student working on the RingCode class). He was at a big math
> meeting and told people one reason why he prefers Sage over Matlab
> is because in Matlab (and I quote from Cesar):
>
> "In MatLab:
>
> var1 = 2^10000000
> var2 = 2^10000000 + 1
> var1 == var2
>
> The result of the last line will be True!!!!"

Yep, the bane of floating points. That is why Matlab has a symbolic
toolbox which I am sure isn't exactly cheap. It certainly isn't part
of the default config.

> Also Cesar says Matlab will often invert without warning a singular
> matrix.
>
> So, I think it would be cool if the reviewer also changed that the
> programs worked *correctly*. Apologies for the scarcasm:-)

Well, all the reviewer did in case of the SVD benchmark is to measure
the speed of the BLAS linked against Lapack since all projects use
Lapack for SVD. So that part of the review is completely pointless and
shows that the reviewer seemingly doesn't know a whole lot about
numerical software :)

Cheers,

Michael

Jason Grout

unread,
Oct 25, 2008, 11:40:33 AM10/25/08
to sage-...@googlegroups.com
David Joyner wrote:
> (1) Sage also does FFT via the GSL. I guess they didn't try that,
> but I would imaginge they would be fast since they are in C.


The current CDF and RDF vectors implement fft using GSL. I'm in the
process of switching the RDF/CDF vector backend to numpy, and then the
fft will be done by numpy. I'm curious where the FFT is done by numpy
currently; I couldn't find the code. Of course, the reviewer used an
extremely old version of Sage (on our timescale), so maybe things were
different then.

For matrices, switching to numpy made most things faster, so I'm curious
what we'll find when we switch the vectors to numpy as a backend.

Thanks,
Jason

Gabriel Gellner

unread,
Oct 25, 2008, 12:12:18 PM10/25/08
to sage-...@googlegroups.com
Also Sage could use fftw unlike numpy (as it is gpl) which usually beats the
pants of fftpack (which is what numpy uses) See:
http://www.fftw.org/

According to the fftw benchmarks for speed: gsl < fftpack < fftw see:
http://www.fftw.org/speed/CoreDuo-3.0GHz-icc/

Gabriel

Gabriel Gellner

unread,
Oct 25, 2008, 12:34:00 PM10/25/08
to sage-...@googlegroups.com
I realize for people not used to numpy/scipy might not realize that fftw can
be used in scipy (if it is installed, which it isn't by default due to
licensing). What I meant is for sage this should be turned on by default, also
fftw is what matlab uses, so as it has been said for SVD using lapack, this
would also remove all real differences, outside of how the package is
built/wrapped.

Gabriel

William Stein

unread,
Oct 25, 2008, 12:46:26 PM10/25/08
to sage-...@googlegroups.com

When I was trying to do FFT's quickly this summer for a project
in Sage, I recall that when I installed the fftw library (easy), then
built scipy, then the scipy FFT used fftw and was quite fast.
I also noticed, somewhat surprisingly, that even without fftw
the scipy fft was faster than numpy's! This is why the code
in the finance.TimeSeries in Sage for doing (real) fft's is:

w = y.numpy(copy=False)
scipy.fftpack.rfft(w, overwrite_x=1)
return y

-- William

William Stein

unread,
Oct 25, 2008, 1:01:51 PM10/25/08
to sage-...@googlegroups.com
a

+1

Just to add to this, the source code for numpy's svd command
is in numpy-*/src/numpy/linalg/linalg.py and after setting up
some variables it does this:

lapack_routine = lapack_lite.dgesdd
lwork = 1
work = zeros((lwork,), t)
results = lapack_routine(option, m, n, a, m, s, u, m, vt, nvt,
work, -1, iwork, 0)
lwork = int(work[0])
work = zeros((lwork,), t)
results = lapack_routine(option, m, n, a, m, s, u, m, vt, nvt,
work, lwork, iwork, 0)


I.e., it calls dgesdd in lapack. (The lapack_lite I think just
wraps a real lapack in Sage.)

If you lookup DGESDD here you'll see it is the standard
lapack function to compute the singular value decomposition:

http://www.netlib.org/lapack/double/dgesdd.f

So we maybe just have a better way of building atlas/lapack
on that person's test machine. To add to this, on sage.math
(opterton) here is what I get, which is matlab appears to be
slightly faster:

sage: time a = numpy.linalg.svd(numpy.random.rand(500,500),compute_uv=0)
CPU times: user 0.86 s, sys: 0.02 s, total: 0.88 s
Wall time: 0.88 s
sage: time a=matlab('svd(rand(500))')
CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
Wall time: 0.65 s


William

William

Minh Nguyen

unread,
Oct 27, 2008, 5:48:58 AM10/27/08
to Sage devel
Minh Nguyen wrote:
> Hi folks,
[...]

I've cleaned up my previous posts to this thread and rewritten them as a
post on my blog. You can find it at

http://mvngu.wordpress.com/2008/10/27/sage-301-reviewed-in-lxf/

That post contains a link to this thread so that readers can follow the
discussion.

Georg Muntingh

unread,
Oct 28, 2008, 9:16:16 AM10/28/08
to sage-devel
Minh,

Why don't you add your Sage-related blog posts to Planet Sage,
http://planet.sagemath.org/ ?

Georg

Minh Nguyen

unread,
Oct 28, 2008, 10:22:56 PM10/28/08
to sage-...@googlegroups.com
Hi Georg,

OK, I admit it: I'm too lazy to shamelessly promote myself :-)

I've known about

http://planet.sagemath.org

for a long time and have subscribed to it using RSS feed. Looking
around at the above URL, I'm unable to find info on how to do what
you're suggesting. In other words, I'm clueless about how to add Sage
related posts to Planet Sage.

For instance, do I need to have an account so that I can log in and
upload my posts? But I see little to suggest that I need to log in.
How do I syndicate my posts at wordpress.com to planet.sagemath.org?
After hunting around in the settings of my blog at wordpress.com, I'm
still clueless about the syndication issue. Of course there's ping
back and such, but you have to realize that such features are annoying
to me because I've received loads of spam from such "features". Tips
and clues are welcome.

William Stein

unread,
Oct 29, 2008, 12:21:44 AM10/29/08
to sage-...@googlegroups.com, Yi Qiang

The planet.sagemath.org aggregation thing was setup by Yi Qiang,
who was a UW undergrad who subsequently graduated. I don't know
how it works. I suspect somebody with an account on sagemath.org
(e.g., me or mabshoff or harald schilly) would have to add the URL
of your blog to some config script somewhere.

If nobody remembers how this works, of course we can figure it
out with some creative use of grep and find.

William

Martin Albrecht

unread,
Oct 29, 2008, 5:54:19 AM10/29/08
to sage-...@googlegroups.com

It should be relatively straight forward because there is a widely used piece
of software running:

http://www.planetplanet.org/

Cheers,
Martin
--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_www: http://www.informatik.uni-bremen.de/~malb
_jab: martinr...@jabber.ccc.de

mhampton

unread,
Oct 29, 2008, 7:46:24 AM10/29/08
to sage-devel
The relevant file is called config.ini, and the blog entries are
probably towards the end of that file.

-M. Hampton

On Oct 28, 11:21 pm, "William Stein" <wst...@gmail.com> wrote:

mabshoff

unread,
Oct 29, 2008, 7:52:28 AM10/29/08
to sage-devel


On Oct 29, 4:46 am, mhampton <hampto...@gmail.com> wrote:
> The relevant file is called config.ini, and the blog entries are
> probably towards the end of that file.
>
> -M. Hampton

Thanks, I have done some configuration on the planet for Sage, so I
should do this in the short term.

> > The planet.sagemath.org aggregation thing was setup by Yi Qiang,
> > who was a UW undergrad who subsequently graduated.   I don't know
> > how it works.   I suspect somebody with an account on sagemath.org
> > (e.g., me or mabshoff or harald schilly) would have to add the URL
> > of your blog to some config script somewhere.
>
> > If nobody remembers how this works, of course we can figure it
> > out with some creative use of grep and find.
>
> > William

I would recommend that we move the planet from Yi's to the Sage
account.

Cheers,

Michael
Reply all
Reply to author
Forward
0 new messages