I am trying to solve a differential equation in the form: dx/dt = funct(x) using scipy odeint.
However, for some initial values, I get a "ODEintWarning: Excess work done on this call", even if the ODE itself seems to be solvable analytically. Why does the numerical ODE solver give me a warning, and how can I make it work instead of jumping to x > 3e^7?
Here is a minimal (non) working example:
x0 =0.49 # works, but changing to 0.51 gives the ODEint warning
t = np.linspace(0,10,100)
def funct(x,t):
return 2*x**2-x
x, out = integrate.odeint(funct, x0, t, full_output = 1)
plt.plot(t,x)
I am not too good at math, but I think the analytical answer should be: x = 1/(2 + C * exp(t)) with C being any constant.
If so, I think using initial value of x0=0.51 should also be numerically solvable because C exists (C = -0.04).
The closest question I could find was: scipy odeint: excess work done on this call and very sensitive to initial value However, the ODE in the previous question blows up analytically, whereas mine does not.
Edit: My real function and x are vectors and matrices about networks, not an analytically solvable one.