1 /* integration/gsl_integration.h
3 * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or (at
8 * your option) any later version.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 #ifndef __GSL_INTEGRATION_H__
21 #define __GSL_INTEGRATION_H__
23 #include <gsl/gsl_math.h>
28 # define __BEGIN_DECLS extern "C" {
29 # define __END_DECLS }
31 # define __BEGIN_DECLS /* empty */
32 # define __END_DECLS /* empty */
37 /* Workspace for adaptive integrators */
53 gsl_integration_workspace;
55 gsl_integration_workspace *
56 gsl_integration_workspace_alloc (const size_t n);
59 gsl_integration_workspace_free (gsl_integration_workspace * w);
62 /* Workspace for QAWS integrator */
75 gsl_integration_qaws_table;
77 gsl_integration_qaws_table *
78 gsl_integration_qaws_table_alloc (double alpha, double beta, int mu, int nu);
81 gsl_integration_qaws_table_set (gsl_integration_qaws_table * t,
82 double alpha, double beta, int mu, int nu);
85 gsl_integration_qaws_table_free (gsl_integration_qaws_table * t);
87 /* Workspace for QAWO integrator */
89 enum gsl_integration_qawo_enum { GSL_INTEG_COSINE, GSL_INTEG_SINE };
97 enum gsl_integration_qawo_enum sine;
100 gsl_integration_qawo_table;
102 gsl_integration_qawo_table *
103 gsl_integration_qawo_table_alloc (double omega, double L,
104 enum gsl_integration_qawo_enum sine,
108 gsl_integration_qawo_table_set (gsl_integration_qawo_table * t,
109 double omega, double L,
110 enum gsl_integration_qawo_enum sine);
113 gsl_integration_qawo_table_set_length (gsl_integration_qawo_table * t,
117 gsl_integration_qawo_table_free (gsl_integration_qawo_table * t);
120 /* Definition of an integration rule */
122 typedef void gsl_integration_rule (const gsl_function * f,
124 double *result, double *abserr,
125 double *defabs, double *resabs);
127 void gsl_integration_qk15 (const gsl_function * f, double a, double b,
128 double *result, double *abserr,
129 double *resabs, double *resasc);
131 void gsl_integration_qk21 (const gsl_function * f, double a, double b,
132 double *result, double *abserr,
133 double *resabs, double *resasc);
135 void gsl_integration_qk31 (const gsl_function * f, double a, double b,
136 double *result, double *abserr,
137 double *resabs, double *resasc);
139 void gsl_integration_qk41 (const gsl_function * f, double a, double b,
140 double *result, double *abserr,
141 double *resabs, double *resasc);
143 void gsl_integration_qk51 (const gsl_function * f, double a, double b,
144 double *result, double *abserr,
145 double *resabs, double *resasc);
147 void gsl_integration_qk61 (const gsl_function * f, double a, double b,
148 double *result, double *abserr,
149 double *resabs, double *resasc);
151 void gsl_integration_qcheb (gsl_function * f, double a, double b,
152 double *cheb12, double *cheb24);
154 /* The low-level integration rules in QUADPACK are identified by small
155 integers (1-6). We'll use symbolic constants to refer to them. */
159 GSL_INTEG_GAUSS15 = 1, /* 15 point Gauss-Kronrod rule */
160 GSL_INTEG_GAUSS21 = 2, /* 21 point Gauss-Kronrod rule */
161 GSL_INTEG_GAUSS31 = 3, /* 31 point Gauss-Kronrod rule */
162 GSL_INTEG_GAUSS41 = 4, /* 41 point Gauss-Kronrod rule */
163 GSL_INTEG_GAUSS51 = 5, /* 51 point Gauss-Kronrod rule */
164 GSL_INTEG_GAUSS61 = 6 /* 61 point Gauss-Kronrod rule */
168 gsl_integration_qk (const int n, const double xgk[],
169 const double wg[], const double wgk[],
170 double fv1[], double fv2[],
171 const gsl_function *f, double a, double b,
172 double * result, double * abserr,
173 double * resabs, double * resasc);
176 int gsl_integration_qng (const gsl_function * f,
178 double epsabs, double epsrel,
179 double *result, double *abserr,
182 int gsl_integration_qag (const gsl_function * f,
184 double epsabs, double epsrel, size_t limit,
186 gsl_integration_workspace * workspace,
187 double *result, double *abserr);
189 int gsl_integration_qagi (gsl_function * f,
190 double epsabs, double epsrel, size_t limit,
191 gsl_integration_workspace * workspace,
192 double *result, double *abserr);
194 int gsl_integration_qagiu (gsl_function * f,
196 double epsabs, double epsrel, size_t limit,
197 gsl_integration_workspace * workspace,
198 double *result, double *abserr);
200 int gsl_integration_qagil (gsl_function * f,
202 double epsabs, double epsrel, size_t limit,
203 gsl_integration_workspace * workspace,
204 double *result, double *abserr);
207 int gsl_integration_qags (const gsl_function * f,
209 double epsabs, double epsrel, size_t limit,
210 gsl_integration_workspace * workspace,
211 double *result, double *abserr);
213 int gsl_integration_qagp (const gsl_function * f,
214 double *pts, size_t npts,
215 double epsabs, double epsrel, size_t limit,
216 gsl_integration_workspace * workspace,
217 double *result, double *abserr);
219 int gsl_integration_qawc (gsl_function *f,
220 const double a, const double b, const double c,
221 const double epsabs, const double epsrel, const size_t limit,
222 gsl_integration_workspace * workspace,
223 double * result, double * abserr);
225 int gsl_integration_qaws (gsl_function * f,
226 const double a, const double b,
227 gsl_integration_qaws_table * t,
228 const double epsabs, const double epsrel,
230 gsl_integration_workspace * workspace,
231 double *result, double *abserr);
233 int gsl_integration_qawo (gsl_function * f,
235 const double epsabs, const double epsrel,
237 gsl_integration_workspace * workspace,
238 gsl_integration_qawo_table * wf,
239 double *result, double *abserr);
241 int gsl_integration_qawf (gsl_function * f,
245 gsl_integration_workspace * workspace,
246 gsl_integration_workspace * cycle_workspace,
247 gsl_integration_qawo_table * wf,
248 double *result, double *abserr);
252 #endif /* __GSL_INTEGRATION_H__ */