Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Choosing a scripting language for scientific programming

Reply
Thread Tools

Choosing a scripting language for scientific programming

 
 
deltaquattro
Guest
Posts: n/a
 
      11-23-2007
On 20 Nov, 14:27, Bil Kleb <(E-Mail Removed)> wrote:
> deltaquattrowrote:
> > Hi,

>
> Hi.
>


Hi, Bil,

sorry for not replying before to your very interesting post: I'm very
busy doing by hand all these marvelous things you do automatically
with Ruby I'm astonished by the degree of automatization that you
reached with Ruby. Now I understand how it was possible that a U.S.
engineer at Boeing was able to 1) set up, 2) run, 3) postprocess a
complex CFD simulation and 4) write a detailed report, before I could
even get point 3) done for the same test case. Clearly he uses Ruby
(or Python

> I've done at least 4 scientific papers with Ruby generated graphs,
> images, reports, and tables based on data in huge binary files.
> I've helped several other colleagues do the same.


This is great: your colleagues are very lucky to have you in their
team. May I ask you some more information on how you do this?
[..]

> > Which is easier to learn?

>
> Yes.


Pardon, I made a typo: I meant "Which one is easier to learn?". Do you
mean Ruby is easier to learn than Python?

> Regards,
> --
> Bil Klebhttp://fun3d.larc.nasa.govhttp://nasarb.rubyforge.org


Thanks for all the information: as soon as I have some more time I'd
like to contact you privately on the subject, if that's ok for you.
BTW, will you attend AIAA conference in Reno, in January?

Best regards,

deltaquattro
 
Reply With Quote
 
 
 
 
Eric Lavigne
Guest
Posts: n/a
 
      11-23-2007
> > > Which is easier to learn?
> >
> > Yes.

>
> Pardon, I made a typo: I meant "Which one is easier to learn?". Do you
> mean Ruby is easier to learn than Python?


I think that Python is easier to learn, but Ruby provides more
flexibility. Both of them are so easy to learn that it doesn't matter
which is easier (thus the answer is "yes"). You could even learn both
and decide which you like best.

I would recommend purchasing the second edition of "Programming Ruby:
The Pragmatic Programmer's Guide", but you can also read the first
edition online.
http://www.ruby-doc.org/docs/ProgrammingRuby/

I would recommend this tutorial for Python:
http://docs.python.org/tut/tut.html
Then this document as a reference:
http://docs.python.org/lib/lib.html

Also, once you have learned how to automate all those things that you
once did by hand, I strongly recommend learning OCaml next. Fortran is
no longer one of the better languages available, and it shouldn't be
used for new programs. You will find that programs written in OCaml
are shorter, simpler, and easier to write than equivalent Fortran
programs. When the process of programming becomes easier, one of the
results is that it becomes easier to experiment with ways to improve
your program's speed. The following book focuses on using OCaml for
the types of programs that are traditionally written in Fortran.

http://www.ffconsultancy.com/product...or_scientists/

--
There are two ways of constructing a software design: One way is to
make it so simple that there are obviously no deficiencies, and the
other way is to make it so complicated that there are no obvious
deficiencies. The first method is far more difficult.

- C.A.R. Hoare -

 
Reply With Quote
 
 
 
 
Bil Kleb
Guest
Posts: n/a
 
      11-23-2007
deltaquattro wrote:
>
> Hi, Bil,


Hi.

> Now I understand how it was possible that a U.S.
> engineer at Boeing was able to 1) set up, 2) run, 3) postprocess a
> complex CFD simulation and 4) write a detailed report, before I could
> even get point 3) done for the same test case.


Curious: who and which CFD code?

> This is great: your colleagues are very lucky to have you in their
> team. May I ask you some more information on how you do this?


Certainly.

>>> Which is easier to learn?

>> Yes.

>
> Pardon, I made a typo: I meant "Which one is easier to learn?". Do you
> mean Ruby is easier to learn than Python?


I think they are both easy compared to Fortran. I don't think there
is any significant difference in ease of learning between the two.

> Thanks for all the information: as soon as I have some more time I'd
> like to contact you privately on the subject, if that's ok for you.


That's fine.

> BTW, will you attend AIAA conference in Reno, in January?


No, I'm conferenced out for the time being: I have a NATO RTO in
Athens, Greece in the beginning of December, then I'm done for a while..

Regards,
--
Bil Kleb
http://fun3d.larc.nasa.gov
 
Reply With Quote
 
Marc Heiler
Guest
Posts: n/a
 
      11-24-2007
"Right now I'm using awk and (to a lesser extent) perl to
do this."

One advantage with python or ruby would be that you can reuse
a lot of that, still have the functionality (of like awk or
near to, at least a nicer syntax), while still being able to
maintain it nicely (different to perl, maintaining perl
scripts STINKS in my opinion)

"However, I'd like to learn a newer scripting language and at
the same time learn OOP, so I'm choosing between Python and Ruby."

My Python is not that good...
I think python as a language is acceptable, more than perl in
practise. But Ruby's OOP model does not feel second class, different
to the python differences about length(object) or object.foo().
For example, python feels the need to pass def foo(self).
This is MANDATORY (although you can use any other name than self (!).

When you invoke a method, such as cat.meow, in python you
MUST use the meow(). Python says this is to your advantage, but to
me it is a fundamental difference in philosophy ...

It basically tells you, python way, or the highway.

Python forces, ruby allows ...


"2) (less easy) semi-automatic generation of graph, images, report,
etc., based on data in huge binary files (O(Gb));"

I think this can be a bit difficult in either language, but
whatever applies to python, will apply to ruby too. (Or to
perl in this regard, at least perl-ruby ... ruby is really
how perl should have been from the start, perl's OOP is
a shame, and perl offers 10000 ugly ways to do something
you write once, and then never look at it again ...)

Each language has some other advantages here and there,
for example it was my impression that python has a little bit
more bindings in general than ruby (i.e. blender plugin, ogre3d
wrapper and so on). Ruby catches up to this, but it still will
take a bit more time ...

"3) (hard) create GUIs for scientifc codes, which could enable
unexperienced users to run the codes"

I dare claim that ruby-gtk is (almost) as good as python-gtk.
So at least for gtk, there really is no difference IMHO to the
python variant (there is a tiny catch if you need to use a lot of
threads and stuff... but just have a look at recent mailing
list, in my opinion this is really no "showstopper" at all)

"Which are the main differences between Ruby and Python?"
I really think the attitude towards OOP is a huge difference.
In essence, ruby is a lot cleaner in this philosophical regard.
I can forgive python its indent-obsession, but i can not forgive
it the implicit self and forced () ... by the way, the default
interactive python is also annoying in its mindset, "exit" or
"quit" does not work... I am just glad I can alias that for
irb without a fuzz. Again a little philosophical difference ...
(But in my opinion, ruby is actually a lot more fun than python
as ruby doesn't superimpose as much as python does on you)

"Which is easier to learn?"
To be honest, I think BOTH are easy to learn but BOTH are
hard to master. I recommend you to use only a subset of any
language you choose, and slowly build up on it.

"I've seen a lot of numerical libraries/extensions for
Python: does Ruby also support scientific programming?"

Well there is gsl, also some stuff is in the Math module, then
we have some matrices and more stuff... I guess the hardcore
maths users go and use Haskell anyway
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
Eric Lavigne
Guest
Posts: n/a
 
      11-24-2007
I hope that the original poster will just start learning one of Ruby
or Python and not spend too much time thinking about the difference
for now. Learning the basics will only take a weekend, so it really
does make sense to learn both and decide for yourself. However, I
enjoy discussing the features and merits of programming languages, so
I will reply anyway.

> When you invoke a method, such as cat.meow, in python you
> MUST use the meow(). Python says this is to your advantage, but to
> me it is a fundamental difference in philosophy ...
>
> It basically tells you, python way, or the highway.
>
> Python forces, ruby allows ...


I believe that those parentheses are an advantage, and they actually
allow me greater flexibility in my code by making the method
invocation explicit. I have done a lot of functional programming, and
in Python if I leave the parentheses off of a method then I can pass
the method itself, uninvoked, as a parameter to another method. Typing
two parentheses for each method call is a small price to pay for this
convenience, especially since I end up typing as many parentheses in
either case (but in different places) to control order of operations.
It is strange to me that, in Ruby, if I try to pass around a method
that takes several arguments, it complains about not receiving the
arguments instead of just allowing itself to be passed around.

Another Python advantage is that idiomatic Python code is extremely
easy to read, even by mediocre programmers with no experience in the
language. The indent-obsession that you criticize helps a great deal
with that.

On the other hand, here I am in a Ruby newsgroup. I like the blocks
and iterators, the monkey patching, the greater support for concise
code. Yes, I also like the consistency of length being a method (one
less thing to remember), though I can't imagine why such a trivial
issue comes up so often in these conversations.

> "I've seen a lot of numerical libraries/extensions for
> Python: does Ruby also support scientific programming?"
>
> Well there is gsl, also some stuff is in the Math module, then
> we have some matrices and more stuff... I guess the hardcore
> maths users go and use Haskell anyway


Haskell draws in programmer mathematicians, but most scientific
programmers aren't quite so hardcore in either programming or
mathematics. I wish that Haskell had better documentation for
beginners (a problem that Haskellers are certainly working hard at)
but for now the entrance barrier seems too high.

--
There are two ways of constructing a software design: One way is to
make it so simple that there are obviously no deficiencies, and the
other way is to make it so complicated that there are no obvious
deficiencies. The first method is far more difficult.

- C.A.R. Hoare -

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sorry for interrupt,because my mother language is not English,it maybe a little confused to read the c programming language. Zhang Yuan C Programming 6 06-14-2012 04:35 AM
LinuxJournal Readers' Choice Awards 2011 Best {Programming,Scripting} Language wesley chun Python 1 12-05-2011 06:33 PM
Help Required for Choosing Programming Language ifti_crazy@yahoo.com Python 40 02-26-2007 10:56 AM
Using a Scripting Language as Your Scripting Language DaveInSidney Python 0 05-09-2005 03:13 AM
Python is the best and most popular general purpose scripting language; the universal scripting language Ron Stephens Python 23 04-12-2004 05:32 PM



Advertisments