#!/usr/bin/env ruby
require("gsl")
include GSL::Sf

l = 2
x = -1.0
file = File.open("leg2.dat", "w")
while x <= 1.0
  a = legendre_sphPlm(l, 0, x)
  b = legendre_sphPlm(l, 1, x)
  c = legendre_sphPlm(l, 2, x)
  file.printf("%e %e %e %e\n", x, a, b, c)
  x += 0.1
end
file.close

system("gnuplot -persist leg2.gp")
File.delete("leg2.dat")
