Note: You are currently viewing documentation for Moodle 2.0. Up-to-date documentation for the latest stable version is available here: Algebra question type.

Algebra question type

From MoodleDocs
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

The algebra question type allows algebraic expressions for student answers which are evaluated by instructor provided answers using the basic rules of algebra. It was first offered as contributed code in July 2009.

Overview

This is a new question type for Moodle. It implements an algebraic question type where student responses are treated as an algebraic expression and compared to instructor provided answers using the basic rules of algebra. For example if the instructor provided response is then a student entering will have their answer treated as matching. The code has been tested in production use with ~230 first year physics students without problems (using the evaluate comparison method only) - mainly thanks to some excellent feedback and testing from Moodle users on the quiz forum before deployment!

Three comparison methods are provided:

  • Evaluation: this is the default and best tested method. It "cheats" by evaluating both the answer and the student response for various random combinations of the variables and ensures that both match to within tolerance at all points.
  • Sage: This method requires the external, open source Sage symbollic algebra system to be installed. A simple XMLRPC server script in Python is included in the package, sage_server.py, and this provides a method to symbollically compare two expressions. (NOT RECOMMENDED FOR PRODUCTION USE)
  • Equivalence: this uses the internal PHP algebra parser to compare the two expressions. It was intended for use in "expand..." and "factor..." type questions where a full symbollic comparison would allow the student to enter the unexpanded (or unfactorized) expression. (NOT RECOMMENDED FOR PRODUCTION USE)

Current Features

  • The students enter responses in a text box, like calculated and numeric questions
  • The formula they entered is rendered in the box below by clicking on a button.
  • Option of three different comparison methods: SAGE, Evaluation or Equivalence.
  • Support for multiple answers so partial credit or assistance can be provided to students.
  • Core functionality works entirely within Moodle - external programs are optional
  • Works with Moodle 1.9

New Features Coming Soon

  • Full, secure Moodle network server implemented in Python to allow connection to Sage.
  • Separate the evaluated Algebra and symbollic Sage question types.
  • Enable disallowed expressions for Sage to enable factorize, expand etc. type questions.
  • Enable use of datasets in Sage question type so that algebraic expressions can vary e.g. "Differentiate {a}x^{n} wrt x" where {a} and {n} will be allowed to vary as they do in calculated questions.
  • Add Sage filter to allow embedding of 2D and 3D plots in Moodle text e.g. <sage>plot_1d_function(x^2,-1,1)</sage> will insert a plot of the function between x=-1 and x=1.

This version is almost complete - all the basic functionality is present and the new question type is currently being coded....

Installation

  • Unzip the zip file into the <moodle root>/question/type directory. You should end up with a directory named <moodle root>/question/type/algebra.
  • Login as an administrator and visit the admin page (http://<my moodle>/admin). This will perform the required database updates to support the question type.
  • Go to a course, click on question and select the new Algebra question type to add.

NB: If you wish to test the current Sage functionality you will also need to install Sage as well as run the python serer code with the command "sage - python sage_server.py". Additionally the questiontype.php file wil need to be edited by hand to point to the server machine and port. This is not for the faint of heart and should not be used in a production system. The full functionality is available without Sage though: just use the evaluate method.

Troubleshooting

  • Failed to load question options from the table question_algebra for questionid <n>: this usually occurs because you have entered an algebra question into Moodle without having visiting the admin page (http://<my moodle>/admin) to setup the database first. To fix it go to the admin page while logged in as an administrator to setup the database. Any existing algebra questions that were added (via editing or import) before this will need to be deleted since they are missing important information.

See also