Ask Your Question
0

'unable to simplify to float approximation'

asked 2014-09-25 17:54:35 +0200

aguu gravatar image

updated 2014-10-28 21:14:12 +0200

kcrisman gravatar image
#example a=0, b=10    
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 + normalvariate(0,1)    
    A.append(f31)    
v1 = finance.TimeSeries(A)    
p = v1.plot_histogram(bins=100,color='black', normalize=True)    
p.set_aspect_ratio('automatic')    
p

a it should be a * sin and b * cos
not displayed

What is wrong??

Thanks

edit retag flag offensive close merge delete

Comments

You should give your actual code as is, with proper indentation so that people can help: asin(x) is probably a*sin(x)....but where is a defined? How can your code run without a? Same for bcos(2x). Copy the code into your post and then indent each line by 4 space to get the properly formatted output. It's not clear what statements are in your loop.

dazedANDconfused gravatar imagedazedANDconfused ( 2014-09-25 18:13:01 +0200 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2014-09-26 05:26:46 +0200

calc314 gravatar image

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
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2014-09-25 17:54:35 +0200

Seen: 1,375 times

Last updated: Sep 26 '14