All published worksheets from http://sagenb.org
Image: ubuntu2004
First, we just get 10 random numbers.
Min and max:
We can calculate the mean directly from the formula. The "len(data)" just gives us how many data points we have.
We can also calculate the sample standard deviation directly from the definition. Note that we use the mean that we calculated above.
Then the sample standard deviation is the square root of the sample variance.
We can also calculate some of these quantities using libraries in Sage.
When calculating the sample standard deviation, remember that we divide by . By default, the "std" function calculates the population standard deviation (i.e., it divides by ). To get the sample standard deviation, we say "ddof=1". Then the standard deviation is calculated by dividing by .
To calculate the quartiles (or any percentile), use the "scoreatpercentile" function and pass the percentile as an integer between 0 and 100.