SciRuby: Science and Matrix Libraries For Ruby
Aciel writes "Ruby has long been popular in the web/business community, while Python dominates the scientific community. One new project seeks to bring balance to the force: SciRuby. We've already introduced a linear algebra library called NMatrix (currently alpha status). There's at least one fellowship available for students interested in working on the project this summer."
unless it also pushes bizPython!
*cough* bullshit *cough*
*cough* bullshit *cough*
You first have to realize that there are exactly two programming languages in all existence: ruby and python.
The rest makes more sense if you start from there.
William of Ockham had no beard. The most likely explanation is that it was chewed off by squirrels every morning.
Either they wrapped a C library for this, or you'll get to wait extra long for that sim to run. But developer productivity is more important. While the developer is having a cup of coffee, he might even be able to persuade a girl to have it with him, which might lead to some production. Carry on, boys...
That Python is for C programmers who want to take a break from semicolons. And ruby is the same but for Java programmers.
If you mod me down the terrorists will have won
Given that Python and Ruby are 8th and 11th respectively on the Tiobe index with a combined rating of 5%, it's more like the Special Olympics. (yes, mod me troll)
"First they came for the slanderers and i said nothing."
It's not that. There are at least a couple of major issues here:
(1) The languages at the top of the Tiobe Index (even given that we can assume it has some claim to validity... I'm not so sure) are all compiled languages, or at least compilable to bytecode. Except PHP, which dominated the Web world for a long time but is sliding, and for good reasons.
(2) The languages at the top of the Tiobe index will always have distorted figures because they represent the majority of code that is already installed and being maintained, rather than new programs.
When compiled Ruby has become more mature (there are things like JRuby which is coming along nicely, and Ruby 3.0 will supposedly be compilable to bytecode) you will see an increase in its use, because then it will be more commercially viable and appropriate for desktop applications.
In the meantime, languages that have been mostly used for scripting like Ruby and Python are not used so much for business because all your code is exposed to any would-be customers. That says absolutely nothing about the features of the language itself, except that it is more difficult to compile dynamic languages.
Precisely. If any language can be said to dominate the scientific community these days, it's probably Excel, with Matlab and R close behind.
sub f{($f)=@_;print"$f(q{$f});";}f(q{sub f{($f)=@_;print"$f(q{$f});";}f});
Sure, we can try different methodologies. Here we see that Ruby comes behind PHP, Javascript and Perl on the normalized comparison.
"First they came for the slanderers and i said nothing."
This seems like a terrible idea. What could scientific computing with Ruby possibly offer that SciPy doesn't already? Way to split the potential work force guys. If you want to develop a scientific computing library for a rich dynamic language, then contribute to SciPy. What a wasted effort.
Excel isn't a language. MatLab might beat Python, but it's been losing ground. R? I love R, but it's not a general purpose language and very few scientists know how to use it.
Personally I find R is much nicer wrapped up in Python.
This Ruby/Python thing has gone on long enough. Here we have two languages with identical use cases, identical advantages/disadvantages, and (in the grand scheme of things) almost identical properties in every way. The practical differences between them stem almost entirely from the fact that they happen to be used by different communities, so certain modules in each are much better developed than in the other.
The fact that they both exist has split development effort to the detriment of both. For example, the people that made this package for Ruby are just reimplementing NumPy, providing no advantage whatsoever over NumPy except for the ability to import Ruby packages. Which Ruby packages these people want to import for their scientific computing project that don't have Python equivalents, I have no idea, but maybe they should have implemented or improved those in Python?
Likewise, mod me troll, but I'm guessing Django wouldn't exist if Rails was a Python module. Tons of effort was duplicated there.
Can we just friggin' pick one and leave the other one to die? I don't care which, I'm not taking sides, it just seems to be a really silly duopoly.
The fellowship is a summer long with only a $1,500 stipend. The most recent commit is from December 1st, 2011. The wiki and issue tracker appear to be similarly inactive. Even if the project does something, it probably won't do much; contrast it with numpy commits which are recent and numerous.
This story should never have been accepted. There are a million minor projects like this that similarly aren't newsworthy enough to discuss.
> In the meantime, languages that have been mostly used for scripting like Ruby and Python are not used so much for business because all your code is exposed to any would-be customers.
Huh? I'm actually not sure how to set it up so that Python (or Ruby) would be exposed at the frontend. The code runs on your server and sends back pages. Are you thinking of JavaScript?
Also, Python has been compileable to bytecode for some time. Unfortunately it's still slow as hell (though nowhere as slow as Ruby). It turns out that compiling to bytecode and doing so in a performance-enhancing way are two very different things.
Excel isn't a language.
You know that and I know that. But I've worked for physicists, chemists and biologists, and believe me, that little detail doesn't stop them one little bit. A little birdie tells me that it's even worse in the social sciences.
MatLab might beat Python, but it's been losing ground.
Very slowly, and in the fields I've worked in, invariably to R.
R? I love R, but it's not a general purpose language and very few scientists know how to use it.
Those two little details don't stop scientists either.
In my experience, scientists will do just about anything to convince themselves that they're not actually programming, if only to avoid pesky annoyances like source code control. The less it looks like a programming language, the better.
sub f{($f)=@_;print"$f(q{$f});";}f(q{sub f{($f)=@_;print"$f(q{$f});";}f});
In my experience, scientists will do just about anything to convince themselves that they're not actually programming, if only to avoid pesky annoyances like source code control. The less it looks like a programming language, the better.
Oh god. That would explain why none of their code looks like it's written in a programming language.*
* I work with biologists. By 'they,' I mean biologists. I know you physicists and quantum chemists have it lucky. Stop bragging. You're making me feel bad.
Bio questions? Ask me to start a Q&A journal. Computer analogies available for most topics!
I've been using Octave (an open source version of Matlab) in Stanford's online PGM course. My first reaction was "great matrix manipulation library, extremely bad language". It's like time travelling to the 70's and discarding every progress CS made in the last forty years. Actually Matlab has object oriented classes now but somebody commented in the PGM forums that it's not so good. (Octave uses an older Matlab OO syntax I'll be merciful not to comment about.) I don't have any direct experience with R but on the PGM forum I read that its status is not so different.
My suggestion to the scientific community is to work on replacing those old languages with something modern, even Python which I cordially hate because of that white space thing. Obviously you need a fast (written in C) scientific library and an interactive prompt is extremely handy. Python and Ruby are sensible choices IMHO. Matlab and R won't disappear, Cobol didn't go away, but there is no reason why a 20 years old student shouldn't start coding with a modern language, if it's on par with the old ones (a big if, I know).
Why is this modded as troll? Did he lie?
I hope they support mingw via devkit tdm. Julia tries to use libuv to be cross-platform.
That would explain why none of their code looks like it's written in a programming language.
+1, Sympathy
sub f{($f)=@_;print"$f(q{$f});";}f(q{sub f{($f)=@_;print"$f(q{$f});";}f});
MATLAB wins in the engineering community, and that's by a long run.
But everybody keeps forgetting the unsung hero called FORTRAN. Several decades later it's still alive and kicking and it's still used on a daily basis in the scientific community. We don't need another language for scientific computing. And the last thing we need is a language like Ruby. Ruby is a memory hog and inefficient at the best of times. And I sure as hell wouldn't want to be tasked for writing a good optimizing Ruby compiler. FORTRAN on the other hand has a large list of available compilers. And some of them produce simply amazing results. See Intel's FORTRAN compiler if you want to see what optimization can do if done properly.
Yes, but we're talking about the SCIENTIFIC community. Engineers use MatLab because that's what they learn in school, and that's mostly because that's what their professors are familiar with.
Some of the people doing heavy duty number crunching still write Fortran code, but they're a small minority. Yes, most scientists use libraries that were written in Fortran all the time, but very few write code in it. It's not a very good language for modern general use.
High level, powerful languages like Python and Ruby are very useful for science. Why do you think MatLab has been so popular? MatLab is falling from favour now because it hasn't kept up with the times (the object extensions aren't great for example), is closed, expensive, and more difficult to extend. But Python (or Ruby) with standard numerical libraries doing the heavy lifting is an excellent solution for most scientists.
And I thought that Fortran 70 was still dominating in the scientific community...
I worked with mathematicians... doing numeric simulation... I still have nightmares about their code a decade later.
Python 3 and Ruby 1.9 are about even on most benchmarks and JRuby is light years ahead of Jython.
Actually IDL is big with the scientists where I work and Mathlab is big with engineers. Fortran still has the most dominate position.
These comments are my own and do not necessarily reflect the views or opinions of my employer or colleagues...
Young Postdocs and graduate students may use Python. The established scientists use Perl, Fortran and IDL.
This is because scientists get paid to think about their field of specialty and not learning a new language. What language was popular during their education will most likely be the language they use in their careers.
These comments are my own and do not necessarily reflect the views or opinions of my employer or colleagues...
I do a fair bit of work in IDL (writing software for the scientists to use) ... but there are days that I want to stab myself repeatedly with a fork. (I've asked for ages for native SOAP/WSDL support ... they insist they have it, because they can do the OGC services ... but those aren't the SOAP calls I'm trying to make)
If you don't interact with their XML *just* right, it can cause some horrible problems where the cleanup time increases exponentially with the number of elements. And try to do it all with regex? Well, their regex parser is a joke, too.
They *finally* introduced a concept of lists (and empty lists!), associative arrays, and null in IDL8 ... but I've got to support IDL7, too. (and of course, IDL8 save files aren't backwards compatable with IDL7, so that caused all sorts of problems, too).
And if they weren't so litigious, I could've used PDL to extract what I need from the save files, but that boat's sailed ... and I haven't gotten enough time to learn enough Python to redo those cron jobs using IDLSave.
(and yes, there's still quite a bit of Fortran ... and C, GDL, PDL, Matlab, SciPy, etc ... but not a single damned person that I know of using Ruby for science in our group)
Build it, and they will come^Hplain.
It cuts both ways. I'm a geneticist, and it's painful having to work with tech guys who don't know the first thing about even basic biology, never mind genetics.
It's the same here on Slashdot. I always cringe every time I load up the comments on a story about genetics or evolution, because I know there'll be a slew of ignorant comments modded up to +5 insightful. At least most scientists know their limitations at programming, but the same cannot be said with regard to non-engineering subjects for many engineers, who feel themselves qualified to comment on just about any topic under the sun, regardless of their lack of knowledge.
Established scientists use Word to write grant applications and edit papers their students have written.
When I was a grad student my supervisor was a computer scientist who used IDL in his PhD. He hadn't written code, of any kind, for ten years. He wanted to learn some Python (because he wanted to write a hockey pool calculator) but couldn't find the time.
It is an awesome language; is reasonably fast, with some compiling implementations (SBCL, CCL, Allegro.. ). ...} ).
The FFI is so much easier to use, and Macros make the task of writing dreary wrappers (I'm looking at you Python\{Scipy weave, Cython
The community is sparse as always; but there are some projects like Matlisp which are reasonably complete.
The ugliest stuff I have seen was from mathematicians working in medicine. As a naive student, one is inclined to think that MATLAB code, like any programming language that isn't Perl, line noise, INTERCAL, bf, or TECO, has a minimum floor of ugliness. One would be wrong.
Bio questions? Ask me to start a Q&A journal. Computer analogies available for most topics!
Physicists are perhaps more famous for the same folly; one example I recently stumbled upon was David Boehm, who, in conjunction with a psychologist, developed a completely nonsensical theory of higher brain function and the emergence of independent thought based on nothing more than the appeal of physics concepts to a biological problem.
If it consoles you any, rectifying such misconceptions is one of the reasons I make a habit of posting here. Experience more suggests, however, that not reading the article is more commonly a source of error—but perhaps that's an artefact of the same presumptiveness.
Bio questions? Ask me to start a Q&A journal. Computer analogies available for most topics!
That is true for most established scientists employed by universities. In the research facility where I work, the non-university backed scientists do their own analysis (and programming).
These comments are my own and do not necessarily reflect the views or opinions of my employer or colleagues...
That index does not include numPy and sciPy, which is specifically what TFA is talking about. numPy performs calculations at "near C" speeds (at least *much* faster than normal python or other non-compiled languages can). And yes, a good amount of research/non-programming scientific types use it. I would imagine the time difference between learning to code well in C versus learning to use numPy at a basic level would pretty much cover the time one might save in performance. Plus C is a lot more writing.
The original enercalc, which performed various indeterminate/FEM calculations, like frame analysis, was written in excel (well, an early version of lotus) (ref: http://www.enercalc.com/sel58_help/index.html?company__software_history.htm )
I myself have written entire engineering calculation templates and even was able to perform automated solution on an iterative problem (ICR for an arbitrary bolt grouping - Crawford and Kulak) which mathmatica was unable to do (it simply replied "no algebraic solution") using excel. So while it isn't formally a "language" it is still a very powerful (and fast) solution to many mathematical/logic endeavors.
Let's not forget Mathematica (my personal favorite) and Lab View (used for programming National Instruments cards, but soms people start using it as a general programming language because that's what they know -- visual interface, more like circuit design, quite interesting actually).
Similar situation with a startup: MatLab code written for medical-related university research project by a succession of engineering interns. Brutally hideous stuff. The subsequent startup company eventually hired an actual MatLab programmer, and the difference is astonishing.
- T
"Sure, we can try different methodologies. Here we see that Ruby comes behind PHP, Javascript and Perl on the normalized comparison."
Not really. First, it's a Web survey of discussions, not a measure of how popular these languages are in actual use. One might infer a relationship, but it ain't necessarily so, and even if there is one, who knows how strong that correlation is?
Second, being a web survey, web-oriented languages (like JavaScript; a rather glaring example) are over-represented. Perl (another good example) is a legacy language that was very popular in its day, although it is almost universally rejected (with a good deal of disgust) by new programmers today in favor of more modern scripts. Perl is in fact an excellent example of my second point.
lol ok fine, no doubt you are right, and Ruby is much more popular than any metric we can think of indicates.
"First they came for the slanderers and i said nothing."
When I was an undergrad, biology was the science you did if you liked science but didn't like maths. That's the reason why I was turned off biology back in the day. Boy how things have changed.
Having said that, it's my experience that it's easier to teach a computer scientist (not just a "tech guy") enough biology than it is to teach a biologist enough software engineering, where "enough" means sufficient to form a productive working partnership. There are, of course, notable exceptions in both directions. But that generally seems to be the case.
sub f{($f)=@_;print"$f(q{$f});";}f(q{sub f{($f)=@_;print"$f(q{$f});";}f});
To be fair, there are a few notable physicists who have made major contributions to other fields. Dijkstra is the one that most computer scientists know. They are, of course, notable because they're the exceptions.
sub f{($f)=@_;print"$f(q{$f});";}f(q{sub f{($f)=@_;print"$f(q{$f});";}f});
First of all. Believe it or not, engineers make up a large part of the scientific community. And you're very mistaken in that though. MATLAB is often the best tool for the job. Go and try to prototype any form of digital signal processing system or algorithm in anything else than MATLAB and they'll point and laugh at you. If you do any of that in python or another language you'll find yourself reinventing the wheel simply cause all those functions already exist in MATLAB. And at least you can be certain those will work compared to your own writings. ... It's not cause you didn't run into it yourself that it's never used. FORTRAN still makes its daily appearance in most research facilities. And the older researchers will often teach the younger ones about the wonderful language it is.
Actually, it's not a small minority. FORTRAN is still the tool of choice in many fields. Especially where massive parallel computing comes into play (think weather forecasting). Another largely unknown language that is used in large systems world wide is Ada. Again it's not very well known. But it's one of the few languages reliable enough to deal with systems like weapon systems, flight traffic control systems, autopilots,
High level languages are slow and inefficient. You don't need objects for scientific calculations, what you need is a good mathematical library that is capable of handling large vectors/matrices quickly with efficient memory usage. Neither Python nor Ruby are capable of those feats (their libraries are crappy at best compared to the established values). For FORTRAN and MATLAB that's a walk in the park actually. Side bonus is that MATLAB code can be translated into C meaning it can be compiled resulting in near native performance as well. Again something Python and Ruby can't hope to achieve properly cause of their dynamic workings.
You might want to take a bit of a break from Fortran. You seem to be a bit personally attached. Kind of a Slashdot stereotype and all that.
How does this relate to the subject? It's all about using the best tool for the job. And FORTRAN and MATLAB are the best tools.
"lol ok fine, no doubt you are right, and Ruby is much more popular than any metric we can think of indicates."
That isn't what I was saying at all. What I was saying is that it all depends on what you mean by "popular".
"Legacy languages" (like Perl, and even Java to some extent) remain popular for a long time for several reasons, among those reasons the sheer size of the established code base. I mean, sheesh... there is still a demand, although a small one, for COBOL programmers, and that was the first "high-level language" ever invented!
I'm not saying that Ruby is more popular than the charts indicate. What I was claiming were basically 2 different things entirely: (1) there is a reason for the popularity of some of the other languages that has nothing to do with how popular they are with NEW programmers (which means they are actually in slow decline), and (2) scripting languages like Ruby will become more popular if and when compilers for them reach a certain level of maturity.
lol we can look at something like github, which has mainly new projects. That has Ruby as the #2 language for projects.
Predicting that a language will become popular in the future is tenuous at best. Ruby doesn't deal with multi-threading as well as some other languages. Will it matter? I don't know, but lack of a compiler isn't the only thing involved in a language's popularity.
"First they came for the slanderers and i said nothing."
"Predicting that a language will become popular in the future is tenuous at best."
Will you get off the Ruby kick? I was referring to a class of languages, not necessarily a language itself:
"... scripting languages like Ruby ..."
And all I said was that will make them more popular. And that stands to reason, because then they will be useful for a wider range of applications. It hardly takes a Nostradamus to make that prediction.
lol apparently you think Perl is not a scripting language like Ruby. And ok, I'll agree PHP isn't a scripting language like Ruby.
"First they came for the slanderers and i said nothing."
"lol apparently you think Perl is not a scripting language like Ruby. And ok, I'll agree PHP isn't a scripting language like Ruby."
Where do you get this stuff? That's not what I said, either.
Tell me: do you know of anybody working on compilers for Perl or PHP? When you do, let me know...
Tell me: do you know of anybody working on compilers for Perl or PHP? When you do, let me know...
lol your Google-fu needs to improve. There is perlcc, available for a while although I have no clue if anyone is using it, but I do know Facebook is quite proud of their PHP compiler and they definitely use it. Yet another reason to not work at Facebook.
Also, it's not like compiling your code hopelessly obfuscates it. Several times over the last year I've had to disassemble C or C++ source code from an Android system to figure out how something works.
"First they came for the slanderers and i said nothing."
"Also, it's not like compiling your code hopelessly obfuscates it."
Okay, I knew there was a Perl compiler, but I wasn't aware that anybody actually used it. I was not aware of the PHP compiler.
But you don't need code to be "hopelessly" obfuscated. Even bytecode-compiled code is obfuscated enough for it to be commercially useful. Decompiled code is much harder to read and decipher than plain source code. Another example is the obfuscator that Microsoft used to supply (and maybe still does, I don't know) with Visual Studio, without which many people would not have used it to build commercial products.
Arguing absolutes (like "hopelessly obfuscated") isn't going to get you very far. I am beginning to think you are arguing just to be a troll.
lol be nice!! You're the one who can't use Google, and I'm the troll??
I guess I can agree that having the code obfuscated makes it harder for a competitor to steal your code completely and wrap it up as their own product. If you're trying to hide your super-secret algorithm, or keep people from cracking your DRM, having the code compiled is a false sense of security. Although I admit some people are afraid of reading assembly.
"First they came for the slanderers and i said nothing."
"I guess I can agree that having the code obfuscated makes it harder for a competitor to steal your code completely and wrap it up as their own product."
Which in turn makes the language more popular. That was the essence of what I was saying. Java would not have enjoyed anywhere near the popularity it has had if everybody could see all the source code. Even though decompiling is still possible. And the lack of same has been the deciding factor in my not distributing a couple of programs written in Ruby.
"If you're trying to hide your super-secret algorithm, or keep people from cracking your DRM, having the code compiled is a false sense of security."
Agreed. I think the basic idea is that you are preventing all but the determined from "borrowing" your code.
While I generally agree that "security through obscurity", as a concept, doesn't work very well, it is usually sufficient to block only the casual potential thieves, not the experts. If that were not so, they would not be able to sell all those shitty door locks to people. Which is 95% of them or probably more. Most of them are ridiculously easy to defeat, if you know what you are doing.
Those with skill are going to get in anyway, if they are determined.
Sounds good.
I'm not so sure that many companies are actually so worried about people looking at their source code, especially for a language such as Ruby which is mainly used on the backend of websites, but I could be wrong.
"First they came for the slanderers and i said nothing."
"I'm not so sure that many companies are actually so worried about people looking at their source code, especially for a language such as Ruby which is mainly used on the backend of websites, but I could be wrong."
Then you've missed my whole point.
Java is used on the back-end of some websites too. And that is probably where it would have stayed, if it were not compilable to bytecode.
It makes a BIG difference to a LOT of people. Repeat: that's the whole reason why Microsoft included an obfuscator with Visual Studio: because (a) their CLR bytecode compiler did not sufficiently obfuscate the source, and (b) without that, nobody wanted to distribute desktop apps. It wasn't just an extra, it was considered to be essential.
I should add that Ruby is used for a lot more than just websites. You are probably thinking about Rails. Ruby is suitable (and is used for) all the same kinds of things as Python. It's just that Ruby got a later start, because it wasn't really known outside of Japan until some years after it was created.
Yeah, Ruby is a fine language. I have nothing against it.
"First they came for the slanderers and i said nothing."
Maybe. Java isn't very common on the desktop, still. My company uses it though, and we don't use an obfuscator. Do you know if Visual Studio's is commonly used, or are you just guessing again?
"First they came for the slanderers and i said nothing."