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

Work-around for explicit DAE system? #413

Open
brunomorampc opened this issue May 8, 2024 · 3 comments
Open

Work-around for explicit DAE system? #413

brunomorampc opened this issue May 8, 2024 · 3 comments
Labels
question User queries

Comments

@brunomorampc
Copy link

Imagine I have

$$\dot{x}= f(x,g(x))$$

I want the diffeqsolve to return both the state and $g(x)$ at the different time points. I know from #62 that the DAE are not yet implemented, but is there a work-around that I can implement to output $g(x)$ together with the state?

@patrick-kidger
Copy link
Owner

patrick-kidger commented May 8, 2024

I don't think this is a DAE. x->f(x,g(x)) gives an ODE.

And then you can evaluate g on the outputs of diffeqsolve.

@patrick-kidger patrick-kidger added the question User queries label May 8, 2024
@brunomorampc
Copy link
Author

brunomorampc commented May 8, 2024

Yes, true. I did not write the complete story to avoid making it complicated but it turned out to be misleading.

I was thinking to express this as a DAE by defining like z = g(x) as a trick such that I can get that as an output of the ODE because the problem is that I do not want to re-construct the g function outside of the diffeqsolve to avoid complications in my code because that function is farely complicated and can change from applications to applications.

So I was thinking of ways the diffsolve can return this value calculated internally without me having to re-build it externally.

@patrick-kidger
Copy link
Owner

I don't think there's a way to do this in general I'm afraid. This isn't just a limitation of Diffrax, it's part of the underlying numerical methods: the points at which we evaluate the vector field are not necessarily the same as the points at which we return outputs.

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

No branches or pull requests

2 participants