{"id":18847784,"url":"https://github.com/jacobwilliams/quadpack","last_synced_at":"2026-01-26T02:31:54.513Z","repository":{"id":38084639,"uuid":"435741745","full_name":"jacobwilliams/quadpack","owner":"jacobwilliams","description":"Modern Fortran QUADPACK Library for 1D numerical quadrature","archived":false,"fork":false,"pushed_at":"2024-01-27T15:42:22.000Z","size":5259,"stargazers_count":71,"open_issues_count":9,"forks_count":9,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-05-23T00:33:45.967Z","etag":null,"topics":["fortran","fortran-package-manager","gauss-kronrod","gauss-kronrod-quadrature","numerical-integration","quadpack","quadrature","quadrature-integration","slatec"],"latest_commit_sha":null,"homepage":"","language":"Fortran","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jacobwilliams.png","metadata":{"files":{"readme":"README.md","changelog":"changes","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-12-07T04:26:01.000Z","updated_at":"2025-05-22T06:37:25.000Z","dependencies_parsed_at":"2025-02-20T05:39:44.301Z","dependency_job_id":null,"html_url":"https://github.com/jacobwilliams/quadpack","commit_stats":{"total_commits":156,"total_committers":3,"mean_commits":52.0,"dds":"0.012820512820512775","last_synced_commit":"3e10baeb0ec054fcce4a88e0d05a339da602defc"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/jacobwilliams/quadpack","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jacobwilliams%2Fquadpack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jacobwilliams%2Fquadpack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jacobwilliams%2Fquadpack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jacobwilliams%2Fquadpack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jacobwilliams","download_url":"https://codeload.github.com/jacobwilliams/quadpack/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jacobwilliams%2Fquadpack/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28765038,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-26T02:25:41.078Z","status":"ssl_error","status_checked_at":"2026-01-26T02:24:28.809Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fortran","fortran-package-manager","gauss-kronrod","gauss-kronrod-quadrature","numerical-integration","quadpack","quadrature","quadrature-integration","slatec"],"created_at":"2024-11-08T03:09:38.556Z","updated_at":"2026-01-26T02:31:54.495Z","avatar_url":"https://github.com/jacobwilliams.png","language":"Fortran","funding_links":[],"categories":[],"sub_categories":[],"readme":"![quadpack2](media/logo.png)\n============\n\n[![Language](https://img.shields.io/badge/-Fortran-734f96?logo=fortran\u0026logoColor=white)](https://github.com/topics/fortran)\n[![GitHub release](https://img.shields.io/github/release/jacobwilliams/quadpack.svg)](https://github.com/jacobwilliams/quadpack/releases/latest)\n[![Build Status](https://github.com/jacobwilliams/quadpack/actions/workflows/CI.yml/badge.svg)](https://github.com/jacobwilliams/quadpack/actions)\n[![codecov](https://codecov.io/gh/jacobwilliams/quadpack/branch/master/graph/badge.svg)](https://codecov.io/gh/jacobwilliams/quadpack)\n[![last-commit](https://img.shields.io/github/last-commit/jacobwilliams/quadpack)](https://github.com/jacobwilliams/quadpack/commits/master)\n\n### Description\n\nQUADPACK is a Fortran library for the numerical\ncomputation of definite one-dimensional integrals (numerical quadrature). Development of this library, which had ceased in the 1980s, has been restarted. The original code is being modernized, and new methods are being added.  The goal is a comprehensive and modern Fortran library that includes both classic and state-of-the-art methods for numerical integration.\n\n### Overview\n\nThe original QUADPACK code (written in the early 1980s) has been extensively refactored:\n\n* It has been converted from FORTRAN 77 fixed form to modern free form syntax. This includes elimination of all GOTOs and other obsolescent language features.\n* It is now a single stand-alone module, and has no dependencies on any other code from SLATEC or LINPACK.\n* The SLATEC docstrings have been converted to [Ford](https://github.com/Fortran-FOSS-Programmers/ford) style, which allows for auto-generation of the [API docs](https://jacobwilliams.github.io/quadpack/).\n* Some typos have been corrected in the comments.\n* General code cleanup and formatting.\n* Added automated unit testing in GitHub CI.\n* The separate routines for single and double precision versions have been eliminated. The library now exports a single (`real32`), double (`real64`) and quadruple (`real128`) precision interface using the same code by employing a preprocessor scheme.\n* New procedures not present in the original QUADPACK have been added.\n* The coefficients have been regenerated with full quadruple precision. *(Note: this has not yet been done for all the coefficients in **DQNG**)*\n* Some bugs have been fixed in the original code. Note that this version includes the recent (Oct 2021) updates (see [here](https://github.com/scipy/scipy/issues/14807) and [here](https://github.com/scipy/scipy/pull/14836)) reported by the Scipy project.\n\n### To do list\n\n - [ ] Additional docstring cleanups.\n - [ ] Add more unit tests.\n - [ ] In the unit tests, the \"truth\" values for the cases without analytical solutions need to be regenerated with some more precision so we have the exact results for the quad precision test.\n\n### Compiling\n\nA [Fortran Package Manager](https://github.com/fortran-lang/fpm) manifest file is included, so that the library and test cases can be compiled with FPM. For example:\n\n```\nfpm build --profile release\nfpm test --profile release\n```\n\nTo use `quadpack` within your fpm project, add the following to your `fpm.toml` file:\n```toml\n[dependencies]\nquadpack = { git=\"https://github.com/jacobwilliams/quadpack.git\" }\n```\n\nOr, to use a specific version:\n\n```toml\n[dependencies]\nquadpack = { git=\"https://github.com/jacobwilliams/quadpack.git\", tag = \"2.1.0\" }\n```\n\n### Example\n\nA simple example is given here (see the `test` folder for more examples):\n\n```fortran\nsubroutine test_qag\n  use quadpack, only: dqag\n  use iso_fortran_env, only: wp =\u003e real64 ! double precision\n  implicit none\n\n  real(wp), parameter :: a = 0.0_wp\n  real(wp), parameter :: b = 1.0_wp\n  integer, parameter :: key = 6\n  integer, parameter :: limit = 100\n  integer, parameter :: lenw = limit*4\n  real(wp), parameter :: answer = 2.0_wp/sqrt(3.0_wp)\n\n  real(wp) :: abserr, result, work(lenw)\n  integer :: ier, iwork(limit), last, neval\n\n  call dqag(f, a, b, epsabs, epsrel, key, result, \u0026\n            abserr, neval, ier, limit, lenw, last, \u0026\n            iwork, work)\n\n  write(*,'(1P,A,1X,*(E13.6,1X))') \u0026\n        'result, error = ', result, abs(result-answer)\n\ncontains\n\n  real(wp) function f(x)\n    implicit none\n    real(wp), intent(in) :: x\n    real(wp), parameter :: pi = acos(-1.0_wp)\n    f = 2.0_wp/(2.0_wp + sin(10.0_wp*pi*x))\n  end function f\n\nend subroutine test_qag\n```\n\nWhich outputs:\n\n```text\n result, error = 1.154701E+00 2.220446E-16\n```\n\n### Survey of procedures\n\nThe following list gives an overview of the QUADPACK integrators.\nThe routine names for the double precision versions are preceded\nby the letter `D`, and the quadruple precision versions are preceded by `Q`.\n\n- **QNG**  : Is a simple non-adaptive automatic integrator, based on\n         a sequence of rules with increasing degree of algebraic\n         precision ([Patterson, 1968](https://www.ams.org/journals/mcom/1968-22-104/S0025-5718-68-99866-9/S0025-5718-68-99866-9.pdf)).\n\n- **QAG**  : Is a simple globally adaptive integrator using the\n         strategy of Aind (Piessens, 1973). It is possible to\n         choose between 6 pairs of Gauss-Kronrod quadrature\n         formulae for the rule evaluation component. The pairs\n         of high degree of precision are suitable for handling\n         integration difficulties due to a strongly oscillating\n         integrand.\n\n- **QAGS** : Is an integrator based on globally adaptive interval\n         subdivision in connection with extrapolation ([de Doncker,\n         1978](https://dl.acm.org/doi/10.1145/1053402.1053403)) by the Epsilon algorithm ([Wynn, 1956](https://www.jstor.org/stable/2002183)).\n\n- **QAGP** : Serves the same purposes as QAGS, but also allows\n         for eventual user-supplied information, i.e. the\n         abscissae of internal singularities, discontinuities\n         and other difficulties of the integrand function.\n         The algorithm is a modification of that in QAGS.\n\n- **QAGI** : Handles integration over infinite intervals. The\n         infinite range is mapped onto a finite interval and\n         then the same strategy as in QAGS is applied.\n\n- **QAWO** : Is a routine for the integration of `COS(OMEGA*X)*F(X)`\n         or `SIN(OMEGA*X)*F(X)` over a finite interval `(A,B)`.\n         `OMEGA` is is specified by the user\n         The rule evaluation component is based on the\n         modified Clenshaw-Curtis technique.\n         An adaptive subdivision scheme is used connected with\n         an extrapolation procedure, which is a modification\n         of that in QAGS and provides the possibility to deal\n         even with singularities in F.\n\n- **QAWF** : Calculates the Fourier cosine or Fourier sine\n         transform of `F(X)`, for user-supplied interval `(A,INFINITY)`, `OMEGA`, and `F`. The procedure of QAWO is\n         used on successive finite intervals, and convergence\n         acceleration by means of the Epsilon algorithm ([Wynn,\n         1956](https://www.jstor.org/stable/2002183)) is applied to the series of the integral\n         contributions.\n\n- **QAWS** : Integrates `W(X)*F(X)` over `(A,B)` with `A\u003cB` finite,\n         and   `W(X) = ((X-A)**ALFA)*((B-X)**BETA)*V(X)`\n         where `V(X) = 1 or LOG(X-A) or LOG(B-X)`\n                        or `LOG(X-A)*LOG(B-X)`\n         and   `ALFA\u003e(-1), BETA\u003e(-1)`.\n         The user specifies `A`, `B`, `ALFA`, `BETA` and the type of\n         the function `V`.\n         A globally adaptive subdivision strategy is applied,\n         with modified Clenshaw-Curtis integration on the\n         subintervals which contain `A` or `B`.\n\n- **QAWC** : Computes the Cauchy Principal Value of `F(X)/(X-C)`\n         over a finite interval `(A,B)` and for\n         user-determined `C`.\n         The strategy is globally adaptive, and modified\n         Clenshaw-Curtis integration is used on the subranges\n         which contain the point `X = C`.\n\n   Each of the routines above also has a \"more detailed\" version\nwith a name ending in E, as QAGE.  These provide more\ninformation and control than the easier versions.\n\n   The preceding routines are all automatic.  That is, the user\ninputs his problem and an error tolerance.  The routine\nattempts to perform the integration to within the requested\nabsolute or relative error.\n   There are, in addition, a number of non-automatic integrators.\nThese are most useful when the problem is such that the\nuser knows that a fixed rule will provide the accuracy\nrequired.  Typically they return an error estimate but make\nno attempt to satisfy any particular input error request.\n\n  * **QK15**, **QK21**, **QK31**, **QK41**, **QK51**, **QK61**:\n       Estimate the integral on [a,b] using 15, 21,..., 61\n       point rule and return an error estimate.\n  * **QK15I**: 15 point rule for (semi)infinite interval.\n  * **QK15W**: 15 point rule for special singular weight functions.\n  * **QC25C**: 25 point rule for Cauchy Principal Values\n  * **QC25F**: 25 point rule for sin/cos integrand.\n  * **QMOMO**: Integrates k-th degree Chebyshev polynomial times\n        function with various explicit singularities.\n\n### Other procedures\n\nThe following procedures were not in the original QUADPACK, but are included in the new library:\n\n- **QUAD** : The result is obtained using a sequence of 1, 3, 7, 15, 31, 63, 127, and 255 point interlacing formulae. The formulae are based on the optimal extension of the 3-point gauss formula. See: [Patterson, 1968](https://www.ams.org/journals/mcom/1968-22-104/S0025-5718-68-99866-9/S0025-5718-68-99866-9.pdf). See also **QNG**. This code is based on QUAD from [NSWC Mathematical Library](https://github.com/jacobwilliams/nswc), with the addition of full quadruple-precision coefficients.\n\n- **AVINT** : Integrates a function tabulated at arbitrarily spaced abscissas using overlapping parabolas. This procedure was originally from [SLATEC](http://www.netlib.org/slatec/src/davint.f).\n\n- **QNC79** :  Integrate a function over a finite interval using a 7-point adaptive Newton-Cotes quadrature rule. This procedure was originally from [SLATEC](http://www.netlib.org/slatec/src/dqnc79.f).\n\n- **GAUSS8** : Integrate a function over a finite interval using an adaptive 8-point Legendre-Gauss algorithm. This procedure was originally from [SLATEC](http://www.netlib.org/slatec/src/dgauss8.f).\n\n- **SIMPSON** : Integrate a function over a finite interval using an adaptive Simpson rule. See: [Gander \u0026 Gautschi, 2000](https://www.researchgate.net/publication/226706221_Adaptive_Quadrature-Revisited).\n\n- **LOBATTO** : Integrate a function over a finite interval using an adaptive Lobatto rule. See: [Gander \u0026 Gautschi, 2000](https://www.researchgate.net/publication/226706221_Adaptive_Quadrature-Revisited).\n\n### Guidelines for the use of QUADPACK\n\nHere it is not our purpose to investigate the question when\nautomatic quadrature should be used. We shall rather attempt\nto help the user who already made the decision to use QUADPACK,\nwith selecting an appropriate routine or a combination of\nseveral routines for handling his problem.\n\nFor both quadrature over finite and over infinite intervals,\none of the first questions to be answered by the user is\nrelated to the amount of computer time he wants to spend,\nversus his -own- time which would be needed, for example, for\nmanual subdivision of the interval or other analytic\nmanipulations.\n\n1.  The user may not care about computer time, or not be\nwilling to do any analysis of the problem. especially when\nonly one or a few integrals must be calculated, this attitude\ncan be perfectly reasonable. In this case it is clear that\neither the most sophisticated of the routines for finite\nintervals, QAGS, must be used, or its analogue for infinite\nintervals, GAGI. These routines are able to cope with\nrather difficult, even with improper integrals.\nThis way of proceeding may be expensive. But the integrator\nis supposed to give you an answer in return, with additional\ninformation in the case of a failure, through its error\nestimate and flag. Yet it must be stressed that the programs\ncannot be totally reliable.\n\n2. The user may want to examine the integrand function.\nIf bad local difficulties occur, such as a discontinuity, a\nsingularity, derivative singularity or high peak at one or\nmore points within the interval, the first advice is to\nsplit up the interval at these points. The integrand must\nthen be examined over each of the subintervals separately,\nso that a suitable integrator can be selected for each of\nthem. If this yields problems involving relative accuracies\nto be imposed on -finite- subintervals, one can make use of\nQAGP, which must be provided with the positions of the local\ndifficulties. However, if strong singularities are present\nand a high accuracy is requested, application of QAGS on the\nsubintervals may yield a better result.\n\nFor quadrature over finite intervals we thus dispose of QAGS\nand\n- QNG for well-behaved integrands,\n- QAG for functions with an oscillating behaviour of a non\n    specific type,\n- QAWO for functions, eventually singular, containing a\n    factor `COS(OMEGA*X)` or `SIN(OMEGA*X)` where OMEGA is known,\n- QAWS for integrands with Algebraico-Logarithmic end point\n    singularities of known type,\n- QAWC for Cauchy Principal Values.\n\n### Remark\n\nOn return, the work arrays in the argument lists of the\nadaptive integrators contain information about the interval\nsubdivision process and hence about the integrand behaviour:\nthe end points of the subintervals, the local integral\ncontributions and error estimates, and eventually other\ncharacteristics. For this reason, and because of its simple\nglobally adaptive nature, the routine QAG in particular is\nwell-suited for integrand examination. Difficult spots can\nbe located by investigating the error estimates on the\nsubintervals.\n\nFor infinite intervals we provide only one general-purpose\nroutine, QAGI. It is based on the QAGS algorithm applied\nafter a transformation of the original interval into (0,1).\nYet it may eventuate that another type of transformation is\nmore appropriate, or one might prefer to break up the\noriginal interval and use QAGI only on the infinite part\nand so on. These kinds of actions suggest a combined use of\ndifferent QUADPACK integrators. Note that, when the only\ndifficulty is an integrand singularity at the finite\nintegration limit, it will in general not be necessary to\nbreak up the interval, as QAGI deals with several types of\nsingularity at the boundary point of the integration range.\nIt also handles slowly convergent improper integrals, on\nthe condition that the integrand does not oscillate over\nthe entire infinite interval. If it does we would advise\nto sum succeeding positive and negative contributions to\nthe integral -e.g. integrate between the zeros- with one\nor more of the finite-range integrators, and apply\nconvergence acceleration eventually by means of QUADPACK\nsubroutine QELG which implements the Epsilon algorithm.\nSuch quadrature problems include the Fourier transform as\na special case. Yet for the latter we have an automatic\nintegrator available, QAWF.\n\n### Documentation\n\nThe API documentation for the current `master` branch can be found [here](https://jacobwilliams.github.io/quadpack/).  This is generated by processing the source files with [FORD](https://github.com/Fortran-FOSS-Programmers/ford). Note that the procedures listed in the API documentation are the double precision version (`DQNG`, etc.)\n\n### License\n\nThe original Quadpack was a public domain work of the United States government. The modifications are released under a permissive (BSD-3) license.\n\n### References\n\n  * R. Piessens, E. deDoncker-Kapenga, C. Uberhuber, D. Kahaner\n    [Quadpack: a Subroutine Package for Automatic Integration](https://link.springer.com/book/10.1007/978-3-642-61786-7)\n    Springer Verlag, 1983. Series in Computational Mathematics v.1\n    515.43/Q1S 100394Z\n  * Paola Favati, Grazia Lotti, Francesco Romani, [Algorithm 691: Improving QUADPACK automatic integration routines](https://dl.acm.org/doi/abs/10.1145/108556.108580), ACM Transactions on Mathematical Software, Volume 17, Issue 2, June 1991, pp 218-232.\n  * Original SLATEC code from [Netlib](http://www.netlib.org/quadpack/). Last modified 11 Oct 2021.\n  * W. Gander and W. Gautschi, \"[Adaptive Quadrature - Revisited](https://www.researchgate.net/publication/226706221_Adaptive_Quadrature-Revisited)\", BIT Vol. 40, No. 1, March 2000, pp. 84--101.\n\n### Other versions\n\nThere are other versions of Quadpack out there. There is at least one project to provide module interface to the unmodified Fortran 77 code (see [nshaffer/modern_quadpack](https://github.com/nshaffer/modern_quadpack)). The license for these are not specified.  Another fixed to free conversion can be found at [John Burkardt's site](https://people.math.sc.edu/Burkardt/f_src/quadpack_double/quadpack_double.f90) (this is not an aggressive modernization though and also has an LGPL license). Also note that the Quadpack code in [SLATEC](http://www.netlib.org/slatec/src/) is slightly modified from the stand-alone one at [Netlib](http://www.netlib.org/quadpack/). It is not known if these modifications were anything significant.\n\n### See also\n\n * [quadrature-fortran](https://github.com/jacobwilliams/quadrature-fortran)\n\n### Keywords\n  * survey of integrators, guidelines for selection,\n    quadpack, automatic integrator, general-purpose,\n    integrand examinator, globally adaptive,\n    gauss-kronrod, infinite intervals, transformation,\n    extrapolation, singularities at user specified points,\n    (end-point) singularities, cauchy principal value,\n    clenshaw-curtis method, special-purpose, fourier integral,\n    integration between zeros, convergence acceleration,\n    integrand with oscillatory cos or sin factor,\n    (end point) singularities, 25-point clenshaw-curtis integration,\n    smooth integrand, non-adaptive, gauss-kronrod (patterson),\n    epsilon algorithm, algebraico-logarithmic end point singularities,\n    chebyshev series expansion, fast fourier transform\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjacobwilliams%2Fquadpack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjacobwilliams%2Fquadpack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjacobwilliams%2Fquadpack/lists"}