Area of Circle

Area of Circle - u2=runif(1) x=2*u1-1 y=2*u2-1 z[i]=x^2+y^2...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
#Calculate the Area of A circle in a box Area =function(n) { z=NULL for (i in 1:n) { u1=runif(1)
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: u2=runif(1) x=2*u1-1 y=2*u2-1 z[i]=x^2+y^2 } return(length(z[z<=1])/length(z)) }...
View Full Document

This note was uploaded on 11/16/2010 for the course STAT 340 taught by Professor Xu(sunny)wang during the Spring '09 term at Waterloo.

Ask a homework question - tutors are online