torchdiffeq icon indicating copy to clipboard operation
torchdiffeq copied to clipboard

Solving a system of ODEs

Open ojus1 opened this issue 3 years ago • 3 comments

Hi, great work, and thanks for the code!

I was wondering if the following is possible. I have a system of ODEs (two ODEs): x_state = f(x, t, theta) 0 = d {g(x, t, phi)} / dx Simply put, I want the function f to output something that doesn't change the output of the function g. f and g both are Neural ODEs. I want to learn the parameters of both f and g at the same time.

Any example code would help a lot!

Thanks in advance.

ojus1 avatar Jan 23 '22 22:01 ojus1

What's the meaning of x_state? Does it coupled with g?

Saltsmart avatar Jan 24 '22 02:01 Saltsmart

Yes, there is a coupling between g and x.

ojus1 avatar Jan 24 '22 02:01 ojus1

Simply put, I want the function f to output something that doesn't change the output of the function g.

If this output x_state doesn't affect g, but you want to access it outside, I'd just create f as an instance of a callable class instead of a function, and store x_state inside as an attribute. After the ODE is solved you can access it outside.

jotaf98 avatar Mar 18 '22 15:03 jotaf98