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

scipy's solve_ivp having trouble solving simple ivp

$
0
0

I'm attempting to solve a very simple IVP in Python in order to do error analysis:

import numpy as npfrom scipy.integrate import solve_ivpdef dh_dt_zerodriver(t, h):    return -2 / ht = 50steps = 10dt = t / stepst_span = [0, t]t_eval = np.arange(0, t + dt, dt)h0 = 5sol = solve_ivp(dh_dt_zerodriver, t_span=t_span, y0=[h0], t_eval=t_eval)

However, the solution will not compute as it runs for an indefinite amount of time. I have used solve_ivp to solve more complex IVPs without analytical solutions, but this one seems to have me stumped despite it seemingly being a fairly simply problem.

My paper is based on using the RK45 method, but if I must use some different numerical method then it is okay.


Viewing all articles
Browse latest Browse all 14271

Trending Articles



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