gsl_integration__qk41.c 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /* integration/qk41.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[21] = /* abscissae of the 41-point kronrod rule */
  25. {
  26. 0.998859031588277663838315576545863,
  27. 0.993128599185094924786122388471320,
  28. 0.981507877450250259193342994720217,
  29. 0.963971927277913791267666131197277,
  30. 0.940822633831754753519982722212443,
  31. 0.912234428251325905867752441203298,
  32. 0.878276811252281976077442995113078,
  33. 0.839116971822218823394529061701521,
  34. 0.795041428837551198350638833272788,
  35. 0.746331906460150792614305070355642,
  36. 0.693237656334751384805490711845932,
  37. 0.636053680726515025452836696226286,
  38. 0.575140446819710315342946036586425,
  39. 0.510867001950827098004364050955251,
  40. 0.443593175238725103199992213492640,
  41. 0.373706088715419560672548177024927,
  42. 0.301627868114913004320555356858592,
  43. 0.227785851141645078080496195368575,
  44. 0.152605465240922675505220241022678,
  45. 0.076526521133497333754640409398838,
  46. 0.000000000000000000000000000000000
  47. };
  48. /* xgk[1], xgk[3], ... abscissae of the 20-point gauss rule.
  49. xgk[0], xgk[2], ... abscissae to optimally extend the 20-point gauss rule */
  50. static const double wg[11] = /* weights of the 20-point gauss rule */
  51. {
  52. 0.017614007139152118311861962351853,
  53. 0.040601429800386941331039952274932,
  54. 0.062672048334109063569506535187042,
  55. 0.083276741576704748724758143222046,
  56. 0.101930119817240435036750135480350,
  57. 0.118194531961518417312377377711382,
  58. 0.131688638449176626898494499748163,
  59. 0.142096109318382051329298325067165,
  60. 0.149172986472603746787828737001969,
  61. 0.152753387130725850698084331955098
  62. };
  63. static const double wgk[21] = /* weights of the 41-point kronrod rule */
  64. {
  65. 0.003073583718520531501218293246031,
  66. 0.008600269855642942198661787950102,
  67. 0.014626169256971252983787960308868,
  68. 0.020388373461266523598010231432755,
  69. 0.025882133604951158834505067096153,
  70. 0.031287306777032798958543119323801,
  71. 0.036600169758200798030557240707211,
  72. 0.041668873327973686263788305936895,
  73. 0.046434821867497674720231880926108,
  74. 0.050944573923728691932707670050345,
  75. 0.055195105348285994744832372419777,
  76. 0.059111400880639572374967220648594,
  77. 0.062653237554781168025870122174255,
  78. 0.065834597133618422111563556969398,
  79. 0.068648672928521619345623411885368,
  80. 0.071054423553444068305790361723210,
  81. 0.073030690332786667495189417658913,
  82. 0.074582875400499188986581418362488,
  83. 0.075704497684556674659542775376617,
  84. 0.076377867672080736705502835038061,
  85. 0.076600711917999656445049901530102
  86. };
  87. void
  88. gsl_integration_qk41 (const gsl_function * f, double a, double b,
  89. double *result, double *abserr,
  90. double *resabs, double *resasc)
  91. {
  92. double fv1[21], fv2[21];
  93. gsl_integration_qk (21, xgk, wg, wgk, fv1, fv2, f, a, b, result, abserr, resabs, resasc);
  94. }