File: Sum.pod

package info (click to toggle)
libmath-gsl-perl 0.45-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 192,156 kB
  • sloc: ansic: 895,524; perl: 24,682; makefile: 12
file content (109 lines) | stat: -rw-r--r-- 3,567 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
%perlcode %{
@EXPORT_OK = qw/
               gsl_sum_levin_u_alloc
               gsl_sum_levin_u_free
               gsl_sum_levin_u_accel
               gsl_sum_levin_u_minmax
               gsl_sum_levin_u_step
               gsl_sum_levin_utrunc_alloc
               gsl_sum_levin_utrunc_free
               gsl_sum_levin_utrunc_accel
               gsl_sum_levin_utrunc_minmax
               gsl_sum_levin_utrunc_step
             /;
%EXPORT_TAGS = ( all => \@EXPORT_OK );

__END__

=encoding utf8

=head1 NAME

Math::GSL::Sum - Sum series with the Levin u-transform

=head1 SYNOPSIS

    use Math::GSL::Sum qw/:all/;

    my $w = gsl_sum_levin_u_alloc(5);
    $values = [8,2,3,4,6];
    my ($status, $sum_accel, $abserr) = gsl_sum_levin_u_accel($values, 5, $w);
    gsl_sum_levin_u_free($w);

    my $w2 = gsl_sum_levin_utrunc_alloc(5);
    my ($status2, $sum_accel2, $abserr_trunc) = gsl_sum_levin_utrunc_accel($values, 5, $w2);
    gsl_sum_levin_utrunc_free($w);

=head1 DESCRIPTION

These functions accelerate the convergence of a series using the Levin u-transform.

=over

=item * gsl_sum_levin_u_alloc($n)

This function allocates a workspace for a Levin u-transform of $n terms.

=item * gsl_sum_levin_u_free($w)

- This function frees the memory associated with the workspace $w.

=item * gsl_sum_levin_u_accel($array, $array_size, $w)

This function takes the terms of a series in the array reference $array of size
$array_size and computes the extrapolated limit of the series using a Levin
u-transform. Additional working space must be provided in $w. The function
returns multiple values in this order : 0 if the operation succeeded, 1
otherwise, the extrapolated sum and an estimate of the absolute error. The
actual term-by-term sum is returned in $w->{sum_plain}. The algorithm
calculates the truncation error (the difference between two successive
extrapolations) and round-off error (propagated from the individual terms) to
choose an optimal number of terms for the extrapolation. All the terms of the
series passed in through array should be non-zero.

=item * gsl_sum_levin_u_minmax

=item * gsl_sum_levin_u_step

=item * gsl_sum_levin_utrunc_alloc($n)

This function allocates a workspace for a Levin u-transform of $n terms,
without error estimation.

=item * gsl_sum_levin_utrunc_free($w)

This function frees the memory associated with the workspace $w.

=item * gsl_sum_levin_utrunc_accel($array, $array_size, $w)

This function takes the terms of a series in the array reference $array of size
$array_size and computes the extrapolated limit of the series using a Levin
u-transform. Additional working space must be provided in $w. The function
returns multiple values in this order : 0 if the operation succeeded, 1
otherwise, the extrapolated sum and an estimate of the error. The actual
term-by-term sum is returned in $w->{sum_plain}. The algorithm terminates when
the difference between two successive extrapolations reaches a minimum or is
sufficiently small. To improve the reliability of the algorithm the
extrapolated values are replaced by moving averages when calculating the
truncation error, smoothing out any fluctuations.

=item * gsl_sum_levin_utrunc_minmax

=item * gsl_sum_levin_utrunc_step

=back

=head1 AUTHORS

Jonathan "Duke" Leto <jonathan@leto.net> and Thierry Moisan <thierry.moisan@gmail.com>

=head1 COPYRIGHT AND LICENSE

Copyright (C) 2008-2024 Jonathan "Duke" Leto and Thierry Moisan

This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.

=cut

%}