(I posted this in the mathematics tools forum, but I am told it should be posted in this Quiz forum) Sorry if you get it twice...
After being bugged by me for some time, my husband (Greg Mushial – a software writer of 43 years, and member of this Moodle community) has put together an algebraic expression evaluator such that my students can enter math expressions in different formats and be appropriately graded by Moodle if the answer is equivalent. Although he develops most of his software in Delphi, he accepted the challenge to work in PHP, and put together a module that hooks into the “SA” of the cloze type questions and evaluates and compares expressions. This question type is my absolute favorite since it gives me freedom from the multiple choice answer format, and allows the student “creativity” in how they answer mathematical expressions.
The code was developed in Moodle 1.9.15 and I have used it in my courses that run on 1.9.10, but given its structure (hooked to the existing SA cloze type question) we believe it should also run in version 2.* (which we will be doing shortly). It is not as powerful as what I have seen of STACK, but it has allowed me a new “dimension” for my math and physics quizzes. It works by interpreting arithmetic expressions, and algebraic expressions in ONE variable (which must be entered as “x”).
I have tested the code extensively in my limited universe of math (and some physics) expressions but we are always worried that some “undocumented features” (bugs) may be too well disguised for us and have escaped out notice. So it would be extremely helpful if some interested instructors could try their own questions and let us know of any problems they observe.
The “equivanswer.php” module hooks into the “SA” (Short Answer) module that serves the “cloze” type questions in Moodle. There is a couple line hook that is added to the short answer module to identify an escape sequence immediately following the equal sign for the expected correct answer. When the “SA” question type contains said sequence, the “equivanswer.php” module is called to perform the evaluation of the entered expression at the numerical values specified by the instructor (when they build the question).
When the student responds to the question, the evaluation (at specified points of the expression’s domain) of the correct answer (entered by the instructor) and that entered by the student, are performed and compared. If the values match within a tight epsilon, the answer is marked as correct.
The person that designs the question must therefore give sufficient and well selected evaluation points within the domain of the expression for the comparison to be of value.
For example, if the expected answer involves a square root, the selection of points for evaluation must produce non-negative radicands; a point of evaluation must not produce a zero in the denominator of a rational expression; etc.
The syntax in this modified form of “Short Answer” questions therefore includes: the escape sequence to identify the answer as an equiv answer type; the expected algebraic expression; the symbol “@” followed by the evaluation points for the algebraic expression (these are comma separated). An example of the syntax is given below:
The student enters the algebraic expression in the “fill the blank” box using the same notation he/she uses in a calculator or graphing tool, and as long as the algebra is correct/equivalent, Moodle will recognize it as such :
I am adding a link to a pdf document with more details on the recognized functions and screen captures on different answers accepted by Moodle as correct.
If there are more instructors interested and willing to try their questions and provide feedback to us, please let me know, and I will add you as a “teacher” in our testing course site. We would like to release a well tested module to the open source Moodle community, thus reducing unexpected results for the users.
Thank you in advance to all those willing to help.
Cristina Berisso and Greg Mushial