Practicing with sets and / or intervals
Do you want to let your students practice with sets and / or intervals? This article explains how this can be done within Grasple. Written by Eric Bouwers
Updated over a week ago

Using the capabilities of the Computer Algebra System (CAS) behind Grasple it is possible to create exercises that allow your students to practice with sets and / or intervals. Below we explain all ins-and-outs of the support of these constructs within the platform.

# Set syntax and operators

Sets are supported in the platform via the use of the bracket notation, i.e. {1, 2} denotes the set of integers 1 and 2. These expressions can directly be used within an answer box. The following operators are currently supported for sets:

As usual, the algebraic equality will evaluate whether two expressions are the same. This means that the following expressions are considered to be equal:

Combining operators

The precedence of the union, intersection, and relative complement operators between sets is not clearly defined. Because of this, the system raises a semantic error when you combine different operators on a single level. So be sure to be explicit, for example:

Note that expressions such are {1} ∪ {3} ∪ {2} are not problematic and are considered to be valid.

## Complement and sets

There are no assumptions made within Grasple what the universal set is when a complement of a set is given (e.g. "{1,2}^c").
As a consequence a complement of a set (e.g. "{1}^c") will not be algebraically equivalent to an expression assuming the universal set are all real numbers (e.g. "(-infinity, 1) union (1, infinity)").

Interval expressions do assume that the universal set are all real numbers. See explanation about interval expressions further down in this article.

## Sets versus lists

Note that we only support sets with curly braces, brackets such as [1,2,3] are seen as a list and thus not equal to a set. Other expressions which are not equal are:

# Interval syntax

The platform supports all three forms of interval notation:

Naturally, unbounded intervals can also be defined as (-∞,∞), but note that closed, unbounded intervals such as [2, ∞] are considered to be semantically incorrect and will not be parsed as a valid expression.

## Interval definition

In contrast to sets these expressions cannot be entered in an answer box directly. This is because the expression [0,1] is ambiguous, it can either be a closed interval or a list with two entries.

Because of this, all interval expressions should always be defined as a parameter of type interval. Writing an interval expression directly in an answer field leads to questions that cannot be answered.

To do this, first make sure you enabled template generation in your exercise via the 'more' menu:

Then you can create a new parameter:

After naming the parameter, you can select the interval parameter type:

After choosing the correct type you can define your interval expression, and use the parameter as you would normally do:

## Interval operators

Set operators also work on intervals (and you can even combine them in a single expression). This means that the following expressions are equal:

## Complement and intervals

Interval expressions assume that the universal set are all real numbers. This means that for example "(-infinity, 2)^c" is algebraically equivalent to "[2, infinity)".

# Combining sets and intervals

If desired, sets and intervals can be combined. For example, the following equation holds:

Hopefully this support allows you to create meaningful exercises for your students. As always, if you have any questions please reach out to us via the chat icon in the bottom right.

Complement for a combination of intervals and sets
When an expression combines sets and intervals, no assumption is made about what the universal set.