Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You are not passing a value into f within the loop. Try the following:

N=10000 
y = [random() for i in range(N)] 
A = [] 
a=0 
b=10 
f = a*sin(x)+b*cos(2*x) 
for i in y: 
    f31 = f(x=i) + normalvariate(0,1) 
    A.append(f31) 
print f31
v1 = finance.TimeSeries(A) 
p = v1.plot_histogram(bins=100,color='black', normalize=True) 
p.set_aspect_ratio('automatic') 
p