scientific-programming-exer.../ex_29.py
2019-01-09 14:19:33 +01:00

20 lines
307 B
Python

from math import exp
from random import uniform
import matplotlib.pyplot as plt
def f(n, f0=100):
result = f0
for i in range(n):
result *= exp(0.2 + uniform(-0.04, 0.04))
return result
X = list(range(350))
y1 = [f(x) for x in X]
y2 = [100*exp(0.2*x) for x in X]
plt.plot(X, y1, X, y2)
plt.show()