[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Calling plotutils from xemacs using Ruby GSL

Nuralanur

3/11/2006 11:32:00 PM

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/...
(http://ruby-gsl.sourceforge.net...) .

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
2 Answers

Ruby Mode

3/12/2006 2:40:00 AM

0

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(r)
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/11/06, Nuralanur@aol.com <Nuralanur@aol.com> wrote:
>
> 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/...
> (http://ruby-gsl.sourceforge.net...) .
>
> 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
>
>

G.Durga Prasad

3/12/2006 6:52:00 PM

0

On 3/12/06, Ruby Mode <rubymode@gmail.com> wrote:
> 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(r)
> 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/11/06, Nuralanur@aol.com <Nuralanur@aol.com> wrote:
> >
> > 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/...
> > (http://ruby-gsl.sourceforge.net...) .
> >
> > 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
> >
> >
>
>
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