python - square of a number using gaussian distribution -


is there way calculate square of number (closest approximation), 4, using gaussian distribution mu number , sigma 0.16. , 1000 random points?

i searched internet lot, couldn't find solution this. piece of code helpful new python.

assuming have data generated find approximation of mu (which square of number) taking mean of data. law of large numbers can sure size of data grow approximation become more accurate. example:

import random   def generate_data(size):     mu, sigma = 4 ** 2, 0.16     return [random.gauss(mu, sigma) _ in range(size)]   def mean(ls):     return sum(ls) / len(ls)  print(mean(generate_data(10)))     #15.976644889526114 print(mean(generate_data(100)))    #16.004123848232233 print(mean(generate_data(1000)))   #16.00164187802018 print(mean(generate_data(10000)))  #16.001000022147206 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -