Innovation
Compounding Growth Rate
%pip install ipywidgets
import numpy as np
import matplotlib.pyplot as plt
from ipywidgets import interact, interactive
from IPython.display import display
import numpy as np
from matplotlib import pyplot as plt
def plot(growth_rate=0.3, kind = 'innovation'):
a0 = 1 # initial amount of innovation
r = growth_rate / 365 # growth rate per annum
T = 365 * 30 # days of simulation
Tdel = 365 # days of delay
a = np.zeros(T) # amount of innovation without delay
adel = np.zeros(T) # amount of innovation with delay
a[0] = a0
adel[0] = a0
for t in range(1, T):
a[t] = a[t - 1] + a[t - 1] * r
if t < Tdel + 1:
adel[t] = adel[t - 1]
else:
adel[t] = adel[t - 1] + adel[t - Tdel - 1] * r
# plot innovation as a function of time
time = np.arange(1, T + 1)
years = time / 365
if (kind == 'innovation'):
plt.figure()
plt.plot(years, a, 'k')
plt.plot(years, adel, 'r')
plt.xlabel('years')
plt.ylabel('accumulated innovation')
else:
# plot time to a given amount of innovation
plt.figure()
plt.plot(a, years, 'k')
plt.plot(adel, years, 'r')
plt.xlim([0, 1000])
plt.xlabel('required innovation')
plt.ylabel('years to achievement')
plt.show()
w = interactive(plot, growth_rate=(0.1,0.5,0.01), kind=["innovation", "achievement"])
display(w)
Loading...