Statistics/Basic: Difference between revisions

Content deleted Content added
Added Julia language
m Added Klong example
Line 1,978: Line 1,978:
0.9: +++++++++++++++++++++++++++++++++++++++++++++++++
0.9: +++++++++++++++++++++++++++++++++++++++++++++++++
1.0: +++++++++++++++++++++++++++++++++++++++++++++++++</pre>
1.0: +++++++++++++++++++++++++++++++++++++++++++++++++</pre>

=={{header|Klong}}==
Using the "mu" (mean) and "sd" (standard deviation) functions from the
Klong statistics library:
<lang K>
.l("nstat.kg")
bar::{x{x;.d("*")}:*0;.p("")}
hist10::{[s];#'=s@<s::_x*10}
plot::{[s];.p("");.p("n = ",$x);
(!10){.d(x%10);.d(" ");bar(y)}'_(100%x)*(hist10(s::{x;.rn()}'!x));
.p("mean = ",$mu(s));.p("sd = ",$sd(s))}
plot(100)
plot(1000)
plot(10000)
</lang>
{{out}}
<pre>
n = 100
0.0 *****************
0.1 ******
0.2 ********
0.3 **********
0.4 ***********
0.5 *********
0.6 ***********
0.7 **********
0.8 ******
0.9 ************
mean = 0.482634518758
sd = 0.300804579739938409

n = 1000
0.0 *******
0.1 ********
0.2 ***********
0.3 ***********
0.4 *********
0.5 ***********
0.6 ********
0.7 ************
0.8 **********
0.9 ********
mean = 0.510119356421
sd = 0.277396945925369919

n = 10000
0.0 **********
0.1 *********
0.2 *********
0.3 **********
0.4 *********
0.5 **********
0.6 *********
0.7 *********
0.8 **********
0.9 **********
mean = 0.49854591894824
sd = 0.290375399458904972
</pre>


=={{header|Kotlin}}==
=={{header|Kotlin}}==