JuliaMath / JuliaMath/Cubature.jl

hcubature does not converge on discontinuous functions

Open
#35 14 comments 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
133
Forks
20
PR merge metrics
No merged PRs in 30d

Description

As discussed in https://github.com/giordano/Cuba.jl/issues/16, hcubature seems to fail for a discontinuous integrand (see MWE there). The integrand is the indicator function of a polygon, so a Riemann sum with NxN points should be accurate to 1/N, and the integral should be about 0.88408, with a small error on the last digit. When running Cuba vs Cubature for decreasing values of abstol (reltol and maxiters are fixed at 0), I get:

0.8840847072116771 ± 9.995513758054815e-5 (Cuba.jl)
0.8848895327256797 ± 9.998142861595564e-5 (Cubature.jl)

0.8840898028407925 ± 9.998969682594401e-6 (Cuba.jl)
0.8848941514595511 ± 9.999535960807015e-6 (Cubature.jl)

0.8840867311005485 ± 9.99974855348049e-7 (Cuba.jl)
0.8848940796576487 ± 9.999981972972212e-7 (Cubature.jl)

0.8840865507480177 ± 9.999859751764881e-8 (Cuba.jl)
0.8848940808860499 ± 9.999994401879008e-8 (Cubature.jl)

So Cuba looks about right, but Cubature appears to fail in that case.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.