You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When x+y is larger than some value std.mathspecial.beta(x,y), uses exp(logGamma(x) + logGamma(y) - logGamma(x+y)) to compute B(x,y) instead of gamma(x) * gamma(y) / gamma(x+y), because Γ(z) grows large very quickly as z increases. logGamma(z) is equivalent to ln|Γ(z)|. Notice that eln|Γ(z)| = |Γ(z)|, so beta loses the sign information of the result when it uses exp and logGamma to calculate B.
Here's an example of computing B(-0.5, 10,000). Looking a graph of B, we can see that the value should be negative, but when we use beta to compute it, we get a positive number.