Giter VIP home page Giter VIP logo

Comments (10)

rseydam avatar rseydam commented on August 22, 2024 2

Thanks for the suggestion. I have tried it in the following way:

T  = promote_type(typeof(lb),typeof(ub))
lb = convert(T,lb)
ub = convert(T,ub)

I receive the following:

ERROR: LoadError: StackOverflowError:
Stacktrace:
[1] cachedrule(#unused#::Type{ForwardDiff.Dual{ForwardDiff.Tag{var"#85#86", Float64}, Float64, 1}}, n::Int64) (repeats 79984 times)
@ QuadGK ~.julia\packages\QuadGK\czbUH\src\gausskronrod.jl:249

This is the same error as before. Using another method, e.g. HCubatureJL() gives a different error. In this case, the Stacktrace leads back to the GaussKronrod method in the HCubature package with the following error

ERROR: LoadError: MethodError: no method matching kronrod(::Type{ForwardDiff.Dual{ForwardDiff.Tag{var"#109#110", Float64}, Float64, 1}}, ::Int64)
Closest candidates are:
kronrod(::Type{T}, ::Integer) where T<:AbstractFloat

from integrals.jl.

flmuk avatar flmuk commented on August 22, 2024 1

Any updates on this? I am also trying to get derivatives wrt. to differentiation boundaries using HCubatureJL() and get exactly the same error as @rseydam above.
It would be absolutely great if this was addressed!
I am also a Julia beginner, but maybe with some guide I could help?

from integrals.jl.

ChrisRackauckas avatar ChrisRackauckas commented on August 22, 2024

The place to put the derivative rule would be https://github.com/SciML/Quadrature.jl/blob/master/src/Quadrature.jl#L577-L635 . Indeed right now it doesn't do the derivative w.r.t. the upper bound.

from integrals.jl.

rseydam avatar rseydam commented on August 22, 2024

Hi, I have got the same problem. Is there a simple way to fix it? I think having the variable in the lower bound leads similarly to a StackOverflowError. Here is an example of this type of problem

using Quadrature
using ForwardDiff
##
function ftest2(x)
    prob  = QuadratureProblem(  (I,p) -> x^2*I^2 , 0.0, x, [x] )  
    tmp2  = solve( prob, QuadGKJL(), reltol=1e-12, abstol=0 )[1]
    return  tmp2
end
ftest2(1.0)[1]
##
ForwardDiff.derivative(x -> ftest2(x)[1], 0.0)

from integrals.jl.

ChrisRackauckas avatar ChrisRackauckas commented on August 22, 2024

Someone probably just needs to do

https://github.com/SciML/Quadrature.jl/blob/master/src/Quadrature.jl#L170

T = promote_type(typeof(lb),typeof(ub)) and then convert both lb and ub to T.

from integrals.jl.

alexboche avatar alexboche commented on August 22, 2024

Beginner here. I think I'm running into this sort of problem too (and I asked about it on discourse). I'm unclear: has this differentiation wrt limit of integration feature been added yet? thanks

from integrals.jl.

fabioveneto avatar fabioveneto commented on August 22, 2024

Any updates on this? I am also trying to get derivatives wrt. to differentiation boundaries using HCubatureJL() and get exactly the same error as @rseydam above. It would be absolutely great if this was addressed! I am also a Julia beginner, but maybe with some guide I could help?

Similar problem for me as well

from integrals.jl.

hannesbahannes avatar hannesbahannes commented on August 22, 2024

I am also a Julia beginner but interested in solving this problem. Any advice where to start? The links above seem outdated.

from integrals.jl.

ChrisRackauckas avatar ChrisRackauckas commented on August 22, 2024

Derivative overloads generally aren't the easiest project to get started with. I'd usually advise doing something easier first, like #194.

If you do want to help this effort though, I think the starting place is to help improve the tests, i.e. help us finish #196 which will highlight exactly what parts of the algorithms are not dealing with derivatives well. The actual derivative overloads are in https://github.com/SciML/Integrals.jl/blob/master/ext/IntegralsForwardDiffExt.jl and https://github.com/SciML/Integrals.jl/blob/master/ext/IntegralsZygoteExt.jl, the latter using ChainRules https://juliadiff.org/ChainRulesCore.jl/stable/

from integrals.jl.

anneaux avatar anneaux commented on August 22, 2024

as a quick solution: with e.g. FiniteDiff.finite_difference_jacobian() you can differentiate w.r.t. the integral boundaries. Maybe that's helpful as a workaround

from integrals.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.