Version: 4.2.1 +
In this exercise we will practise working with Table formulas.
- The Futurama Editor must be installed.
- Completing the tutorial Working with Tables first, is recommended.
- Completing the exercise Average and Boundary Values first, is recommended.
In exercise 1 of this tutorial, we have created a DataTable with the age and income of 20 random people. This DataTable is necessary for this exercise. We will create a function that calculates the standard deviation for the income and the age. The standard deviation is a statistic formula that shows how much variation exists from the average of an array of values.
The standard deviation is defined as follows:
= The symbol that represents the standard deviation
= The values in the array of elements (age or income)
= The average of these values
= The summation symbol
N = The amount of elements in the array
Create a function in Futurama that calculates the standard deviation for the age and income of the table displayed in exercise 1. Therefore you should take the following steps (both for the Income and Age calculations):
- Copy the DataTable from exercise 1
- Use the formula 'SubTable' to create a new table 'Income' or 'Age' with only the corresponding values.
- Create a formula that calculates the average of the values (See exercise 1)
- Create a formula that calculates the squared deviation of the values to the average (first calculate the difference between the values and the average and then take the square of it). The result should be an array.
- Create a formula that calculates the sum of the array-values, and divide this sum by the amount of rows.
- Create a formulat that takes the square root of this result. This formula calculates the standard deviation.
- Use the formula 'Subtable' to create a table with only the values (age or income) needed. It's not possible to calculate the deviations without creating this subselection of the values first. (Maybe future Futurama versions will enable this)
- Table-functions like Sum and RowCounts are listed under the formula type 'Table'. You can select this formula type when you click the 'Select a formula'-button.
- It's possible to select tables as entries for 'normal' functions as well. Therefore you can create the deviation-formula by selecting the normal subtract-function.
- To create the root-function, see the exercise 'Pythagorean Theorem'
- Standard Deviation Age = 14.63
- Standard Deviation Income = 38,230.59
You can download our solution for this assignment by clicking the image at the right. (Futurama 184.108.40.206)
Please note that you can very well have a different solution that is just as good as ours.
If you want some more practise on this subject, you could try the extra exercises below.
We won't provide a solution for these variations, just consider them as a way to further experiment with Futurama.
- (Easy:) Add an argument to the calculation, which defines which standard deviation should be calculated: age or income.
- (Medium:) Add an argument to the calculation, that defines the number of rows that should be taken into account for the standard deviation. Adjust your calculation so that it only takes the number of rows defined by the argument.