No simulation is complete without a gif

March 24, 2011
By

(This article was first published on Back Side Smack » R Stuff, and kindly contributed to R-bloggers)

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 his blog: Back Side Smack » R Stuff.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Tags: , , , , ,

Comments are closed.