Ask Your Question
1

How to generate normal noise for a function

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

fehu gravatar image

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

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
2

answered 2015-02-25 23:18:45 +0100

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
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: 2015-02-25 22:45:44 +0100

Seen: 379 times

Last updated: Feb 26 '15