Grasple has multiple check methods using the Computer Algebra System (CAS) which can be used within the editor to indicate when the answer of a student should be marked correct/incorrect. A full list of current options can be found in this article.
This article covers four comparison checks: Greater Than, Greater Than or Equal, Less Than, and Less Than or Equal. There are three sections in this article:
- When to use a comparison check?
- Example cases
- How do the comparison checks work?
When to use a comparison check?
If you want to check how the student answer compares to a given number. There are four different methods of checking available which implement four equality relations:
- Greater Than: implements >
- Greater Than or Equal: implements >=
- Less Than: implements <
- Less Than or Equal: implements <=
All comparison checks perform an element-wise comparison check. This means that the check depends on the type of the Left Hand Size (LHS), which is usually the answer of a student. The following rules apply:
- if the LHS is a list all elements of the list are compared in isolation,
- if the LHS is a matrix all elements of the matrix are compared in isolation,
- otherwise the LHS is treated as a single expression.
This method performs an element-wise check of values, the following screenshot shows some examples:
How do the 'compared to' checks work?
The CAS first transforms the input into a list, either by taking out all the values of a matrix or creating a list of the single expression. Then, the CAS loops over all elements in the list and compares the elements based on the chosen operator (after simplification). Simplification is done using the mathematical rules within CAS.
Do you want to know more about this check, whether you should use it for your exercise or any of the other checks? Please let us know via the chat icon in the right bottom of the screen!