Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infinite random variates #52

Closed
mchitre opened this issue Dec 27, 2024 · 2 comments · Fixed by #53
Closed

Infinite random variates #52

mchitre opened this issue Dec 27, 2024 · 2 comments · Fixed by #53
Assignees
Labels
bug Something isn't working

Comments

@mchitre
Copy link
Member

mchitre commented Dec 27, 2024

rand(SymmetricAlphaStable(1.75, 1f0, 0f0)) sometimes generates infinite return value.

@mchitre mchitre added the bug Something isn't working label Dec 27, 2024
@ymtoo
Copy link
Collaborator

ymtoo commented Dec 28, 2024

I can reproduce the error using

julia> for _  1:1000000000
         x = rand(SymmetricAlphaStable(1.75f0, 1f0, 0f0))
         isinf(x) && throw("Infinity")
       end

ERROR: "Infinity"
Stacktrace:
 [1] top-level scope
   @ ./REPL[19]:3

@ymtoo
Copy link
Collaborator

ymtoo commented Dec 28, 2024

To simulate w, which is an independent exponential random variable with mean 1 (https://en.wikipedia.org/wiki/Stable_distribution#Simulation_of_stable_variates), x=rand(rng, T) is used to produce $x\in[0,1)$. This is not correct as $x$ should be uniform on $(0, 1)$.

When x=0, w=-log(0)=Inf and (cos((one(T)-α)*ϕ) / w)^(one(T)/α - one(T)) yields Inf since (one(T)/α - one(T)) is a negative value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants