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 the default Algebraically Equivalent check. There are three sections in this article:
- When to use the Algebraically Equivalent check?
- Example cases
- How does the Algebraically Equivalent check work?
When to use the Algebraically Equivalent check?
If you want to check whether a student answer is mathematically equal to the correct answer, you should use this check. A simple example would be: "x+x" is considered algebraically equivalent to "2*x".
You can apply this method to:
- exact numbers (e.g. 3 or pi)
- formulas (e.g. 3x+4)
- equations (e.g. y=3x+4)
- vectors and matrices
- unordered collections/lists
Below are two sets of example cases: one for which the Algebraically Equivalent check will indicate the left- and right-hand-side are the same and one for which the Algebraically Equivalent check will indicate the left- and right-hand-side are not the same.
How does the Algebraically Equivalent check work?
The check uses the CAS to check whether the left-hand-side (student answer dependent value) is equivalent to the right-hand-side. Equivalency is defined for each of the input types by the following logic:
- for numbers and formulas it is checked whether the subtracting the simplified left-hand-side and simplified right-hand-side equals to zero. Simplification is done using the mathematical rules within sympy.
- for equations it is checked if the equation on the right-hand-side is the equation of the left-hand-side multiplied by a non-zero constant. Both equations are transformed to a equation of "0=rhs - lhs" and from these equations the right-hand-sides are used to check whether one is the other multiplied by a constant.
- for matrices and vectors the same check as for number and formulas is applied per vector/matrix entry.
- for unordered collections the same check as for number and formulas applies per entry, but the order of the entries on the left and right side do not have to match.
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!