Ask Your Question

How to generate normal noise for a function

asked 2015-02-25 22:45:44 +0200

fehu gravatar image

updated 2015-02-26 14:15:48 +0200

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 23:18:45 +0200

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 22:45:44 +0200

Seen: 358 times

Last updated: Feb 26 '15