Anthônio Nunes Moreira Netto - anthonionetto@fisica.ufc.br
Departamento de Física, Centro de Ciências, Universidade Federal do Ceará
In [7]:
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
In [8]:
dt = 0.1
tau = 1
n = 30
N01 = 100
N02 = 0
tmax = n*dt
N1 = [];
N2 = [];
N1.append(N01)
N2.append(N02)
In [9]:
time = np.linspace(0, tmax, n) # Eixo-x (Tempo).
#theory = N0*np.exp(-time/tau) # Solução analítica.
for i in range(1,n):
N1.append(N1[i-1]+((N2[i-1]/tau)-(N1[i-1]/tau))*dt)
N2.append(N2[i-1]+((N1[i-1]/tau)-(N2[i-1]/tau))*dt)
In [10]:
#plt.plot(time,theory,'b-',time,N1,'ro',time,N2,'g.')
plt.plot(time,N1,'ro',time,N2,'g.')
plt.axis([0.,tmax,0.,N1[0]])
#plt.legend(['Teórico','Numérico ($N_A$)','Numérico ($N_B$)'],loc=0)
plt.legend(['Numérico ($N_A$)','Numérico ($N_B$)'],loc=0)
plt.title('Exercício 1.5')
plt.xlabel('Tempo (s)')
plt.ylabel('Número de Núcleos')
plt.show()
In [10]: