Sha256: dfaeab90748a3d3a861ade581dd10a45f40127a402eaa6f88b1e8b77d7021325

Contents?: true

Size: 566 Bytes

Versions: 22

Compression:

Stored size: 566 Bytes

Contents

#!/usr/bin/env ruby
require("gsl")
include Math

sint2 = GSL::Function.alloc { |t| Math::sin(Math::PI/2*t*t) }
cost2 = GSL::Function.alloc { |t| Math::cos(Math::PI/2*t*t) }
w = GSL::Integration::Workspace.alloc(1000)

t = 0
STDOUT.print("Computing... ")
STDOUT.flush
IO.popen("graph -T X -C -g 3 -X 'C(t)' -Y 'S(t)' --toggle-rotate-y-label -L 'Cornu spiral'", "w") do |io|
  t = -4
  while t < 4
    c = cost2.qag([0, t], w)[0]
    s = sint2.qag([0, t], w)[0]
    io.printf("%e %e\n", c, s)
    t += 0.01
  end
  STDOUT.print("done\n")
  STDOUT.flush
  io.flush
end

Version data entries

22 entries across 22 versions & 4 rubygems

Version Path
gsl-2.1.0.3 examples/gallery/cornu.rb
gsl-2.1.0.2 examples/gallery/cornu.rb
gsl-2.1.0.1 examples/gallery/cornu.rb
gsl-2.1.0 examples/gallery/cornu.rb
gsl-1.16.0.6 examples/gallery/cornu.rb
rb-gsl-1.16.0.5 examples/gallery/cornu.rb
rb-gsl-1.16.0.4 examples/gallery/cornu.rb
rb-gsl-1.16.0.3 examples/gallery/cornu.rb
rb-gsl-1.16.0.3.rc1 examples/gallery/cornu.rb
gsl-nmatrix-1.15.3.2 examples/gallery/cornu.rb
gsl-nmatrix-1.15.3.1 examples/gallery/cornu.rb
rb-gsl-1.16.0.2 examples/gallery/cornu.rb
rb-gsl-1.16.0.1 examples/gallery/cornu.rb
rb-gsl-1.16.0 examples/gallery/cornu.rb
rb-gsl-1.15.3.2 examples/gallery/cornu.rb
rb-gsl-1.15.3.1 examples/gallery/cornu.rb
blackwinter-gsl-1.15.3.2 examples/gallery/cornu.rb
gsl-nmatrix-1.15.3.0 examples/gallery/cornu.rb
gsl-1.15.3 examples/gallery/cornu.rb
gsl-1.14.7 examples/gallery/cornu.rb