Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Pi estimation
pi.est <- function(n){ x <- runif(n, -1, 1) y <- runif(n, -1, 1) z <- x^2 + y^2 f = c() for(i in 1:n){ if( abs(z[i]) <= 1){ f[i] <- 1 }else{ f[i] <- 0 } } qt1 = sum(f[f==1]) pi.est = qt1/n return(4*pi.est) } pi.est(1000000)
run
|
edit
|
history
|
help
0
24-09-2020Def-função
Roll of a two dice
5 # SUMMARY PART A
CRR convergence
Regressão linear
31-08-2020-Exemplo AjusteNaoL
practica 2
23-09-2020InterpolaçãoNewtonform
test
R1