Open itsdfish opened 3 months ago
Right, at the moment we are missing a rule for differentiation with respect to the bounds. We want to implement the Leibniz integral rule of calculus, but there are many ways to do this, i.e. whether you discretize then differentiate or vice versa (this affects whether you do an integral over the same domain or integrals over the boundaries -- I think the former is preferable but there are also arguments for the latter). Adding a rule will be straightforward, I hope, but ultimately the user will want to have control over the differentiation algorithm, so I also marked this as a feature request.
We already have a "broken" test case for this specific issue: https://github.com/SciML/Integrals.jl/blob/c2f94295d0110f85a2593c8cc03d84f8587d5f85/test/derivative_tests.jl#L124
Describe the bug π
ForwardDiff.jl differentiates through integral solver in the example below.
Expected behavior
In the example below, Integrals.jl should compute the integral without reaching the QuadGKJL algorithm. Instead, it hits the algorithm at
kronrod
where it returns a method error. Note that this example works correctly for Zygote.Minimal Reproducible Example π
Error & Stacktrace β οΈ
Environment (please complete the following information):
using Pkg; Pkg.status()
using Pkg; Pkg.status(; mode = PKGMODE_MANIFEST)
versioninfo()
Additional context
This error was discovered by @gdalle. Please ping him for technical details, as AD is not my expertise.
He notes that the issue might be a missing rule for integral bounds:
https://github.com/SciML/Integrals.jl/blob/26f0f739778b8a1256535acd14cc38c2a4e21e28/ext/IntegralsForwardDiffExt.jl#L45