Gas production

by Dane Miller

In this post I will be comparing the rate of two chemical reactions.

1) Hydrochloric acid and seashell
CaCO3 (s) + 2HCl (aq) –> CaCl2 (aq) + H2O (l) + CO2 (g)

2) Hydrogen peroxide and Yeast
2H2O2 (aq) — (catalyst Yeast) —> H2O (aq) + O2 (g) + heat

Both of these chemical reactions were measured with Vernier labquest O2/CO2 probe. Then the data was converted to CSV file and ran some descriptive statistics in jupyter notebook (Python 3.6).

1) Hydrochloric acid and seashell

2) Hydrogen peroxide and Yeast

First import the necessary modules you will be using for the analysis.

# %load ../standard_import.txt
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import axes3d
import seaborn as sns

from sklearn.preprocessing import scale
import sklearn.linear_model as skl_lm
from sklearn.metrics import mean_squared_error, r2_score
import statsmodels.api as sm
import statsmodels.formula.api as smf

%matplotlib inline
plt.style.use('seaborn-white')
df = pd.read_csv('/.../YeastO2.csv') # load csv file into python
df.info()
df.head()
est = smf.ols('Yeast_O2_ppm ~ Time', df).fit()
est.summary().tables[1]

Yeast and H2O2

coef std err t P>|t| [0.025 0.975]
Intercept -467.1246 122.092 -3.826 0.000 -709.382 -224.867
Time 17.2861 0.527 32.779 0.000 16.240 18.333

HCl and Seashell

coef std err t P>|t| [0.025 0.975]
Intercept -1575.5714 527.309 -2.988 0.006 -2659.471 -491.672
Time 87.8234 8.379 10.481 0.000 70.599 105.048

We can compare correlations.
Time Yeast_O2_ppm
Time 1.000000 0.956887
Yeast_O2_ppm 0.956887 1.000000

Time HCl_CO2_ppm
Time 1.000000 0.899226
HCl_CO2_ppm 0.899226 1.000000

We can compare the linear regression models in the first two figures above.

regr = skl_lm.LinearRegression()

X = df[['Time']].as_matrix()
y = df.Yeast_O2_ppm # ran this same code for the HCl dataset

regr.fit(X,y)
print(regr.coef_)
print(regr.intercept_)

Yeast and H2O2
[17.28611823]
-467.1246359930119

HCl and Seashell
[87.8234127]
-1575.571428571428

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s