def test_bateman_full(): k0, k1, k2 = 2.0, 3.0, 4.0 k = [k0, k1, k2] y0 = [0.7, 0.3, 0.5] t = np.linspace(0, 10, 17) yout = bateman_full(y0, k, t, exp=np.exp) yref = decay_get_Cref(k, y0, t) assert np.allclose(np.asarray(yout).T, yref)
def solution3(u0=1.0, v0=0.7, w0=0.3, k0=1.0, k1=2.0, k2=3.0, tend=10.0, nt=100, plot=False, savefig='None'): """ Example program calculating the trajectory of 3 coupled decays """ tout = np.linspace(0, tend, nt) yout = np.asarray(bateman_full([u0, v0, w0], [k0, k1, k2], tout, exp=np.exp)).T if plot: import matplotlib.pyplot as plt plt.plot(tout, yout) if savefig == 'None': plt.show() else: plt.savefig(savefig)
def solution3(u0=1.0, v0=0.7, w0=0.3, k0=1.0, k1=2.0, k2=3.0, tend=10.0, nt=100, plot=False, savefig='None'): """ Example program calculating the trajectory of 3 coupled decays """ tout = np.linspace(0, tend, nt) yout = np.asarray( bateman_full([u0, v0, w0], [k0, k1, k2], tout, exp=np.exp)).T if plot: import matplotlib.pyplot as plt plt.plot(tout, yout) if savefig == 'None': plt.show() else: plt.savefig(savefig)