Ask Your Question

How to generate normal noise for a function

asked 2015-02-25 15:45:44 -0600

fehu gravatar image

updated 2015-02-26 07:15:48 -0600

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?

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted

answered 2015-02-25 16:18:45 -0600

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)
sage: func_noise(2)
sage: func_noise(2)
sage: func_noise(2)
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


Asked: 2015-02-25 15:45:44 -0600

Seen: 118 times

Last updated: Feb 26 '15