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

Use values computed in ODETerms inside of SaveAt #476

Open
Ricky5389 opened this issue Aug 5, 2024 · 4 comments
Open

Use values computed in ODETerms inside of SaveAt #476

Ricky5389 opened this issue Aug 5, 2024 · 4 comments
Labels
question User queries

Comments

@Ricky5389
Copy link

Hi, I would like to save some values that are computed inside of my ODETerms. Is it possible to have the term output other things than the differential equations parameters ? For example, if my term looks like this.

def terms(t,y,args):
    y_dot = y + args
    args_changed = args / y_dot
    return y_dot

Would it be possible to save args_changed and use it inside of SaveAt? (This is a dummy example but it captures the idea)

@patrick-kidger
Copy link
Owner

You can use SaveAt(fn=...). This is a separate function to the one used in the vector field.

In general we don't allow saving extra values from the vector field. The reason is that the times at which this is evaluated are frequently not the same as the times at which we output values.

@patrick-kidger patrick-kidger added the question User queries label Aug 5, 2024
@Ricky5389
Copy link
Author

Is there a way to have access to y_dot inside of SaveAt ?

@patrick-kidger
Copy link
Owner

No. As above this is intended -- the values at which you save may not be the values at which you evaluate the vector field. So there's no way to map the values from one to the other.

@etienney
Copy link

etienney commented Aug 6, 2024

Is there a way to have access to y_dot inside of SaveAt ?

Maybe what you want to do is putting the option "steps=True" to sync the values at which you save to the values that you evaluate.

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

3 participants