Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23390

Scipy solve_ivp requests time out of bounds

$
0
0

My code solves a 1st order differential equation using Scipy's solve_ivp function and the standard RK45 solver. The code itself is reasonably large, and I will certainly attempt to produce a minimal working example if all else fails. However, there might already be a problem at a conceptual that stage, so I am hoping this is not a bug but just my lack of understanding.

The important part of the code is as follows:

nStep = 1000time_arr = np.arange(nStep)sol = solve_ivp(rhs_func, (0, self.nStep-1), [x0, ],                t_eval=time_arr, args=(my_args_list,))

I would like to integrate the right hand side on the time interval [0, 999], as given by the 2nd argument, and and sample the result at integer values of time within that interval, as is given by the t_eval keyword argument.

It is my expectation that, internally, the solver would sample the right hand side at arbitrary floating-point times within the provided time interval. For many different values of my_args_list, it indeed does so. However, for some fairly reasonable argument values it attempts to sample the right hand side severely outside of the provided range. For example, it attempted to sample at 10062.831699320916, which is severely outside of the integration boundaries.

Am I right to assume that this behaviour is unexpected and is a bug (either of scipy or of my code)?

I would appreciate suggestions on what may be causing such behaviour.


Viewing all articles
Browse latest Browse all 23390

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>