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() should use p and u0 from ODEProblem #44

Open
owiecc opened this issue Jan 22, 2021 · 1 comment
Open

expectation() should use p and u0 from ODEProblem #44

owiecc opened this issue Jan 22, 2021 · 1 comment

Comments

@owiecc
Copy link
Sponsor Contributor

owiecc commented Jan 22, 2021

What is the rationale behind having to explicitly pass the initial conditions and parameters to expectation function if these can be embedded into the ODEProblem?

function expectation(g::Function, prob::ODEProblem, u0, p, expalg::Koopman, args...)

This makes the code a bit strange as I can have double definitions of initial conditions and one seems to be ignored.

f(u,p,t) = p.*u

u0 = [-666.666]
u0_dist = [truncated(Normal(3.0,2.0),3-1000,3+1000)]

p = [-0.3]
tspan = (0.0,10.0)
prob = ODEProblem(f,u0,tspan,p)

expectation(f -> f(1.0), prob, u0_dist, p, Koopman(), Tsit5())

Wouldn't this be enough or am I missing something?

prob = ODEProblem(f,u0_dist,tspan,p)
expectation(f -> f(1.0), prob, Koopman(), Tsit5())
@ChrisRackauckas
Copy link
Member

It's just a quirk of history. This project started before you could define and use initial conditions as distributions, so its interface needed to accommodate for that. Now the interface is super flexible, so it just works. We should update this package to use the interface you describe.

@owiecc owiecc changed the title Rationale behind explicit u0 and p parameters expectation() should use p and u0 from ODEProblem Apr 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants