Figure 4.11:

Two first-order reactions in series in a batch reactor.

Figure 4.11

Code for Figure 4.11

Text of the GNU GPL.

main.py


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# Converted from series.m
import numpy as np
from misc import save_ascii

npts = 100
x = np.linspace(0, 5, npts)
y = np.column_stack([
    np.exp(-2*x),
    -2*(np.exp(-2*x) - np.exp(-x)),
    1 - np.exp(-2*x) - 2*(np.exp(-x) - np.exp(-2*x))
])
table = np.column_stack([x, y])
save_ascii('series.dat', table)