QuadGK.jl icon indicating copy to clipboard operation
QuadGK.jl copied to clipboard

Inplace method not callable with Inf

Open dominikkiese opened this issue 5 years ago • 3 comments

Hi,

wanted to know if this is the expected behavior. When doing

function f!(b, x)
   b[1] = exp(-x^2)
   b[2] = exp(-x^2)
   return nothing 
end

buf = zeros(Float64, 2); quadgk!(f!, buf, 0.0, Inf)

I get ERROR: MethodError: objects of type QuadGK.InplaceIntegrand{typeof(f!),Array{Float64,1},Array{Float64,1}} are not callable. For finite upper bounds though everything seems to work. In my use case however, I need to compute integrals for which the upper bound is Inf, and I do not a priori know if and when I can truncate the integral for some large upper bound.

dominikkiese avatar Nov 04 '20 11:11 dominikkiese

Sounds like a bug.

In the meantime, you can just implement the same coordinate transformation (which QuadGK does internally) yourself: image

stevengj avatar Nov 04 '20 12:11 stevengj

Sure, that is what we used for now. I think however, that it would be more convenient to have it in the package. Are you planning to fix this in the near future? Otherwise I'll try to make a PR when I find the time.

dominikkiese avatar Nov 26 '20 08:11 dominikkiese

I haven't had time to work on this, so a PR would be welcome.

stevengj avatar Nov 26 '20 13:11 stevengj