leto / math--gsl

Perl interface to the GNU Scientific Library

This URL has Read+Write access

math--gsl / examples / sf / bessel
100755 19 lines (14 sloc) 0.466 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/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";