"hist" is short for "Histogram(直方图.柱状图)". 1.N = hist(Y) bins the elements of Y into 10 equally spaced containers and returns the number of elements in each Container. If Y is a matrix, hist works down the columns. (将向量Y的元素平均分到十个等间隔的…
Verify the Monte Carlo sampling variability of "π". p = π/4 与 所得 0.7854 比较接近,故满足 Central Limit theorem. simulation = function(sampleSize){ c = rep(0,sampleSize) countIn = 0 for(i in 1:sampleSize){ x = runif(1,-1,1) y = runif(1,-1,1) if(sqrt(x*x…