Skip to content
This repository was archived by the owner on Sep 9, 2024. It is now read-only.
This repository was archived by the owner on Sep 9, 2024. It is now read-only.

Parameters for function #103

@galbarel

Description

@galbarel

Hi,

My intergration is over the function:

function f(t,v,p):
(x,y) = v
dx_dt = p[1]_x - x_y
dy_dt = p[2]_x_y -y
return [dx_dt,dy_dt]
end

But ode45 does not accept my function f (as it needs to get another argument p)

If I define f without p, then how can I pass p to the function?

I need to run ode45 many times, each time with different values for p.
I've tried doing something like this:

function run_ode(f,t,v,pars)
p = pars
(times,data) = ode45(f,t,v) #here f is defined with only 2 arguments f(t,v)
return data
end

but p does not change and it keeps running with the same values.

I've also tried setting
f1(t,v) = f(t,v,p) and then running ode45(f1,t,v) but it didn't work either
(this was following the suggestion in SciML/Sundials.jl#3)

Can you please suggest how to pass the arguments in p?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions