STACK Documentation

Documentation home | Category index | Parent | Site map

Author quick start 4: equivalence reasoning

This part of the author quick start guide shows you how to write STACK questions using the line by line equivalence reasoning input type.

As an example, we want the students to expand the cubic \((x+2)^3\) showing their working in a stepwise fashion, line by line. The student's response to this question will allow us to test their knowledge and competency in the following:

  1. Expanding brackets
  2. Simplifiying by collecting like terms

Therefore we need them to show their working.

Minimal working question

Create a new STACK question, give it a suitable name and then copy the following into the Question variables box:


The first variable, p, is the expression in the question. The variable taf is the final model answer. The variable ta is a list containing each step we are expecting our students to express as they work towards the final answer:







  • We use the CAS functions expand() and ev(...,simp) to simply the output of expand(), to determine the model answer.
  • The special function stackeq is replaced by a unary equals symbols. Maxima expects equality to be an infix \(a=b\) not unary prefix \(=b\), so STACK needs this special operator. Students can just start a line with \(=\), but teachers cannot!

In this context the teacher's answer and the student's answer is a list. The whole answer is a single object, which we assess.

Copy the following text into the Question text box:

Setting the input options

Under the Input:ans1 header specify Equivalence reasoning from the Input type drop-down and ta as the model answer.

We want students to work through the expansion one line at a time, so let's include a hint. Copy the following into the Syntax hint box:


This is a list, and uses stackeq.

For students in this context, it is probably sensible to "insert stars" and provide the most forgiving input syntax available, but that is optional.

We need to tell STACK to compare the first line of the student's working to the first line of the question. This makes sure the student "answers the right question". Type firstline into the Extra options box. This ensures a student's response will be invalid if they don't have the correct first line.

Setting the potential response tree

As a minimal potential response tree have one node, with

SAns = ans1
TAns = ta
answer test = EquivFirst
Auto-simplify = no

Note, the Auto-simplify field is not in the node of the PRT, but a PRT option.

Setting the question options

Set question level options

Auto-simplify = no

Save the question. This should be a minimal working question, so preview it and add in at least one question test.

More specific feedback

At this point the question only checks

  1. Has the student started from the right expression, specifically is the first line of their argument equivalent to the first line of ta using EqualComAss test (commutativity and associativity)?
  2. Are all the lines in the student's answer algebraically equivalent.

Clearly, more is needed for a complete sensible question.

At this point please read the equivalence reasoning input type documentation.

Getting to the right place

We probably want the student to end up at the expression \(x^{3}+6x^{2}+8x+8\).

To check is the student has reached this point, add another node to the PRT. If node 1 is true (i.e. the student started in the correct place and didn't make a mistake) then connect to node 2. Node 2 should be set up as

SAns = last(ans1)
TAns = last(ta)
answer test = EqualComAss
Auto-simplify = no

This node adds in feedback to check the student has reached the right place.

Note, by using EqualComAss both \(x^{3}+6x^{2}+8x+8\) and \(x^{3}+x^{2}6+8+8x\) will be accepted. If you really want \(x^{3}+6x^{2}+8x+8\) then you need to use CasEqual as the answer test instead.

What is a legitimate step?

At this point, any expressions which are equivalent are considered to be a legitimate step.

Clearly this is not entirely satisfactory. At this point in the development there is no concept of "a step" and indeed this appears to be very hard to define. In the future we will develop better tools for checkin "step size", and any contributions in this direction are welcome.

Teachers can check the students answer is long enough or not too long by looking at length(ta).

Teachers can check if specific expressions appear somewhere inside the student's answer. For example, you can check that the factored form exists somewhere in the student's answers using the following code in the feedback variables.

foundfac:sublist(ans1,lambda([ex], equationp(ex) and is(rhs(ex)=0)));
foundfac:ev(any_listp(lambda([ex], second(ATFacForm(lhs(ex),lhs(ex),x))), foundfac), simp);

At this stage there are few in-built features within STACK. A lot is possible, but as the above example illustrates, this requires question authors to write more Maxima code than with other question types.

This feature will be developed by use over the next few years. If you have experience, and views, on how this should work please contact the developers.

Documentation home | Category index | Parent | Site map