TransWikia.com

Odeint error for nonlineal differential equations

Computational Science Asked by Eduard Laitin on December 10, 2020

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) 

One Answer

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.

Answered by Lutz Lehmann on December 10, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP