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

Formulas question type: Difference between revisions

From MoodleDocs
No edit summary
Line 50: Line 50:


==Author==
==Author==
[https://moodle.org/user/view.php?id=1069069&course=5 Hon Wai Lau]
The Formulas question was written by [https://moodle.org/user/view.php?id=1069069&course=5 Hon Wai Lau].
 
At the date of this writing (2016), versions for Moodle 1.9 and 2.0 are still available at the original author website at the following address:
  https://code.google.com/p/moodle-coordinate-question/downloads/list
where 'Coordinate question' was the name, which is no longer used, of the first version of the Formulas question.


==Updates, maintenance and revisions==
==Updates, maintenance and revisions==

Revision as of 05:32, 15 August 2016

Is this really the question type for you?

This is a question type 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} such as {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.

Author

The Formulas question was written by Hon Wai Lau.

At the date of this writing (2016), versions for Moodle 1.9 and 2.0 are still available at the original author website at the following address:

 https://code.google.com/p/moodle-coordinate-question/downloads/list

where 'Coordinate question' was the name, which is no longer used, of the first version of the Formulas question.

Updates, maintenance and revisions

Jean-Michel Védrine

Moodle versions

2012062500 (Moodle 2.3) or newer

Translations available

The Formulas question plugin is available in the following langages:

  • English
  • French
  • Spanish (Mexican)

Installation

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.

Drawbacks

  • Mastering formulas questions is difficult, there is a learning curve
  • Documentation is not very good, it was written by Hon Wai Lo (original author of the formulas questions for Moodle 1.9 and 2.0, Jean-Michel Védrine upgraded it for Moodle 2.3 to 2.8), unfortunately Jean-Michel Védrine never had time to improve it
  • It's a Moodle plugin, so you must install it (or your administrator must do it). Plugin is available in the Moodle plugins Directory, you could also download it from the author's Github repository. And you must install another plugin (Tim Hunt's adaptive multipart behaviour) so that it works.
  • As any addon, you will be dependent in the future of the maintainer to upgrade it when a new Moodle version is released

FAQ

Is there a way to indicate the number of significant figures in a formulas question?

Dominique Bauer has worked around the fact that sigfig is not (yet) implemented in the Formulas question type by coming up with the following very short variable assignment which works with any real number:

xr=x==0?x:round(x*pow(10,nsf-1-floor(log10(abs(x)))),0)*pow(10,-nsf+1+floor(log10(abs(x))));

where nsf is the number of significant figures. See https://moodle.org/mod/forum/discuss.php?d=274975#p1181946

See also