-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RFC: quadgk integration routine #3140
Conversation
Update: |
Phenomenal. Since this is new functionality, I'm in favor of just merging it. The only question to me is if we should have this in base or a package. |
@stevengj How come you wrote the Cubature routines as a package? Would it best to have one place for all the numerical integration routines? I do not have a view one way or another, but just wanted to know. People are used to having some quadrature routines in the base library due to Matlab's inclusion of various |
@ViralBShah, the Cubature.jl package is GPL, presumably because the C library it depends on is GPL. (Since @stevengj wrote both, he may have the ability to change the license on both, but perhaps he doesn't want to, or can't because the C library includes code copyrighted by others.) |
I don't have the ability to change the license of the Cubature package, since it uses some code from other GPL projects. In any case, it seemed good to have a native Julia implementation of at least 1d quadrature, so that it can handle arbitrary numeric types, including (Integration is such an important task, and there are so many different algorithms for different types of problems, that it seems both inevitable and desirable that we eventually have multiple external packages as well. e.g. it would be nice to have a package wrapping the (GPL) Cuba library, too. We already have the GSL package to wrap the GSL routines, too.) |
Regarding Matlab's various |
Thanks for the explanation. Please merge when ready. |
RFC: quadgk integration routine
Changes Unknown when pulling 949421f on stevengj:quadgk into * on JuliaLang:master*. |
Hah what the heck, why/how did Coveralls just run |
Clicking on the link, that doesn't appear to be our repository? API key collision? |
Hmmm, yeah, that's pretty bad. We should let somebody know about that. |
This patch adds a new routine
quadgk
(inspired by the Matlab quadgk function) to Julia:which performs adaptive 1d Gauss-Kronrod integration (addressing issue #1235), returning an estimated integral
I
and errorE
.For example,
quadgk(cos, 0,1)
integratescos
from 0 to 1, returningsin(1)
. Complex-valued functions and complex endpoints (contour integration) are also supported, as is arbitrary-precision arithmetic. e.g.quadgk(cos, 0, BigFloat(1), order=40)
integratescos
usingBigFloat
arithmetic, with a higher-order rule to get exponential accuracy.The code is all written from scratch by me, with the most complicated routine being the
kronrod
function to compute Kronrod points and weights; I implemented this from a pseudo-code description in a well-known 1997 paper by Laurie.