用R语言估计参数值 请帮忙解释下面这段R语言程序每句的含义,谢谢!
>N<-10^6>x1<-numeric(N)>x2<-numeric(N)>n<-0>pai<-0>for(iin1:N){+x1<-runif(1,-1,1)+x2<...
> N <- 10^6
> x1 <- numeric(N)
> x2 <- numeric(N)
> n <- 0
> pai <- 0
> for(i in 1:N){
+ x1 <- runif(1,-1,1)
+ x2<- runif(1,-1,1)
+ if( x1^2+x2^2 <= 1 ){
+ n<- n+1}
+ }
> pai <- 4*n/N
> pai 展开
> x1 <- numeric(N)
> x2 <- numeric(N)
> n <- 0
> pai <- 0
> for(i in 1:N){
+ x1 <- runif(1,-1,1)
+ x2<- runif(1,-1,1)
+ if( x1^2+x2^2 <= 1 ){
+ n<- n+1}
+ }
> pai <- 4*n/N
> pai 展开
2014-03-12
展开全部
jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询