Site icon R-bloggers

No simulation is complete without a gif

[This article was first published on Back Side Smack » R Stuff, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

I promise this is my last post on the now week and a half old π pay! Building on the last post, I figured I could show how convergence actually works in the estimation algorithm. If you’ll recall, we plotted a number of x,y pairs inside a square inscribing a quarter circle. The ratio of those points inside the quarter circle to the overall number of points plotted was an estimate of pi. How good depended strongly on the number of points plotted. In fact the simplest method of estimation involves plotting thousands of points in one round, no iteration at all. But breaking the points into rounds can give us a neat look at how quickly the average will converge on pi and where the points themselves are plotted. So below the jump (a backsidesmack first!) I present a highly caffeinated animation of the process:

From pi day

Code is in the last pi day post or online at github.

To leave a comment for the author, please follow the link and comment on their blog: Back Side Smack » R Stuff.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.