Skip to content

Instantly share code, notes, and snippets.

@Nessiesson
Created September 25, 2018 11:30
Show Gist options
  • Save Nessiesson/816ecde71e8323e4288c430574c58559 to your computer and use it in GitHub Desktop.
Save Nessiesson/816ecde71e8323e4288c430574c58559 to your computer and use it in GitHub Desktop.
import matplotlib.pyplot as plt
import numpy as np
def p(t, alpha=1.0, beta=1.0, p0=1.0):
return beta ** t * p0 + sum([alpha * beta ** (t - m) for m in range(1, t + 1)])
vec_p = np.vectorize(p)
times = np.arange(10)
alphas = np.arange(-5, 5, 0.1)
output = []
for t in times:
output.append(vec_p(t, alphas, beta=5))
plt.plot(times, output)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment