Derek, Chris, Thanks for your suggestions. PDL::Func did the job!
Hernán 2009/5/27 Chris Marshall <[email protected]>: >> I wonder if someone can illuminate me on >> numerical integration with PDL. I have tried >> (almost) hard with both chia (PDL::Slatec) >> and gslinteg_qng (PDL::GSL::INTEG) but got a >> bit swamped. >> >> ...<snip>... >> >> May be there is a problem because I did not >> define a certain subroutine &myfunc, but the >> fact is that I do not have a function in the >> traditional sense, but two list of values, >> one representing the independent variable and >> the other the (unknown) function values. > > Yes, that is the problem. If you look at the > GSL docs for gslinteg_qng(), the first argument > should be a function pointer and not an array > pointer. In perl, the analog to a function pointer > is a code reference. > >> Any hint will be appreciated, > > Try using the PDL online documentation seach > capability in the perldl shell. A quick apropos > search (i.e. with ??) shows a function called > integ. Help for that function is: > > perldl> help integ > Module PDL::GSL::INTERP > integ() > The integ function returns the integral of the interpolating function > between two points. By default it will barf if you try to extrapolate, > to comply silently if one of the integration limits is out of range pass > the option {Extrapolate => 1} > > Usage: > > $result = $spl->integ($a,$b,$opt); > > Example: > > my $res = $spl->integ($a,$b) > $res = $spl->integ($a,$b,{Extrapolate => 0}) #same as above > > # silently comply if $a or $b are out of range > $res = $spl->eval($a,$b,{Extrapolate => 1}) > > Docs from /usr/lib/perl5/site_perl/5.8/cygwin/PDL/GSL/INTERP.pm > >> Thanks in advance >> Hernán > > Hope this helps. --Chris > -- Hernán De Angelis Linux user # 397217 _______________________________________________ Perldl mailing list [email protected] http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
