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

Expectation of log bessel function #19

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ authors = ["Mykola Lukashchuk <[email protected]> and contributors"]
version = "0.2.0"

[deps]
Bessels = "0e736298-9ec6-45e8-9647-e4fc86a2fe38"
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
ExponentialFamily = "62312e5e-252a-4322-ace9-a5f4bf9b357b"
LogExpFunctions = "2ab3a3ac-af41-5b50-aa03-7779005ae688"
Expand All @@ -12,6 +13,7 @@ StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"

[compat]
Aqua = "0.8.4"
Bessels = "0.2.8"
CpuId = "0.3.1"
Distributions = "0.25"
ExponentialFamily = "1.4.1"
Expand Down
1 change: 1 addition & 0 deletions src/ClosedFormExpectations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ include("expressions/Square.jl")
include("expressions/Power.jl")
include("expressions/xlog2x.jl")
include("expressions/Abs.jl")
include("expressions/LogBesselk.jl")

# rules for computing expectations
include("Exponential/Exponential.jl")
Expand Down
11 changes: 11 additions & 0 deletions src/expressions/LogBesselk.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export LogBesselk

import Bessels: besselkx

struct LogBesselk <: Expression
ν::Number
end

function (f::LogBesselk)(x)
return log(besselkx(f.ν, x)) - x
end
2 changes: 1 addition & 1 deletion test/Normal/mean_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ end
@test log(0.5*1/θ) - 1/θ * value ≈ value_laplace
end

end
end