I would like to make a concentration vs time graph in Python using data reaction reaction constants already provided to me. Are there any Python packages available? How should I go about solving this?
Asked
Active
Viewed 1,125 times
3 Answers
0
The short answer to your question is Matplotlib as to how much this will help you, I don't know?
There are also many python packages for modelling chemical kinetics, an example would be chempy but again it may not answer your question.
I would recommend finding a youtube tutorial.

DarrenRhodes
- 1,431
- 2
- 15
- 29
0
a simple example below:
import matplotlib.pyplot as plt
import numpy as np
x =[67,161,241,381,479,545,604,]
y = [85.9,70,57.6,40.7,32.4,27.7,24]
plt.plot(x,y)
plt.show()

David Buck
- 3,752
- 35
- 31
- 35
0
What you want to do is solve the differential equation, right? For example, given a first-order reaction,
dc/dt = -k*c.
You can solve such equations with the odeint
function from the SciPy package:
import numpy as np
import matplotlib.pyplot as plt
from scipy.integrate import odeint
k=1.# reaction rate constant
c0=1.# initial concentration
def dc_dt(c, t):
return -k*c
t_array = np.linspace(0, 10, 1000)
c_array = odeint(dc_dt, y0=c0, t_array)
plt.plot(t_array, c_array)
plt.show()
And this is what comes out of the integration:

Adrian Usler
- 81
- 7