Update all new Tasks

This commit is contained in:
Ingy döt Net 2015-02-20 09:02:09 -05:00
parent 00a190b0a6
commit 91df62d461
5697 changed files with 93386 additions and 804 deletions

View file

@ -0,0 +1,7 @@
require'statfns'
(mean,stddev) ?1000#0
0.484669 0.287482
(mean,stddev) ?10000#0
0.503642 0.290777
(mean,stddev) ?100000#0
0.499677 0.288726

View file

@ -0,0 +1,3 @@
histogram=: <: @ (#/.~) @ (i.@#@[ , I.)
require'plot'
plot ((%*1+i.)100) ([;histogram) ?10000#0

View file

@ -0,0 +1,23 @@
histogram=: <: @ (#/.~) @ (i.@#@[ , I.)
meanstddevP=:3 :0
NB. compute mean and std dev of y random numbers
NB. picked from even distribution between 0 and 1
NB. and display a normalized ascii histogram for this sample
NB. note: should use population mean, not sample mean, for stddev
NB. given the equation specified for this task.
h=.s=.t=. 0
buckets=. (%~1+i.)10
for_n.i.<.y%1e6 do.
data=. ?1e6#0
h=.h+ buckets histogram data
s=.s+ +/ data
t=.t+ +/(data-0.5)^2
end.
data=. ?(1e6|y)#0
h=.h+ buckets histogram data
s=.s+ +/ data
t=.t++/(data-0.5)^2
smoutput (<.300*h%y)#"0'#'
(s%y),%:t%y
)

View file

@ -0,0 +1,36 @@
meanstddevP 1000
#############################
####################################
###########################
##############################
###################################
########################
###########################
############################
################################
##########################
0.488441 0.289744
meanstddevP 10000
##############################
##############################
#############################
#############################
###############################
##############################
############################
##############################
#############################
#############################
0.49697 0.289433
meanstddevP 100000
#############################
##############################
#############################
#############################
#############################
##############################
##############################
##############################
##############################
#############################
0.500872 0.288241