STACK: inputs with forgotten * in front of parenthesize

STACK: inputs with forgotten * in front of parenthesize

by Benjamin Marussig -
Number of replies: 8
Hello,

I do have a question regarding the validation of student input:

In a nutshell, I am asking my student to input a combination of different Variables. A simplified example input may be: a*(b+c).
Some students forgot to include the multiplication operation, i.e., the input was a(b+c). This wrong input leads to wrong evaluations and errors in the feedback.

Is there a way to aviod this behaviour? My first guess was to include "a(" to the "Forbidden words" but this did not work unforunately.

Thanks,
Ben

Average of ratings: -
In reply to Benjamin Marussig

Re: STACK: inputs with forgotten * in front of parenthesize

by Christopher Sangwin -
Picture of Particularly helpful Moodlers Picture of Plugin developers
Yes Ben, this is a common situation. Check out the "Insert Stars" options in https://docs.stack-assessment.org/en/Authoring/Inputs/
In reply to Christopher Sangwin

Re: STACK: inputs with forgotten * in front of parenthesize

by Benjamin Marussig -
Thanks for the quick reply and the hint with the "Insert Star" options!

I tried them, and they worked well in most cases, but not in the case of parenthesizes. Taking the example from above using the option "Insert *s assuming single character variable names": a(b+c) is interpreted as a(b+c) without an included * and the list of identified variables only lists b and c.
Am I using the options wrong, or are parenthesizes particularly tricky?
In reply to Benjamin Marussig

Re: STACK: inputs with forgotten * in front of parenthesize

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
If I re-wrote your example as

f(x+1)

would that help your realise why the sybol before the bracket cannot always to assumed to be a variable?
In reply to Tim Hunt

Re: STACK: inputs with forgotten * in front of parenthesize

by Benjamin Marussig -
Well, good point.
So I conclude that the "Insert Star" options cannot treat this automatically. But is there a way to identify "a(" as an invalid input if I know the "a" is a variable? (This is what I tried initially by adding "a(" to the "Forbidden Words".)
In reply to Benjamin Marussig

Re: STACK: inputs with forgotten * in front of parenthesize

by Martin Kraska -
At least you could try to indicate in the validation field what STACK understood. Set question option display multiply as dot instead of blank should give you a.(b+c) if the input was understood as a product and a(b+c) if it was understood as a function call.

To produce appropriate feedback, you probably have to analyze the term structure (which I never did but know that it is possible).
In reply to Martin Kraska

Re: STACK: inputs with forgotten * in front of parenthesize

by Benjamin Marussig -
Focusing on the feedback is a good idea. I came up with the following approach: If the student answer "ans1" is wrong, I add a node to the response tree that converts "ans1" to a string and substitutes "a(" by "a*(", where "a" is the known variable name.

an1str: sconcat(ans1);
an1strNew: ssubst("a*(","a(",an1str);

When slength(an1ster) is not equal to slength(an1strNew), the studnet get a hint to check the input.

It is of course not a perfect solution, but I think it will do the job in my case.
In reply to Tim Hunt

Re: STACK: inputs with forgotten * in front of parenthesize

by Christopher Sangwin -
Picture of Particularly helpful Moodlers Picture of Plugin developers
I've been asked before, and it is on my list, to add a setting for "assume no user-defined functions" which will allow things like f(ax+b) to be interpreted as f*(a*x+b) but sin(ax)->sin(a*x) (not s*i*n(a*x) of course). But asin(x) is a function not a*sin(x). This open does not solve all problems.

To be honest I added "insert *s" with a heavy heart because it probably sets up misconceptions for the future. My university students need to interact with a machine and probably should explicitly record multiplication as quite distinct from function application. Of course multiplication and addition are the most common functions. I've even been asked for an option to interpret "2 1/2" as 2+1/2, which is actually quite reasonable because a lot of elementary books use it.

Traditional notation is a mess.
In reply to Christopher Sangwin

Re: STACK: inputs with forgotten * in front of parenthesize

by Benjamin Marussig -
At this point, thanks for the development of STACK and the great support. We have used STACK this year for the first time and had hundreds of students providing thousands of different answers. So it is really astonishing that the multiplication issue addressed in this post was the only problem popping up in a handful of students.