Improved Minimization subsystem tests, but it is not functional
[Math-GSL.git] / Integration.i
blob294cae864ddee506f1492546b6bd348179b91247
1 %module "Math::GSL::Integration"
2 %include "typemaps.i"
3 %include "gsl_typemaps.i"
5 %{
6 #include "gsl/gsl_integration.h"
7 %}
8 %include "gsl/gsl_integration.h"
10 %perlcode %{
11 @EXPORT_OK = qw/
12 gsl_integration_workspace_alloc
13 gsl_integration_workspace_free
14 gsl_integration_qaws_table_alloc
15 gsl_integration_qaws_table_set
16 gsl_integration_qaws_table_free
17 gsl_integration_qawo_table_alloc
18 gsl_integration_qawo_table_set
19 gsl_integration_qawo_table_set_length
20 gsl_integration_qawo_table_free
21 gsl_integration_qk15
22 gsl_integration_qk21
23 gsl_integration_qk31
24 gsl_integration_qk41
25 gsl_integration_qk51
26 gsl_integration_qk61
27 gsl_integration_qcheb
28 gsl_integration_qk
29 gsl_integration_qng
30 gsl_integration_qag
31 gsl_integration_qagi
32 gsl_integration_qagiu
33 gsl_integration_qagil
34 gsl_integration_qags
35 gsl_integration_qagp
36 gsl_integration_qawc
37 gsl_integration_qaws
38 gsl_integration_qawo
39 gsl_integration_qawf
40 $GSL_INTEG_COSINE
41 $GSL_INTEG_SINE
42 $GSL_INTEG_GAUSS15
43 $GSL_INTEG_GAUSS21
44 $GSL_INTEG_GAUSS31
45 $GSL_INTEG_GAUSS41
46 $GSL_INTEG_GAUSS51
47 $GSL_INTEG_GAUSS61
49 %EXPORT_TAGS = ( all => [ @EXPORT_OK ] );
51 __END__
53 =head1 NAME
55 Math::GSL::Integration - Routines for performing numerical integration (quadrature) of a function in one dimension
57 =head1 SYNOPSIS
59 use Math::GSL::Integration qw /:all/;
61 my $function = sub { $_[0]**2 } ;
62 my ($lower, $upper ) = (0,1);
63 my ($relerr,$abserr) = (0,1e-7);
65 my ($status, $result, $abserr, $num_evals) = gsl_integration_qng ( $function,
66 $lower, $upper, $relerr, $abserr
69 =head1 DESCRIPTION
71 Here is a list of all the functions in this module :
73 =over
75 =item * C<gsl_integration_workspace_alloc($n)>
77 This function allocates a workspace sufficient to hold $n double precision
78 intervals, their integration results and error estimates.
80 =item * C<gsl_integration_workspace_free($w)>
82 This function frees the memory associated with the workspace $w.
84 =item * C<gsl_integration_qaws_table_alloc($alpha, $beta, $mu, $nu)>
86 This function allocates space for a gsl_integration_qaws_table struct
87 describing a singular weight function W(x) with the parameters ($alpha, $beta,
88 $mu, $nu), W(x) = (x-a)^alpha (b-x)^beta log^mu (x-a) log^nu (b-x) where
89 $alpha > -1, $beta > -1, and $mu = 0, 1, $nu = 0, 1. The weight function can
90 take four different forms depending on the values of $mu and $nu,
92 W(x) = (x-a)^alpha (b-x)^beta (mu = 0, nu = 0)
93 W(x) = (x-a)^alpha (b-x)^beta log(x-a) (mu = 1, nu = 0)
94 W(x) = (x-a)^alpha (b-x)^beta log(b-x) (mu = 0, nu = 1)
95 W(x) = (x-a)^alpha (b-x)^beta log(x-a) log(b-x) (mu = 1, nu = 1)
97 The singular points (a,b) do not have to be specified until the integral is
98 computed, where they are the endpoints of the integration range. The function
99 returns a pointer to the newly allocated table gsl_integration_qaws_table if no
100 errors were detected, and 0 in the case of error.
102 =item * C<gsl_integration_qaws_table_set($t, $alpha, $beta, $mu, $nu)>
104 This function modifies the parameters ($alpha, $beta, $mu, $nu) of an existing
105 gsl_integration_qaws_table struct $t.
107 =item * C<gsl_integration_qaws_table_free($t)>
109 This function frees all the memory associated with the
110 gsl_integration_qaws_table struct $t.
112 =item * C<gsl_integration_qawo_table_alloc($omega, $L, $sine, $n)>
114 =item * C<gsl_integration_qawo_table_set($t, $omega, $L, $sine, $n)>
116 This function changes the parameters omega, L and sine of the existing
117 workspace $t.
119 =item * C<gsl_integration_qawo_table_set_length($t, $L)>
121 This function allows the length parameter $L of the workspace $t to be
122 changed.
124 =item * C<gsl_integration_qawo_table_free($t)>
126 This function frees all the memory associated with the workspace $t.
128 =item * C<gsl_integration_qk15 >
130 =item * C<gsl_integration_qk21 >
132 =item * C<gsl_integration_qk31 >
134 =item * C<gsl_integration_qk41 >
136 =item * C<gsl_integration_qk51 >
138 =item * C<gsl_integration_qk61 >
140 =item * C<gsl_integration_qcheb >
142 =item * C<gsl_integration_qk >
144 =item * C<gsl_integration_qng >
146 =item * C<gsl_integration_qag >
148 =item * C<gsl_integration_qagi >
150 =item * C<gsl_integration_qagiu >
152 =item * C<gsl_integration_qagil >
154 =item * C<gsl_integration_qags($func,$a,$b,$epsabs,$epsrel,$limit,$workspace)>
156 ($status, $result, $abserr) = gsl_integration_qags (
157 sub { 1/$_[0]} ,
158 1, 10, 0, 1e-7, 1000,
159 $workspace,
162 This function applies the Gauss-Kronrod 21-point integration rule
163 adaptively until an estimate of the integral of $func over ($a,$b) is
164 achieved within the desired absolute and relative error limits,
165 $epsabs and $epsrel.
168 =item * C<gsl_integration_qagp >
170 =item * C<gsl_integration_qawc >
172 =item * C<gsl_integration_qaws >
174 =item * C<gsl_integration_qawo >
176 =item * C<gsl_integration_qawf >
178 =back
180 This module also includes the following constants :
182 =over
184 =item * $GSL_INTEG_COSINE
186 =item * $GSL_INTEG_SINE
188 =item * $GSL_INTEG_GAUSS15
190 =item * $GSL_INTEG_GAUSS21
192 =item * $GSL_INTEG_GAUSS31
194 =item * $GSL_INTEG_GAUSS41
196 =item * $GSL_INTEG_GAUSS51
198 =item * $GSL_INTEG_GAUSS61
200 =back
202 The following error constants are part of the Math::GSL::Errno module and can
203 be returned by the gsl_integration_* functions :
205 =over
207 =item * $GSL_EMAXITER
209 Maximum number of subdivisions was exceeded.
211 =item * $GSL_EROUND
213 Cannot reach tolerance because of roundoff error, or roundoff error was detected in the extrapolation table.
215 =item * GSL_ESING
217 A non-integrable singularity or other bad integrand behavior was found in the integration interval.
219 =item * GSL_EDIVERGE
221 The integral is divergent, or too slowly convergent to be integrated numerically.
223 =back
225 =head1 MORE INFO
227 For more informations on the functions, we refer you to the GSL offcial
228 documentation: L<http://www.gnu.org/software/gsl/manual/html_node/>
230 =head1 AUTHORS
232 Jonathan Leto <jonathan@leto.net> and Thierry Moisan <thierry.moisan@gmail.com>
234 =head1 COPYRIGHT AND LICENSE
236 Copyright (C) 2008 Jonathan Leto and Thierry Moisan
238 This program is free software; you can redistribute it and/or modify it
239 under the same terms as Perl itself.
241 =cut