gsl_integration__qk15.c 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /* integration/qk15.c
  2. *
  3. * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough
  4. *
  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.
  9. *
  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.
  14. *
  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.
  18. */
  19. #include "gsl__config.h"
  20. #include "gsl_integration.h"
  21. /* Gauss quadrature weights and kronrod quadrature abscissae and
  22. weights as evaluated with 80 decimal digit arithmetic by
  23. L. W. Fullerton, Bell Labs, Nov. 1981. */
  24. static const double xgk[8] = /* abscissae of the 15-point kronrod rule */
  25. {
  26. 0.991455371120812639206854697526329,
  27. 0.949107912342758524526189684047851,
  28. 0.864864423359769072789712788640926,
  29. 0.741531185599394439863864773280788,
  30. 0.586087235467691130294144838258730,
  31. 0.405845151377397166906606412076961,
  32. 0.207784955007898467600689403773245,
  33. 0.000000000000000000000000000000000
  34. };
  35. /* xgk[1], xgk[3], ... abscissae of the 7-point gauss rule.
  36. xgk[0], xgk[2], ... abscissae to optimally extend the 7-point gauss rule */
  37. static const double wg[4] = /* weights of the 7-point gauss rule */
  38. {
  39. 0.129484966168869693270611432679082,
  40. 0.279705391489276667901467771423780,
  41. 0.381830050505118944950369775488975,
  42. 0.417959183673469387755102040816327
  43. };
  44. static const double wgk[8] = /* weights of the 15-point kronrod rule */
  45. {
  46. 0.022935322010529224963732008058970,
  47. 0.063092092629978553290700663189204,
  48. 0.104790010322250183839876322541518,
  49. 0.140653259715525918745189590510238,
  50. 0.169004726639267902826583426598550,
  51. 0.190350578064785409913256402421014,
  52. 0.204432940075298892414161999234649,
  53. 0.209482141084727828012999174891714
  54. };
  55. void
  56. gsl_integration_qk15 (const gsl_function * f, double a, double b,
  57. double *result, double *abserr,
  58. double *resabs, double *resasc)
  59. {
  60. double fv1[8], fv2[8];
  61. gsl_integration_qk (8, xgk, wg, wgk, fv1, fv2, f, a, b, result, abserr, resabs, resasc);
  62. }