Skip to content
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

specify order of pcubature rule #24

Open
mzaffalon opened this issue Jan 19, 2017 · 2 comments
Open

specify order of pcubature rule #24

mzaffalon opened this issue Jan 19, 2017 · 2 comments

Comments

@mzaffalon
Copy link

mzaffalon commented Jan 19, 2017

pcubature gives the wrong answer when integrating sin(x)^2 in the interval [0,2π]: it should be π, it returns instead 0 (thread in discourse)

julia> pcubature(x -> sin(x[1])^2, [0.0], [2π], reltol=1e-6, abstol=1e-4)
(1.2564358174293111e-31,3.1410895435732783e-32)
julia> hcubature(x -> sin(x[1])^2, [0.0], [2π], reltol=1e-6, abstol=1e-4)
(3.1415926535897936,8.38977585329799e-9)

This is because pcubature starts with a low order rule and samples the integrand at the three points 0, π and 2π for which sin^2 is identically 0. Similarly, when the integrand is cos^2 it returns 2π because the integrand at those points is 1. (Note that hcubature gives the correct result in both cases.)

Currently there is no way of specifying a higher order rule: can this be supported?

@mzaffalon
Copy link
Author

Also related to #16.

@stevengj
Copy link
Member

Yes, but the underlying C library would need to be patched first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants