Become a fan of Slashdot on Facebook

 



Forgot your password?
typodupeerror
×
Ruby Programming Python Science

SciRuby: Science and Matrix Libraries For Ruby 138

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."
This discussion has been archived. No new comments can be posted.

SciRuby: Science and Matrix Libraries For Ruby

Comments Filter:
  • *cough* bullshit *cough*
    • by mooingyak ( 720677 ) on Tuesday May 08, 2012 @10:55PM (#39937687)

      *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.

      • Re: (Score:3, Interesting)

        by phantomfive ( 622387 )
        Given that Python and Ruby are 8th and 11th respectively on the Tiobe index [tiobe.com] with a combined rating of 5%, it's more like the Special Olympics. (yes, mod me troll)
        • 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 a
          • Sure, we can try different methodologies. Here we see that [langpop.com] Ruby comes behind PHP, Javascript and Perl on the normalized comparison.
            • "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

              • lol ok fine, no doubt you are right, and Ruby is much more popular than any metric we can think of indicates.
                • "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

                  • lol we can look at something like github [github.com], 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.
                    • "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.
                    • "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 [cpan.org], 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 [slashdot.org] 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.

                    • "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

                    • 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.
                    • I didn't bother to look at Google. I didn't feel my basic argument needed that to support it. And I still don't.

                      "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 ar

                    • 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.
                    • "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 ess

                    • 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.
                    • 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?
    • Precisely. If any language can be said to dominate the scientific community these days, it's probably Excel, with Matlab and R close behind.

      • by ceoyoyo ( 59147 )

        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.

        • by Pseudonym ( 62607 ) on Wednesday May 09, 2012 @12:55AM (#39938197)

          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.

          • 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.

            • That would explain why none of their code looks like it's written in a programming language.

              +1, Sympathy

            • by rioki ( 1328185 )
              I worked with mathematicians... doing numeric simulation... I still have nightmares about their code a decade later.
              • 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.
            • by Anonymous Coward on Wednesday May 09, 2012 @08:26AM (#39940545)

              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.

              • Physicists are perhaps more famous for the same folly; one example I recently stumbled upon was David Boehm [wikipedia.org], 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

                • 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.

              • 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.

        • 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. FORTR
          • by ceoyoyo ( 59147 )

            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

            • 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.

              • by ceoyoyo ( 59147 )

                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.

                • Established scientists use Word to write grant applications and edit papers their students have written.

                  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).

            • 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 tho
              • by ceoyoyo ( 59147 )

                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.
      • Actually IDL is big with the scientists where I work and Mathlab is big with engineers. Fortran still has the most dominate position.
        • 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

          • I feel your pain. Couple IDL with Perl code written as obscure as possible by someone who left 5 years ago then you have my work environment.

            IDL does such a poor job on FITS files that I must clean up the output with a Perl script.

            Luckily my other projects use different languages.

          • but not a single damned person that I know of using Ruby for science in our group

            Actually I like Ruby, but I haven't used it much for linear algebra (I have compiled code for that). I've been looking at JBLAS (a JNI package in java that uses BLAS and LAPACK) and may incorporate it in some Ruby running on JRuby. However every time I have the free time to try, I go WTF? and go get a beer. ;)

      • 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).
    • by rioki ( 1328185 )
      And I thought that Fortran 70 was still dominating in the scientific community...
  • That Python is for C programmers who want to take a break from semicolons. And ruby is the same but for Java programmers.

    • by seanzig ( 834642 )

      That Python is for C programmers who want to take a break from semicolons.

      And braces, and no rules for whitespace, and strong typing, ... and ... C. ;-)

      • You may be confusing strong typing with static typing. C is statically, weakly typed and Python is strongly, dynamically typed. PHP is weakly, dynamically typed.

    • Python and Ruby both are for Perl programmers who haven't lost their sanity yet.
  • by ubergeek ( 91912 ) on Tuesday May 08, 2012 @11:53PM (#39937935)

    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.

    • by Anonymous Coward

      1. ruby - it is quite awkward using scipy from within ruby code.

    • by FrootLoops ( 1817694 ) on Wednesday May 09, 2012 @12:50AM (#39938185)

      The SciRuby Manifesto [github.com] does discuss the question, "Why Ruby?"

      Why Ruby?

      First and least, Ruby is a language with a sense of humor.

      But more importantly, numerical computation and visualization can be done much better in Ruby, for a number of reasons:

              ''Everything returns a value.'' Ruby's better object model means better chaining of computation.
              ''Iterators'' are way better than ''for'' loops (each_slice, each_cons, etc.).
              ''Readability.'' Ruby is incredibly readable, which makes it uber-maintainable.
              ''Metaprogramming.'' Sometimes the simplest solution is to write a [http://github.com/wycats/thor code generator]. Sometimes, eigenclasses are the cleanest.
              ''Integration into Rails.'' The influence of Rails on Ruby is undeniable. Web-based visualization for scientific projects is the future.
              ''R is nice but clunky.'' The learning curve is enormous. It does some things very well, and others not very well at all (try doing a multi-line plot in R).

      Unfortunately it ignores the alternative of just using Python.

      There's also a (I'll be charitable) silly discussion in this vein on the same page:

      Ruby has no equivalent to the beautifully constructed numpy, scipy, and matplotlib libraries for Python. We believe that the time for a Ruby science and visualization package has come and gone. Sometimes when a solution of sugar and water becomes super-saturated, from it precipitates a pure, delicious, and diabetes-inducing crystal of sweetness, induced by no more than the tap of a finger. So it is, we believe, with the need for numeric and visualization libraries in Ruby.

      IMO, this is a misguided waste of time and it's nearly inactive anyway.

      • by bwv549 ( 1730430 ) on Wednesday May 09, 2012 @01:54AM (#39938465)

        Unfortunately it ignores the alternative of just using Python

        The option of using python is implicitly rejected. Why would the contributors spend time on sciruby when they clearly know scipy exists? Speaking for myself, I've used python and scipy (both numpy and matplotlib) for several projects, but I much prefer coding in ruby to python. All the functionality of scipy isn't going to be duplicated with sciruby, but if the most common use cases are implemented, then I can use ruby for most projects.

        this is a misguided waste of time

        why? It's easier to re-implement (i.e., borrow from scipy) than implement in the first place, so it doesn't take all that much time. And, as pointed out, this is currently a minor project compared to scipy, so if it is a waste of time then it's not a lot of it.

        Python has a "there is only one true way" mentality, so there isn't a lot of room to try and innovate within scipy. Perhaps sciruby will innovate in significant ways and scipy will draw a little from it one day.

        and it's nearly inactive anyway

        The fellowship and nmatrix commit history [github.com] would suggest otherwise.

        • I agree that since this doesn't have a lot of contributors it isn't a huge waste of time, though that's not a good argument. The question is if it's worth the resources to reinvent the wheel (even just porting entails a lot of work, and I'm not sure that's what they're after here) just so people can use their preferred language. I would say no since the difference between the languages isn't enormous. It's unfortunate, but tradeoffs need to be made and not every language can have nice numerical and algebrai

        • by gd2shoe ( 747932 )

          Python has a "there is only one true way" mentality...

          I think "had" would be a better way of putting it. Python set out to be the anti-Perl. This required making sure there was no bizarre behavior that coders could exploit to make their code more unreadable, and easier to break. There are a few kinks that are more limiting than I would like, but the language has gained a lot more flexibility over the years.

    • Well, Ruby & Python are just like islam & Judaism or vim & Emacs.
      They're very similar, yet distinct, and once you've chosen one path, it's hard to take another.

      I'm really good at using Ruby, know the inner workings, wrote many plug-ins and applications, and contributed to the project.
      There are many cool projects for Python that I'd love to understand, use and contribute to.

      I tried some tutorials for Python, but it feels like a waste of time when I already know a OO high-level scripting language.

  • 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,

  • Non-story (Score:4, Insightful)

    by FrootLoops ( 1817694 ) on Wednesday May 09, 2012 @12:41AM (#39938133)

    The fellowship is a summer long with only a $1,500 stipend. The most recent commit [github.com] 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 [github.com] 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.

    • Re: (Score:3, Interesting)

      by bwv549 ( 1730430 )

      The slowdown in commits to sciruby proper is due to the recent efforts on nmatrix (the subject of the story). The github commit history [github.com] is easily accessible and shows a flurry of activity. Many projects associated with sciruby are also not housed directly under the sciruby name (e.g., rubyvis [rubyforge.org])

      There are a million minor projects like this that similarly aren't newsworthy enough to discuss

      ... yet here we are...

      The lack of comparable scientific libraries is the primary reason many folks choose python over ru

      • but the point is that it continues to pick up steam

        Really? I see one active contributor on these five SciRuby repos [github.com] (who is responsible for the "flurry of activity" you describe) with an overall trend downwards. The port you linked is also essentially inactive, though it may simply be complete. By contrast there's half a dozen different contributors on the first numpy commit page I linked alone.

        OT: Nice Bach piece by the way. Why did you pick it?

  • I've been using Octave (an open source version of Matlab) in Stanford's online PGM course [coursera.org]. 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).

    • by loufoque ( 1400831 ) on Wednesday May 09, 2012 @04:18AM (#39939017)

      What people fail to understand is that OOP is a bad paradigm for numerical computing. It's ill-suited to vectorization and parallelization.

      • by khipu ( 2511498 )

        What people fail to understand is that OOP is a bad paradigm for numerical computing. It's ill-suited to vectorization and parallelization.

        What people fail to understand is that >95% of any big scientific code is not performance critical, parallel, or vectorized. It's that code that needs to be written in OOP. That's why a good scientific language needs both good OOP support and good vectorization/parallelization support these days.

Man is an animal that makes bargains: no other animal does this-- no dog exchanges bones with another. -- Adam Smith

Working...