3/24/2024 0 Comments Scipy odeintNote that Scipy odeint Non-negative solution is related but my problem is slightly different: I'm not concerned by a negative solution x, but by a negative argument t. Is there a way to prevent odeint from going to negative values? Why is it trying values outside of my input array t?įor my actual code I found some ways to avoid the nan results, such as adding if t<0: t=0 in the function (which wouldn't work here) or by imposing a very small maximal time steps ( hmaxan example that reproduces the issue: import numpy as np However, odeint iterates to negative time values - outside of the actual range of solutions I'm looking for - and this causes an error because my ODEs depend on the square root of time and my function return a complex value instead of a real number. I'm trying to solve a system of ODEs with from the boundary condition at the final time and working my way up to the initial time (as described here: Backward integration in time using scipy odeint).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |