/usr/share/doc/ruby-gsl/examples/gallery/roesller.rb is in ruby-gsl 2.1.0.3+dfsg1-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | #!/usr/bin/env ruby
require("gsl")
dim = 3
roesller = Proc.new { |t, v, dvdt, params|
a = params[0]; b = params[1]; c = params[2]
x = v[0]; y = v[1]; z = v[2]
dvdt[0] = - y - z
dvdt[1] = x + a*y
dvdt[2] = b*x - (c - x)*z
}
a = 0.344
b = 0.4
c = 4.5
solver = GSL::Odeiv::Solver.alloc(GSL::Odeiv::Step::RKF45, [1e-6, 0.0], roesller, dim)
solver.set_params(a, b, c)
t = 0.0; tend = 100.0
h = 1e-6
v = GSL::Vector.alloc(1, 0, 0)
GSL::ieee_env_setup()
IO.popen("gnuplot -persist", "w") do |io|
io.print("set title 'Roesller equation'\n")
io.print("set xlabel 'X'\n")
io.print("set ylabel 'Y'\n")
io.print("set zlabel 'Z'\n")
io.printf("splot '-' u 2:3:4 w l\n")
while t < tend
t, h, status = solver.apply(t, tend, h, v)
io.printf("%e %e %e %e\n", t, v[0], v[1], v[2])
break if status != GSL::SUCCESS
end
io.printf("e\n")
io.flush
end
|