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

What is the difference between using IntegralCubature and using Integrals, Cubature in the example? #152

Closed
homocomputeris opened this issue Feb 7, 2024 · 1 comment
Labels

Comments

@homocomputeris
Copy link

Question❓

Slightly modified example from the readme

using SciMLExpectations, OrdinaryDiffEq, Distributions, Integrals, Cubature

function eom!(du, u, p, t, A)
    du .= A * u
end

u0 = [1.0, 1.0]
tspan = (0.0, 3.0)
p = [1.0; 2.0]
A = [0.0 1.0; -p[1] -p[2]]
prob = ODEProblem((du, u, p, t) -> eom!(du, u, p, t, A), u0, tspan, p)
u0s_dist = (Uniform(1, 10), truncated(Normal(3.0, 1), 0.0, 6.0))
gd = GenericDistribution(u0s_dist...)
cov(x, u, p) = x, p

sm = SystemMap(prob, Tsit5(), save_everystep = false)

analytical = (exp(A * tspan[end]) * [mean(d) for d in u0s_dist])
analytical

g(sol, p) = sol[:, end]
exprob = ExpectationProblem(sm, g, cov, gd; nout = length(u0))
sol = solve(exprob, Koopman(); quadalg = CubatureJLh(),
            ireltol = 1e-3, iabstol = 1e-3)
sol.u # Expectation of the states 1 and 2 at the final time point

fails with

ERROR: UndefVarError: `CubatureJLh` not defined
Stacktrace:
 [1] top-level scope
   @ ~/test/test.jl:25

Integrals.jl docs say

CubatureJLh: h-Cubature from Cubature.jl. Requires using Cubature.

So, shouldn't SciMLExpectations.jl work with using Integrals, Cubature too? Or is there significant difference in the scope of application of those packages?

@ChrisRackauckas
Copy link
Member

using IntegralCubature is the old way that was deprecated. It was removed when Julia v1.9 came out as package extensions gave an easier way to make the solver addons that would stay up to date. If you do this old way, then you'll have issues with your environment because its compats are really old. This repo needs to be updated, see #148

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants