Ask Your Question

# 'unable to simplify to float approximation'

#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 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.

## 1 Answer

Sort by » oldest newest most voted

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

more

## Your Answer

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

Add Answer

## Stats

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

Seen: 1,190 times

Last updated: Sep 26 '14