Question: I need help solving this coupled differential equation on Python. I keep getting the following error. File C:/Users/Aus/Documents/PHYS639/Radioactivedecay1.py, line 24, in N = odeint(decay,N0,t) File
I need help solving this coupled differential equation on Python. I keep getting the following error.
File "C:/Users/Aus/Documents/PHYS639/Radioactivedecay1.py", line 24, in
File "C:\Users\Aus\Anaconda3\lib\site-packages\scipy\integrate\odepack.py", line 233, in odeint int(bool(tfirst)))
RuntimeError: The size of the array returned by func (2) does not match the size of y0 (1).
Thanks for your help.
----------------------------------------------------------------------
import numpy as np from scipy.integrate import odeint import matplotlib.pyplot as plt
def decay(N,t): alpha = 4 beta = 0.05 dadt = -alpha/t dbdt = -alpha/t - beta/t return([dadt,dbdt]) N0 = 1e7 t = np.linspace(1,1e9,10000) N = odeint(decay,N0,t)
alpha = N[:,0] beta = N[:,1]
plt.semilogy(t,alpha) plt.semilogy(t,beta)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
