goodluckmich
MIS
I'm trying to use Eric Boesch's library, Math::Integral::Romberg, for the integral of a Gaussian distribution from 0 to 1. However I have some problems about "a reference to the function to be integrated". In my code, I wrote
$area=integral(\&func, 0, 1);
to do the integration, which is suggested in the synopsis. To define my function (I start with a simple one), I wrote
sub func
{
my $x;
$x*2+5;
}
, which was intended to be f(x)=2x+5.
However, the integral results are not correct. Any ideas? Really need your help ... Could anyone please give me a Perl script example about how to write this function?
Thanks so much for your help.
$area=integral(\&func, 0, 1);
to do the integration, which is suggested in the synopsis. To define my function (I start with a simple one), I wrote
sub func
{
my $x;
$x*2+5;
}
, which was intended to be f(x)=2x+5.
However, the integral results are not correct. Any ideas? Really need your help ... Could anyone please give me a Perl script example about how to write this function?
Thanks so much for your help.