Skip to content

Commit 7c1710a

Browse files
authored
Merge pull request #35 from SebastianM-C/master
Fix Semicircle DomainError for pdf and cdf
2 parents 37c16a0 + 4bd5e00 commit 7c1710a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/densities/Semicircle.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Semicircle{T<:Real}(μ::T=0.0, r::T=2.0) = r > 0 ? Semicircle{T}(μ, r) :
1919

2020
# cumulative distribution function
2121
function cdf{T<:Real}(d::Semicircle{T}, x::T)
22-
r, a = d.mean, d.radius
22+
a, r = d.mean, d.radius
2323
if insupport(d, x)
2424
return 0.5 + (x-a)/*r^2) * (r^2 - (x-a)^2) + asin((x-a)/r)/π
2525
elseif x a
@@ -31,7 +31,7 @@ end
3131

3232
# probability density function
3333
function pdf{T<:Real}(d::Semicircle{T}, x::T)
34-
r, a = d.mean, d.radius
34+
a, r = d.mean, d.radius
3535
if insupport(d, x)
3636
return 2/*r^2) * (r^2 - (x-a)^2)
3737
else

0 commit comments

Comments
 (0)