1 %module
"Math::GSL::Integration"
3 %include
"gsl_typemaps.i"
6 #include
"gsl/gsl_integration.h"
8 %include
"gsl/gsl_integration.h"
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
49 %EXPORT_TAGS
= ( all
=> [ @EXPORT_OK
] );
55 Math
::GSL
::Integration
- Routines for performing numerical integration
(quadrature
) of a function in one dimension
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
71 Here is a list of all the functions in this module
:
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
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
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
(
158 1, 10, 0, 1e-7, 1000,
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
,
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
>
180 This module also includes the following constants
:
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
202 The following error constants are part of the Math
::GSL
::Errno module and can
203 be returned by the gsl_integration_
* functions
:
207 =item
* $GSL_EMAXITER
209 Maximum number of subdivisions was exceeded.
213 Cannot reach tolerance because of roundoff error
, or roundoff error was detected in the extrapolation table.
217 A non-integrable singularity or other bad integrand behavior was found in the integration interval.
221 The integral is divergent
, or too slowly convergent to be integrated numerically.
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
/>
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.