Ask Your Question
1

How to generate normal noise for a function

asked 10 years ago

fehu gravatar image

updated 10 years ago

slelievre gravatar image
sage: func(x) = x^2
sage: func_noise = func + normalvariate(0,1); func_noise
x |--> x^2 - 0.4436993396832335

How can one force the normalvariate to generate the number only on function evaluation?

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
2

answered 10 years ago

tmonteil gravatar image

From your description, it is not clear what do you want to do, but perhaps you should use Python function instead of symbolic function:

sage: func_noise = lambda x : x^2 + normalvariate(0,1)
sage: func_noise
<function <lambda> at 0xad99aa3c>
sage: func_noise(2)
3.1200300365934908
sage: func_noise(2)
2.6179089142775314
sage: func_noise(2)
3.9386360734990973
sage: func_noise(2)
4.340588637274914
Preview: (hide)
link

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: 10 years ago

Seen: 403 times

Last updated: Feb 26 '15