I receive the following error when I run the code.

ODEintWarning: Excess work done on this call (perhaps wrong Dfun type). Run with full_output = 1 to get quantitative information. warnings.warn(warning_msg, ODEintWarning)

I got this from messing around with an example received from my professor and can't seem to understand what is happening.

%matplotlib inline
import numpy as np

import matplotlib.pyplot as plt
from scipy.integrate import odeint
from scipy.integrate import solve_ivp

def f(y, t):
    return y ** 2
t = np.linspace(0, 5, 100) 
x0 =  3             
x = odeint(f, x0, t) 

1 Answer 1


The exact solution is $$x(t)=\frac{3}{1-3t}.$$ This means that the domain of the solution is $(-\infty,\frac13)$. odeint with the integration interval $[0,5]$ stalls at this singularity, as it can, correctly, not move beyond this point.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.