Question
Describe the code and graph? import numpy as np import matplotlib.pyplot as plt import scipy.integrate as sci from scipy.integrate import odeint def f(y,t): y1 ,
Describe the code and graph?
import numpy as np import matplotlib.pyplot as plt import scipy.integrate as sci from scipy.integrate import odeint def f(y,t): y1 , y2, y3 = y k1=1 k2=2 f = [-k1*y1,k1*y1-k2*y2,-k2*y2] return f #initial conditions f_initial=[3,3,3] t = np.linspace(0,20,1000) solvenumarica= sci.odeint(f,f_initial,t) plt.plot(t,solvenumarica[:,2],'-',label='y1 (parent)') plt.plot(t,solvenumarica[:,1],'-',label='y2 (daughter)') plt.plot(t,solvenumarica[:,2],'-',label='y3 (granddaughter)') plt.title('Nuclear_decay') plt.ylabel('Activity (n)') plt.xlabel('time (t)') plt.legend() plt.grid(True) plt.show()
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started