########################################################
# CONTADOR DE NEUTRONES #
########################################################
VA <- matrix(rnorm(2000000), 100000)
conteo <- 0
m <- 0
for(i in 1:100000){
x <- 1.1
for(j in 1:7){
x <- x+cos(pi*VA[i,j])
}
if(x>=5){
m <- m+1
}
# conteo de 1000 en 1000 #
n <- i/1000
if((i%%1000)==0){
per[n] <- (100*m)/i
if(n==1){
cat("CONTEO","\t","PORCENTAJE","\n")
}
cat(n,"\t",per[n],"\n")
conteo <- conteo+per[n]
}
}
porcentaje <- conteo/(i/1000)
cat("PORCENTAJE PROMEDIO","\t",porcentaje)
Much more than documents.
Discover everything Scribd has to offer, including books and audiobooks from major publishers.
Cancel anytime.