Math::Libgsl::Series - An interface to libgsl, the Gnu Scientific Library - Series Acceleration
use Math::Libgsl::Series;
use Math::Libgsl::Series;
my Math::Libgsl::Series $s .= new: N;
constant \N = 20;
my @array := Array[Num].new;
(^N).map: -> $n { my $np1 = $n + 1e0; @array[$n] = 1e0 / ($np1 * $np1) }
my ($sum, $err) = $s.levin-accel: @array;
say "The series' sum is $sum, with an estimated error $err";
Math::Libgsl::Series is an interface to the Series Acceleration functions of libgsl, the Gnu Scientific Library.
The constructor accepts one or optionally two simple or named arguments: the mandatory series size and the optional error estimation type. This last argoment may have two values: propagation of rounding error or truncation error in the estrapolation. If the Bool :$truncation parameter is True then the error is estimated by means of the truncation error in the estrapolation. If the Bool :$truncation parameter is False then the error is estimated by means of the propagation of rounding errors.
This method computes the extrapolated limit of the series using a Levin u-transform. It returns a List: the extrapolated $sum, the estimated $error, and the number of $terms-used during the computation.
For more details on libgsl see https://www.gnu.org/software/gsl/. The excellent C Library manual is available here https://www.gnu.org/software/gsl/doc/html/index.html, or here https://www.gnu.org/software/gsl/doc/latex/gsl-ref.pdf in PDF format.
This module requires the libgsl library to be installed. Please follow the instructions below based on your platform:
sudo apt install libgsl23 libgsl-dev libgslcblas0
That command will install libgslcblas0 as well, since it's used by the GSL.
libgsl23 and libgslcblas0 have a missing symbol on Ubuntu 18.04. I solved the issue installing the Debian Buster version of those three libraries:
-
http://http.us.debian.org/debian/pool/main/g/gsl/libgslcblas0_2.5+dfsg-6_amd64.deb
-
http://http.us.debian.org/debian/pool/main/g/gsl/libgsl23_2.5+dfsg-6_amd64.deb
-
http://http.us.debian.org/debian/pool/main/g/gsl/libgsl-dev_2.5+dfsg-6_amd64.deb
To install it using zef (a module management tool):
$ zef install Math::Libgsl::Series
Fernando Santagata nando.santagata@gmail.com
Copyright 2022 Fernando Santagata
This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.