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

Formulas question type: Difference between revisions

From MoodleDocs
No edit summary
No edit summary
Line 8: Line 8:
|float = left
|float = left
}}
}}
==Usage==
You would enter your 'sets' (called 'lists' in formulas questions) in the 'Random variables' field when creating question as:


a = {100, 125, 150, 175, 200};
==Is this really the question type for you?==
b = {1, 2, 3, 4, 5};
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.
c = {10, 12, 14, 16, 18};


When an attempt is started a, b, and c will take a value drawn from the corresponding list at random.
If you are dealing with problems such as those described below, then the Formulas question type is for you.


You can then define other variables depending of these ones in the 'Global variables' field if you want. For instance if you need the value of a+2*b somewhere in your question text or Combined or general feedback, just define
Take a problem in structural engineering, for example, that may involves several parameters with a number of possible fixed and known values, such as:


d=a+2*b; in 'Global variables'
  '''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


Once you have defined your variables, you can use them in all the question's texts putting them in curly braces (for instance {a}, {b} or {d}). This is true not only for the Question text but also for all feedbacks and hints when you use interactive behaviour (The author thinks that the fact that variables can't be used in calculated question's feedback is a serious problem to give students an appropriate feedback using the values they saw in their attempt)
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.


==Other advantages==
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:
* Another big advantage of formulas questions is that a question can have several 'parts' and all parts using the same variables; and even more, the answer to each part can not only be a number but a vector if you want.
 
* Last thing, formulas questions has a complete unit system that is quite useful for engineering
  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==
==Author==
Line 37: Line 59:


==Translations available==
==Translations available==
This plugin is also available in Mexican Spanish
The Formulas question plugin is available in the following langages:
* English
* French
* Spanish (Mexican)


==Installation==
==Installation==

Revision as of 05:23, 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

Hon Wai Lau

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