Re: Calling plotutils from xemacs using Ruby GSL

Just guessing …
Maybe plotutils cannot be found because its path is not visible ?
What happens if you run the example from

_http://ruby-gsl.sourceforge.net/rnd3.html_
(ruby-gsl Sample: rnd3.rb) .

If that works out ok, you could execute the graph command
as an external command, eg. by including it in backticks or
by calling the system command …

Best regards,

Axel

Thanks Axel:

This was my output, leaving me to believe I have bigger problems, or I’m
just using IRB incorrectly: Why would it see GSL okay but barf on the
include for GSL::Random?

Thanks for your time.

#!/usr/local/bin/ruby

require “GSL”
true
include GSL::Random
NameError: uninitialized constant GSL::Random
from (irb):5

Test random number distributions

generate output suitable for graph(1) from GNU plotutils:

ruby test/rnd3.rb | graph -Tps > g.ps

STDERR.puts “Running tests for RND(3)…”
Running tests for RND(3)…
nil

x = y = 0
0
a = []
[]
r = RNG.new
NameError: uninitialized constant RNG
from (irb):15
puts “#m=1,S=2”
#m=1,S=2
nil
printf “%g %g\n”, x, y
0 0
nil
10.times do
a = RND::dir_2d®
x += a[0]
y += a[1]
printf “%g %g\n”, x, y
end
NameError: uninitialized constant RND
from (irb):19
from (irb):18

STDERR.puts "\ndone.SyntaxError: compile error
(irb):25: unterminated string meets end of file
from (irb):25

On 3/12/06, Ruby M. [email protected] wrote:

require “GSL”
Running tests for RND(3)…
#m=1,S=2
NameError: uninitialized constant RND

Just guessing …
Best regards,

Axel

In Linux , after some modifications to rnd3.rb
ruby rnd3.rb | graph -Tps > g.ps
works and I can see the graph using Evince Document Viewer after
ps2pdfwr g.ps to covert it to g.pdf.

Modified rnd3.rb:
#!/usr/local/bin/ruby

#require “GSL”
require “gsl”
require ‘rbgsl’
#include GSL::Random
include GSL
#include RBGSL

Test random number distributions

generate output suitable for graph(1) from GNU plotutils:

ruby test/rnd3.rb | graph -Tps > g.ps

STDERR.puts “Running tests for RND(3)…”
x = y = 0
a = []
r = Rng.new
#r = RND.new
puts “#m=1,S=2”
printf “%g %g\n”, x, y
10.times do

a = RND::dir_2d(r)

a = Ran::dir_2d(r)
x += a[0]
y += a[1]
printf “%g %g\n”, x, y
end

Thanks for the education ,because of you
Prasad