#!/usr/bin/perl -w
# Run this script in the same directory as plot_bessel.gnuplot
# i.e         cd examples/sf ; ./bessel
use strict;
use warnings;
use Math::GSL::SF qw/:bessel/;

my @x    = map { $_/ 100 } ( 0 .. 2000 ) ;
my @negx = map { -$_ } reverse @x ;

open my $fh, '>', 'bessel.data' or die $!;

for my $t (@negx, @x ) {
   print $fh join (" ", $t,  map { gsl_sf_bessel_Jn( $_, $t) } (0..5)) . "\n";
}
close $fh;

qx "gnuplot -persist plot_bessel.gnuplot";
