CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
AllenDowney

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: AllenDowney/ModSimPy
Path: blob/master/chap06.py
Views: 531
1
from modsim import *
2
3
def run_simulation(system, growth_func):
4
results = TimeSeries()
5
results[system.t_0] = system.p_0
6
7
for t in range(system.t_0, system.t_end):
8
growth = growth_func(t, results[t], system)
9
results[t+1] = results[t] + growth
10
11
return results
12
13
14