0

After successfuly installing Ruby/GSL library on my Debian (via *deb), with Ruby 1.9.3, I am having troubles running most of the GSL methods. Specifically, this webpage shows several code samples, but (in Arrays), right from the top line, require "GSL" is obsolete, it is require "gsl" today. The remaining methods also do not work.

For another example of my problem, consider another online reference to Ruby/GSL.

GSL::VERSION
#=> 1.15
GSL::pow_2( 4 )
#=> 16

But when I flip the page,

GSL::Complex.new( 0.9, 1.1 )
#=> ArgumentError: wrong number of arguments(2 for 0)

The simplest explanation to me would be that Ruby/GSL has more than one version hanging online, and the documentation I found is for the old one. For example, there is this abandoned version (https://github.com/codahale/ruby-gsl), so perhaps the version history is a bit complicated? Which is the authoritative version, and where can I finde the up-to-date documentation?

Mogsdad
  • 44,709
  • 21
  • 151
  • 275
Boris Stitnicky
  • 12,444
  • 5
  • 57
  • 74

1 Answers1

1

Following methods do work for the Complex module:

> c = GSL::Complex[0.9, 1.1]
=> GSL::Complex
[ 9.000e-01 1.100e+00 ]

> c.real
=> 0.9
> c.imag
=> 1.1

> c.pow 2
=> GSL::Complex
[ -4.000e-01 1.980e+00 ]
David Unric
  • 7,421
  • 1
  • 37
  • 65
  • Great. So all that obsolete documentation was misleading me. Do you know where can I find the up-to-date documentation? – Boris Stitnicky Mar 18 '13 at 05:54
  • @BorisStitnicky It seems you have to build upto-date docs with rdoc or yard from ruby-gsl sources by yourself. There is documentation from 2010 at http://rb-gsl.rubyforge.org/files/rdoc/ref_rdoc.html and at least it does contain updated info for Complex class. If my answer did helped you, feel free to mark is as accepted. – David Unric Mar 18 '13 at 14:50
  • It did help, thanks. I was looking everywhere online and I completely forgot about good old rdoc :-) – Boris Stitnicky Mar 22 '13 at 16:16