I managed to speed it up a bit and let it run for 100,000 samples, but it came consistently to about -0.015 of pi. Since it never (at the end) went above the true value of pi in the 3 tests that I did, seemingly, the random number generator in Scratch is probably only pseudo-random, or I did not do enough tests. Is there any part of statistics that might predict the value of pi that I got with 100,000 tests to be within this range, however?
To make it a little more efficien, you could make it so it goes line by line, with the script copied within the forever loop. That i good for optomization.
This is cool and a great idea. If you could show the math a bit and advise the looker to be patient they will get it. Not many people have dowloaded it so i fear not many lookers got it. Look at my game Susa you will like it!
From statistics, we can work out that both the mean and the variance of the number of points in the circle is n*pi/4. That means that the standard deviation of the estimate of pi will be about pi/sqrt(n). After 10000 samples, you expect to be within about +- 0.03 of pi.
This project estimates pi by comparing the area of a circle to the area of a square, dropping points randomly in a square to esitmate area.
This is not an efficient way to compute pi, but it nicely illustrates random sampling.
Comments
You need to be logged in to post comments
Add a Comment
you live un santa cruz? lol me too
(view all replies)Comment Reply
I managed to speed it up a bit and let it run for 100,000 samples, but it came consistently to about -0.015 of pi. Since it never (at the end) went above the true value of pi in the 3 tests that I did, seemingly, the random number generator in Scratch is probably only pseudo-random, or I did not do enough tests. Is there any part of statistics that might predict the value of pi that I got with 100,000 tests to be within this range, however?
(view all replies)Comment Reply
To make it a little more efficien, you could make it so it goes line by line, with the script copied within the forever loop. That i good for optomization.
(view all replies)Comment Reply
This is cool and a great idea. If you could show the math a bit and advise the looker to be patient they will get it. Not many people have dowloaded it so i fear not many lookers got it. Look at my game Susa you will like it!
(view all replies)Comment Reply
Oh, wait, I see the variable name now, sorry.
(view all replies)Comment Reply
Isn't Pi 3.14159... not 314,159...? Or will it fix that?
(view all replies)Comment Reply
Can you help me you're a forum moderator (link to forums)
(view all replies)Comment Reply
From statistics, we can work out that both the mean and the variance of the number of points in the circle is n*pi/4. That means that the standard deviation of the estimate of pi will be about pi/sqrt(n). After 10000 samples, you expect to be within about +- 0.03 of pi.
(view all replies)Comment Reply
its a good priject but i am actually suprised at how ineffiecient it is.
(view all replies)Comment Reply
this is similar to my project
(view all replies)Comment Reply
cool
(view all replies)Comment Reply