On Fri, Jul 17, 2015 at 6:16 PM, harven <[email protected]> wrote:
> Hi, I just tried to integrate the gaussian using the builtin quadgk but got
> a stackoverflow.
>
>       julia> quadgk(t->exp(-t^2/2), 0,inf)
>       ERROR: StackOverflowError:
>        in typejoin at ./promotion.jl
>        in quadgk at quadgk.jl:169
>        in quadgk at quadgk.jl:174 (repeats 12364 times)
>
> I was expecting roughly sqrt(pi/2) as the answer. I am using julia Version
> 0.4.0-dev+3622.
> The documentation says it is ok to have one of the endpoints of the interval
> infinite.
> Is it a bug or do I misunderstand the doc?

Does this help?

julia> quadgk(t->exp(-t^2/2), 0, Inf)
(1.2533141373155001,1.422966106459907e-8)

julia> quadgk(t->exp(-t^2/2), 0, inf)
ERROR: StackOverflowError:
in quadgk at ./quadgk.jl:171
in quadgk at ./quadgk.jl:176 (repeats 10690 times)

julia> inf
inf (generic function with 2 methods)

julia> Inf
Inf

Reply via email to