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

n = 10
x = Vector.new(n)
y = Vector.new(n)
for i in 0...n do
  a = i.to_f
  x[i] = i + 0.5*sin(a)
  y[i] = i + cos(a*a)
end

spline = Spline.new(Interp::CSPLINE, n)
spline.init(x, y)

xi = x[0]
while xi < x[9]
  yi = spline.eval(xi)
  printf("%e %e\n", xi, yi)
  xi += 0.01
end
