Note: You are currently viewing documentation for Moodle 3.9. Up-to-date documentation for the latest stable version of Moodle may be available here: Formulas question type.

Formulas question type

From MoodleDocs

Is this really the question type for you?

The Formulas question type is a plugin for Moodle with random values and multiple answer fields. The answer fields can be placed anywhere in the question so that you can create questions involving various answer structures such as coordinate, polynomial, matrix, etc. Other features such as unit checking and multiple subquestions are also available. These functionalities can simplify the creation of questions in many fields related to mathematics, numbers and units, such as physics and engineering.

If you are dealing with problems such as those described below, then the Formulas question type is for you!

Take a problem in structural engineering, for example, that may involves several parameters with a number of possible fixed and known values, such as:

 Parameter                       Possible values
 Bolt diameter (mm)              16, 20, 22, 24, 27, 30, 36
 Plate thickness (mm)            16, 20, 25, 35, 40, 50
 Steel strength (MPa)            300, 345, 350, 380
 Concrete strength (MPa)         20, 25, 30
 Reinforcing bar diameter (mm)   9.5, 12.7, 15.9, 19.1, 22.2, 25.4

A question that involves the five parameters, each with their possible values, has 7 x 6 x 4 x 3 x 6 = 3024 different possible versions, much more than the limit of 100 in the Calculated question.

Even a simple question in basic mathematics can have a large number of possible versions. The following one has 5 x 5 x 8 = 200 different possible versions:

  Find the value of x = a*(b + c)
  where
   • a is an odd number between and including 1 and 9
   • b is an even number between and including 2 and 10
   • c is an integer value between and including 1 to 3 or 7 to 11

This kind of question can be easily created using the Formulas question. When creating the question, you would enter your sets of numbers in the 'Random variables' field as:

  a = {1:10:2};
  b = {2:11:2};
  c = {1, 2, 3, 7:12};

Note that sets of numbers can be in the format {start:stop:interval}, for example {1:10:2} and {2:11:2}. (The stop value is not included in the set and the interval is set to 1 when not specified). Sets of numbers can also be in the format of a list such as {1,2,3} for the set of numbers 1, 2 and 3. They can even be in a combination of the two formats, such as {1, 2, 3, 7:12}.

When an attempt is started, a, b, and c will take a value drawn from the corresponding set at random. If you want, you can define other variables as a function of the random ones in the 'Global variables' field. For instance, if you need the value of a + 2*b somewhere in your question (that is the main question, subquestions, hints and feedbacks), just define a new variable, say d, in the 'Global variables' field:

  d = a+2*b;

Once you have defined your variables, you can display them by putting them in curly braces, i.e. {a}, {b}, {c}, {d}, anywhere in the question.

Another advantage of the Formulas question is that a question can have several subquestions, called ‘parts’, that can share the same variables. The Formulas question also has a complete unit system that is quite useful for physics and engineering.

Learning the basics of the Formulas question is very easy. Once you master a bit this question type, you will realize how simple it is to use, and how efficient and comprehensive it is.

Acknowledgments

The Formulas question was originally written by Hon Wai Lau in about one year during 2009 and 2010, while he was working for the Physics Department at the Hong Kong University of Science and Technology.

Hon Wai Lau's Formulas question original project can be found on Google Code Archive. Note that the initial name 'Coordinate question ' was later changed to 'Formulas question'. Hon Wai Lau's original Formulas question is compatible with Moodle 1.9 and 2.0.

The Formulas question was upgraded to the new question engine, introduced in Moodle 2.1, by Jean-Michel Védrine, professor of Statistics and Computing at the Institut Universitaire de Technologie in Saint-Étienne, France. The upgraded version of the Formulas question is compatible with Moodle 2.3 and later versions, currently up to Moodle 3.1.

The current Formulas question project can be found on GitHub.

Documentation

Documentation for the Formulas question, written by Hon Wai Lo, can be found in his original project on Google Code Archive. The documentation, available only in English, is quite complete and excellent.

Translations available

The Formulas question plugin is available in the following langages:

  • English
  • French
  • Spanish (Mexican)

Installation

The Formulas question is a Moodle plugin, so you or your Administrator must install it.

Prior to installing the Formulas question though, you need to install install another plugin, that is Tim Hunt's adaptive multipart behaviour, available from GitHub or from the Moodle Plugins directory. Note that you need version 3.3 or newer of this behaviour, because the Formulas question will not work with previous versions.

You can then install the Formulas question either from the Moodle Plugins directory, from GitHub or from a zip file:

Installing from the Moodle Plugins directory

The Formulas question is available from the Moodle Plugins drectory. Install the Formulas question as any other Moodle question type plugin.

Installing from GitHub

The Formulas question is available at the author's Github repository. To install the question, type the following commands in the root of your Moodle install:

  git clone git://github.com/jmvedrine/moodle-qtype_formulas.git question/type/formulas echo '/question/type/formulas/' >> .git/info/exclude

Installing from a zip file

Download the zip file from GitHub. Unzip the file in the 'question/type' folder and then rename the new folder to 'formulas'.

Examples

  • After you install the plugin, there is a sample-formulas-questions.xml file, with several examples of formulas questions in the 'moodle/question/type/formulas/sample' folder. You can use the Import questions option (Moodle XML) to put them into your Question bank, in order to see how they work.

See also