In math, we may talk about functions having a “Domain”, a “Codomain”, and a “Range”.:

  • The Domain is the set of possible inputs to the function.
  • The Codomain is the set of all possible outputs of the function
  • The Range is the set of actual outputs the function produces

For example, in the continuous function \(y = x^2\), the Domain and Codomain are both the set of real numbers (ℝ) but the Range is restricted to the set of positive real numbers (+ℝ).

In week 2, we plotted some functions by creating lists of points such that \(\langle x, y \rangle = \langle x, f(x) \rangle\). In doing this, we were approximating these real-value functions as discrete functions.

In the starter project for this assignment, you are provided with a List<Integer> containing the integers -300 to +300 (the Domain). Using the four functions you graphed in assignment 2.2, create a List<Integer> containing the output of each function for each element of the Domain and create a Set<Integer> containing the Range of the function. Output the minimum value, maximum value, and the size of each list and set.

For discussion purposes only, consider the circumstances underwhich the List and the Set have the same size and under which they have different.