Comments (9)
You need to do solve(prob,QuadGKJL(),reltol=1e-3,abstol=1e-3).u
. But it's having an issue that the domain transformation is increasing nout
? @agerlach is that supposed to happen?
from integrals.jl.
I'll take a look at it. May not be until tomorrow though.
from integrals.jl.
But it's having an issue that the domain transformation is increasing nout? @agerlach is that supposed to happen?
Yes. B/c the gradient is computed as the integral of the vector of partials. Here length(p)=2
, so nout
gets changed to 2. QuadGKJL()
does not support vector valued integrands. So, @frank-ccc if you swap out QuadGKJL()
for any of the other methods it will work as expected, e.q.
function testf(lb,ub,p)
prob = QuadratureProblem(f,lb,ub,p)
solve(prob,QuadGKJL(),reltol=1e-3,abstol=1e-3)[1]
end
function testf2(lb,ub,p)
prob = QuadratureProblem(f,lb,ub,p)
solve(prob,CubatureJLh(),reltol=1e-3,abstol=1e-3)[1]
end
dp1 = Zygote.gradient(p->testf(lb,ub,p),p)[1]
dp2 = Zygote.gradient(p->testf2(lb,ub,p),p)[1]
from integrals.jl.
Oh hmm, it would be good to find an informative error message here, or break it apart on QuadGK
from integrals.jl.
@ChrisRackauckas @agerlach thanks a lot to help resolve this. I am actually trying to solve a Fredholm problem with differential programming. May I contact you separately if have questions?
from integrals.jl.
Yeah sure
from integrals.jl.
@ChrisRackauckas It appears this issue was fixed by #189 since we no longer use nout
as a check on QuadGKJL
. The following translation of the mwe is working for me
using Integrals, Cuba, Cubature, Zygote, FiniteDiff, ForwardDiff
using Test
f(y,p) = sum(sin.(p[1].*y) + p[2])
lb = 1.0
ub = 3.0
p = [2.0,1.0]
prob = IntegralProblem(f,lb,ub,p)
sol = solve(prob,QuadGKJL(),reltol=1e-3,abstol=1e-3)
function testf(lb,ub,p)
prob = IntegralProblem(f,lb,ub,p)
solve(prob,QuadGKJL(),reltol=1e-3,abstol=1e-3).u
end
function testf2(lb,ub,p)
prob = IntegralProblem(f,lb,ub,p)
solve(prob,CubatureJLh(),reltol=1e-3,abstol=1e-3).u
end
dlb1,dub1,dp1 = Zygote.gradient(testf,lb,ub,p)
dlb2,dub2,dp2 = Zygote.gradient(testf2,lb,ub,p)
@test dlb1 โ dlb2
@test dub1 โ dub2
@test dp1 โ dp2
I will follow up on this with a pr to run the existing AD tests on all the compatible algorithms, which would be helpful at catching edge cases.
from integrals.jl.
Awesome, really nice job on that update PR. Seems like it fixed most issues ๐
from integrals.jl.
Can confirm that this is fixed by #189 and will close now that we have #196 for better testing
from integrals.jl.
Related Issues (20)
- It would be nice to have a `progress` keyword for time estimation HOT 7
- Improve docstrings
- Inconsistent IntegralsCubature Interface
- Example from the first tutorial is broken HOT 5
- Interface error for VEGAS from [email protected]
- Warp MCIntegration.jl
- Issue when Nesting Integrals without Explicit Floats
- Factor out MonteCarloIntegration.jl into extension package HOT 2
- BoundsError: attempt to access Float64 at index [2] when `pi` is passed as limit HOT 1
- Add tests
- Missing documentation for IntegralFunction and BatchIntegralFunction HOT 3
- HCubature does not work with ODESolution produced by some ODE solvers HOT 6
- Unhelpful error message when not importing the correct packages HOT 3
- nout > 1 for QuadGK HOT 1
- Use `alg` in `build_solution` rather than constructing a new algorithm HOT 1
- `IntegralProblem` keywords not passed to solvers
- Gauss-Turรกn Quadratures HOT 8
- Strange instalation or upgrade error HOT 2
- Integrating a vector valued out-of-place integrand returns a scalar HOT 3
- ForwardDiff differentiates through solver HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from integrals.jl.