# Numerical Solutions

- Page ID
- 207158

Code \(\PageIndex{1}\) (Python):

%%python3 import numpy as np from scipy.integrate import odeint import matplotlib.pyplot as plt def rxn1st(C,t,*k): r1=k[0]*C[0] #k[0]*(concentation of A) dAdt=-r1 #rate of change of A decreased by forward reaction and increased by reverse reaction dBdt=r1 #rate of change of B increased by forward reaction and decreased by reverse reaction return(dAdt,dBdt) t=np.linspace(0,10,101) #the first number is the beginning point, the second number is the end, and the third is the number of points. C0=[1,0] #initial concentrations of A and B k1=1 k2=0 k=[k1] C=odeint(rxn1st,C0,t,(k1,k2)) cA=C[:,0] #define cA to give the concentration from the first (zeroth) column of the C array cB=C[:,1] #define cB to give the concentration from the second column of the C array