Cosmological distances with ruby


#1

I’m doubtful of any interest, but in the odd chance that someone else
might want to play, I’m posting this code. If someone does look, all
comments are welcome (be it ruby style or corrections)!

Attached is a small library that calculates comological distances
(like light travel time, comoving distances, age of the universe,
angular size of the horizon) given a specific cosmology. This is
something I threw together for personal use in solving a homework
problem or two and making some quick estimates. References are
included in the comments for further information.

It requires the ruby GSL bindings (http://rb-gsl.rubyforge.org) for
numerical integration.

The library also includes some sample usage at the end (which is
invoked if the script is just run from the command line).

Cameron

p.s. to interested parties, the science / calculations are pretty well
described by Ned Wright’s page:
http://www.astro.ucla.edu/~wright/CosmoCalc.html


#2

On 4/27/06, Cameron McBride removed_email_address@domain.invalid wrote:

I’m doubtful of any interest, but in the odd chance that someone else
might want to play, [snip]

Attached is a small library that calculates comological distances
[snip]
It requires the ruby GSL bindings (http://rb-gsl.rubyforge.org) for
numerical integration.

Neat. Thanks for the link Cameron.

It’s interesting that there’s two different Ruby bindings to GSL
(“Ruby/GSL” and ruby-gsl). Any idea why that is? Sometimes when
there’s two projects like this, it turns out that one is more of a
straight wrapper, while the other has been worked a little to have
more of the flavor of the language wrapping it. Is that the case here?


#3

On Fri, 28 Apr 2006, John G. wrote:

It’s interesting that there’s two different Ruby bindings to GSL
(“Ruby/GSL” and ruby-gsl). Any idea why that is? Sometimes when
there’s two projects like this, it turns out that one is more of a
straight wrapper, while the other has been worked a little to have
more of the flavor of the language wrapping it. Is that the case here?

if anyone is interested in playing with the gsl using the
one-click-installer
a pre-compiled version, including narray, is here

http://www.codeforpeople.com/lib/ruby/rb-gsl-win/

just grab

http://www.codeforpeople.com/lib/ruby/rb-gsl-win/rb-gsl-1.7.0.tgz

unpack. and run ‘ruby install.rb’.

cheers.

-a


#4

On 4/27/06, removed_email_address@domain.invalid removed_email_address@domain.invalid wrote:

http://www.codeforpeople.com/lib/ruby/rb-gsl-win/

just grab

http://www.codeforpeople.com/lib/ruby/rb-gsl-win/rb-gsl-1.7.0.tgz

unpack. and run ‘ruby install.rb’.

Very cool, Ara. I’ll remember that link!

Cameron


#5

On 4/27/06, John G. removed_email_address@domain.invalid wrote:

It’s interesting that there’s two different Ruby bindings to GSL
(“Ruby/GSL” and ruby-gsl). Any idea why that is? Sometimes when
there’s two projects like this, it turns out that one is more of a
straight wrapper, while the other has been worked a little to have
more of the flavor of the language wrapping it. Is that the case here?

Some might consider that a fair distinction between the two bindings,
although both camps have included code from the other at one point or
another. IMO, Arno’s (http://ruby-gsl.sourceforge.net/) is a bit more
of a straight forward binding whereas Yoshiki added a few things to
round some corners (and hence it’s the one I use). Also, Yoshiki put
a good deal of time into documentation - which is always a good thing!

Cameron


#6

Awesome! This’ll show James Gosling that Ruby’s perfectly fine for
interplanetary navigation! :smiley:

On 4/28/06, removed_email_address@domain.invalid removed_email_address@domain.invalid wrote:

although both camps have included code from the other at one point or
-a

be kind whenever possible… it is always possible.

  • h.h. the 14th dali lama


-Dan Nugent

Don’t Feel Like Typing? Send me a voicemail:
http://odeo.com/sendmeamessage/DanNugent


#7

On Fri, 28 Apr 2006, Cameron McBride wrote:

straight forward binding whereas Yoshiki added a few things to round some
corners (and hence it’s the one I use). Also, Yoshiki put a good deal of
time into documentation - which is always a good thing!

lastly, yoshiki’s versions allows one to intermix narray and gsl
routines
which is really sweet.

cheers.

-a