# Difference between revisions of "Formulas question page"

*Note: You are currently viewing documentation for Moodle 3.3. Up-to-date documentation for the latest stable version of Moodle is probably available here: Formulas question page.*

Line 1: | Line 1: | ||

− | + | [https://docs.moodle.org/33/en/Formulas_question_type < Formulas question type] | |

The Formulas question page, titled '''Adding a formulas question''', appears when a new Formulas question is added to a quiz. The page is titled '''Editing a formulas question''' when editing. To edit an existing question, simply click on the question. | The Formulas question page, titled '''Adding a formulas question''', appears when a new Formulas question is added to a quiz. The page is titled '''Editing a formulas question''' when editing. To edit an existing question, simply click on the question. |

## Revision as of 00:50, 8 December 2017

The Formulas question page, titled **Adding a formulas question**, appears when a new Formulas question is added to a quiz. The page is titled **Editing a formulas question** when editing. To edit an existing question, simply click on the question.

The Formulas question page is shown below and the main settings, indicated by orange arrows, are described in order. Note that *global* settings affect the entire question, while *local* settings affect only each part. Settings marked with an asterisk must be defined.

Only Part 1 is shown. To see other parts, click on the **Blanks for 2 more parts** button.

## Contents

## Random variables

Random values can be generated each time a question is created. This is done by defining a set of values to choose from, for example:

A = {1,2,3}; C = {[1,-1], [2,-2], [3,-3]}; E = {10:100:10, 100, 1000};

Values can be numbers, strings, lists of numbers, or lists of strings. At the beginning of a quiz, a value is taken in the set and assigned to the variable. Range notation may be used for sets of numbers, e.g. 10:100:10 (=[10,20,30,40,50,60,70,80,90]).

## Global variables

Formulas can be specified here to manipulate instantiated random variables (all random variables are included here) and define global variables. The complete list of mathematical functions and operations is given in the **Reference**.

Examples:

a = 1.11111; b = exp(3); c = A + a + b; d = sin(1.5*pi()) + c; e = round(a, 0); f = [0,1,2,3][A]; g = ["zero","one","two","three"][A]; distance = sqrt(a*a + b*b);

## Question text*

Global variables and placeholder can be used in the question text. Global variables are replaced by their values, and placeholders are replaced by the corresponding parts. A simple example with variables A, B, C and placeholders #1, #2, #3 is shown below:

What is the result of {A} + {B}? {#1} What is the result of {A} - {B}? {#2} What is the result of {C} / {B}? {#3}

## Part's mark*

The mark for the answer in this part. This mark must be a value greater than 0. The score for the whole question is the sum of the marks for each part.

Note that if the part mark is left blank, the part will be deleted when the question is saved successfully.

## Local variables

Local variables can be defined here in the same way as global variables. The scope includes local and global variables. These can be used in the answer, grading variables, part's text and feedback. Note that each part has its own scope of local variables.

## Answer type

There are four types of answers. Number, numeric and numerical formula require a list of numbers as an answer. The algebraic formula requires a list of strings (formula) as the answer.

Different types of answers impose different restrictions when entering responses. Therefore, students need to know how to enter answers. The format check will also tell them when they enter an answer incorrectly. Please refer to the other documents for more details.

## Answer*

The answer consists of a list of numbers or a list of strings, depending on the answer type. The number of elements in the list defines the number of answer boxes for this part.

Examples:

123 [1, 0, 0, 1] a [1, a, b] "exp(-a t)" ["vx t","vy t - 0.5 a t^2"]

## Grading variables

The scope includes local variables and the student answers. See the other documents for this advanced feature.

## Grading criteria*

A relative error or an absolute error with an error range can be chosen. Note that a relative error can not be used with the algebraic answer type. See the other documents for the precise definition of relative error and absolute error.

## Units

The unit can be specified here.

## Other rules

Conversion rules for other accepted base units. See the other documents for this advanced feature.

## Placeholder name

The placeholder is used to identify the location in the main question text where it is replaced by the content of the part. The name of the placeholder consists of an alphanumeric character string preceded by #, for example #1, #2a, #2b, and #A.

If this field is left empty, the content of the part is added at the end of the main question text.

## Part's text

The part text and answer box arrangement can be specified here. The answer box placeholders that can be used are:

{_0} {_1} {_2} ... {_u}

{_0}, {_1}, {_2} are the input boxes for the numbers and {_u} is the input box for the unit. Any missing answer box is automatically added at the end.

If there is only one numerical response and one unit, and if {_0} and {_} are placed side by side, the input boxes are combined into a single long box for the answer and the unit.

## [Global] - Deduction for wrong unit (0-1)

This setting specifies the deduction (penalty) that is applied for a wrong unit. The value of the deduction ranges between 0 to 1.

- If the value is 1, both the answer and the unit must be correct in order to get a full mark.
- If the value is 0, no deduction is applied for an incorrect unit.
- If the value is between 0 and 1, it is deducted as a penalty when the unit is incorrect. For example, if the value of the deduction is set to 0.1, a 10% deduction is applied on the mark when the unit is incorrect.

## [Global] - Basic conversion rules

The Formulas question type has a build-in unit conversion system and has basic conversion rules. The basic system is the **Common SI units** which converts standard units, for example those for length (km, m, cm and mm). This option has no effect if no unit is used.