Ruby, Python, and Science

by John on November 28, 2010

David Jacobs has written a long blog post Ruby is beautiful (but I’m moving to Python). Here’s my summary.

Ruby is much better than Java, but the Ruby community is too focused on web development and the language has no scientific library. Python has a lot of the same advantages as Ruby, is used for more than web programming, and has SciPy.

Update: There is now a fledgling SciRuby project.

Further reading:

Plain Python
Getting started with SciPy
Replacing Mathematica with Python
SciPy and NumPy for .NET

{ 3 trackbacks }

Tweets that mention Ruby, Python, and Science — The Endeavour -- Topsy.com
11.28.10 at 20:04
PySpread Magic « DECISION STATS
01.07.11 at 05:24
Python and science | misc.ience
08.31.11 at 22:52

{ 6 comments… read them below or add one }

1

John Johnson 11.28.10 at 17:16

And has pretty easy integration with R, so I’m told. If I’m going to learn a new language, Python would be it.

2

Janne 11.28.10 at 19:05

That’s my own situation, pretty much. I much prefer Ruby over Python; there are a number of reasons both large and small but the end result is, using Ruby makes me smile while using Python makes me frown.

However, I end up using Python. And SciPy is a very large part of why that is so. If there were a well-maintained port of equivalent to SciPy/NumPy (and to a lesser degree Pylab – it’s really not all that good) I would spend most of my time with Ruby instead.

3

John 11.28.10 at 20:01

Janne: When Enthought finishes their .NET port of SciPy, you could use the SciPy library from Iron Ruby.

4

Janne 11.28.10 at 20:59

Well… it would depend on the scipy port to finish and then remain well maintained over time; on Iron Ruby remaining healthy and similarly well maintained (it hasn’t sounded very hopeful lately); and finally on our administrators admitting the Mono runtime as supported software into our cluster. Which all means it’s not a feasible option in the short or medium-term for me.

I’m stuck with python for now.

5

charles 12.13.10 at 12:51

I basically am having to give up on using ruby for science after having tried for 2 years and moving to python. Ruby is missing all sorts of basic things for doing even simple computations. Here are some my obsevrations

1. it lacks a decent CSV parser. FasterCSV ( csv in ruby 1.9) is a joke. These days i convert all CSV files to JSON and parse this way.
This does work, but it is a pain sometimes to do the conversion, and not everyone will get this on the first try.

2. NArray is great…but the array indexing is backwards. NArray should follow standard Matlab array indexing. It makes programming
useful algorithms like NMF maddening

Or at least let the user decide what indexing to use (say with an install flag, monkey patch, etc)

3. There are too many GSL libraries, and I can’t get any of them to install on a Mac It would seem the ruby GSL bindings would offer a lot, but it does not compile easily on the Mac (perhaps one needs Fink to do this,
I am still working on it). And while there are pre-compiled GSL libraries for the Mac, they don’t include the shared libraries
needed for the ruby GSL bindings

And this does not have to that hard with the ruby FFI bindings .

4. What is needed is “gem install SciRuby” and it should work on all platforms
This will probably require a Fortran and C++ compiler, so these should also be installed . A good solution would be to use
something like RVM to install Fortran and get things compiled properly on different architectures and with the best maintained libraries

Granted, Python SciPy is not that easy to install…but it does install on a Mac , at least with Python 2.6. or 2.7

6

John Prince 03.10.11 at 14:04

A group of us are beginning work to make sciruby a reality. NArray is currently being rewritten (using matlab/numpy index order). The author of rubyvis and statsample is on board, as well as a number of others dedicated to doing science in ruby.

sciruby

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>