You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: app/docs/user.md
+185-7Lines changed: 185 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ Note that this function is designed to handle comparisons of mathematical expres
8
8
9
9
### Optional parameters
10
10
11
-
There are eight optional parameters that can be set: `complexNumbers`, `convention`, `criteria`, `multiple_answers_criteria`, `elementary_functions`, `physical_quantity`, `plus_minus`/`minus_plus``specialFunctions`, `strict_syntax`, `symbol_assumptions`.
11
+
There are twelve optional parameters that can be set: `complexNumbers`, `convention`, `criteria`, `elementary_functions`, `feedback_for_incorrect_response`, `multiple_answers_criteria`, `physical_quantity`, `plus_minus`/`minus_plus`,`specialFunctions`, `strict_syntax`, `strictness`, `symbol_assumptions`.
12
12
13
13
## `complexNumbers`
14
14
@@ -36,10 +36,13 @@ The `criteria` parameter reserves `response` and `answer` as keywords that will
36
36
37
37
## `elementary_functions`
38
38
39
-
When using implicit multiplication function names with mulitple characters are sometimes split and not interpreted properly. Setting `elementary_functions` to true will reserve the function names listed below and prevent them from being split. If a name is said to have one or more alternatives this means that it will accept the alternative names but the reserved name is what will be shown in the preview.
39
+
When using implicit multiplication function names with multiple characters are sometimes split and not interpreted properly. Setting `elementary_functions` to true will reserve the function names listed below and prevent them from being split. If a name is said to have one or more alternatives this means that it will accept the alternative names but the reserved name is what will be shown in the preview.
All feedback for all incorrect responses will be replaced with the string that this parameter is set to.
45
+
43
46
## `multiple_answers_criteria`
44
47
45
48
The $\pm$ and $\mp$ symbols can be represented in the answer or response by `plus_minus` and `minus_plus` respectively.
@@ -59,6 +62,147 @@ When `physical_quantity` the evaluation function will generate feedback based on
59
62
60
63
**TODO:** Generate new flowchart for updated physical quantity feedback generation procedure.
61
64
65
+
## `strictness`
66
+
67
+
Constrols the conventions used when parsing physical quantities.
68
+
69
+
**Remark:** If `physical_quantity` is set to `false`, this parameter will be ignored.
70
+
71
+
There are three possible values: `strict`, `natural` and `legacy`. If `strict` is chosen then quantities will be parsed according to the conventions described in 5.1, 5.2, 5.3.2, 5.3.3 in https://www.bipm.org/documents/20126/41483022/si_brochure_8.pdf and 5.2, 5.3, 5.4.2 and 5.4.3 in https://www.bipm.org/documents/20126/41483022/SI-Brochure-9-EN.pdf. If `natural` is chosen then less restrictive conventions are used.
72
+
73
+
**Remark:** The default setting is `natural`.
74
+
75
+
**Remark:** The `legacy` setting should not be used and is only there to allow compatibility with content designed for use with older versions of the evaluation function. If you encounter a question using the `legacy` setting is recommended that it is changed to another setting and the answer is redefined to match the chosen conventions.
76
+
77
+
## `units_string`
78
+
79
+
Controls what sets of units are used. There are three values `SI`, `common` and `imperial`.
80
+
81
+
If `SI` is chosen then only units from the tables `Base SI units` and `Derived SI units` (below) are allowed (in combinations with prefixes). If `common` is chosen then all the units allowed by `SI` as well as those listed in the tables for `Common non-SI units`. If `imperial` is chosen the base SI units and the units listed in the `Imperial units` table are allowed.
82
+
83
+
**Remark:** The different settings can also be combine, e.g. `SI common imperial` will allow all units.
84
+
85
+
### Notation and definition of units
86
+
87
+
#### Table: Base SI units
88
+
89
+
SI base units based on Table 2 in https://www.bipm.org/documents/20126/41483022/SI-Brochure-9-EN.pdf
90
+
91
+
Note that gram is used as a base unit instead of kilogram.
92
+
93
+
| SI base unit | Symbol | Dimension name |
94
+
|--------------|:-------|:--------------------|
95
+
| metre | m | length |
96
+
| gram | g | mass |
97
+
| second | s | time |
98
+
| ampere | A | electriccurrent |
99
+
| kelvin | k | temperature |
100
+
| mole | mol | amountofsubstance |
101
+
| candela | cd | luminousintensity |
102
+
103
+
#### Table: SI prefixes
104
+
105
+
SI prefixes based on Table 7 in https://www.bipm.org/documents/20126/41483022/SI-Brochure-9-EN.pdf
106
+
107
+
| SI Prefix | Symbol | Factor || SI Prefix | Symbol | Factor |
Commonly used non-SI units based on Table 8 in https://www.bipm.org/documents/20126/41483022/SI-Brochure-9-EN.pdf and Tables 7 and 8 in https://www.bipm.org/documents/20126/41483022/si_brochure_8.pdf
153
+
Note that the function treats angles, neper and bel as dimensionless values.
154
+
155
+
Note that only the first table in this section has short form symbols defined, the second table does not, this is done to minimize ambiguities when writing units.
| fluid ounce | fl oz | $28.4130625~\mathrm{millilitre}$ |
198
+
| gill | gi | $142.0653125~\mathrm{millilitre}$ |
199
+
| pint | pt | $568.26125~\mathrm{millilitre}$ |
200
+
| quart | qt | $1.1365225~\mathrm{litre}$ |
201
+
| gallon | gal | $4546.09~\mathrm{litre}$ |
202
+
| ounce | oz | $28.349523125~\mathrm{gram}$ |
203
+
| pound | lb | $0.45359237~\mathrm{kilogram}$ |
204
+
| stone | st | $6.35029318~\mathrm{kilogram}$ |
205
+
62
206
## `plus_minus` and `minus_plus`
63
207
64
208
The $\pm$ and $\mp$ symbols can be represented in the answer or response by `plus_minus` and `minus_plus` respectively.
@@ -81,14 +225,16 @@ By default `strict_syntax` is set to true.
81
225
82
226
This input parameter allows the author to set an extra assumption each symbol. Each assumption should be written on the form `('symbol','assumption name')` and all pairs concatenated into a single string.
83
227
84
-
The possible assumption names can be found in this list:
228
+
The possible assumptions are: `constant`, `function` as well as those listed here:
**Note:** Writing a symbol which denotes a function without its arguments, e.g. `T` instead of `T(x,t)`, is prone to cause errors.
232
+
87
233
## Examples
88
234
89
235
Implemented versions of these examples can be found in the module 'Examples: Evaluation Functions'.
90
236
91
-
### 1 Setting input symbols to be assumed positive to avoid issues with fractional powers
237
+
### Setting input symbols to be assumed positive to avoid issues with fractional powers
92
238
93
239
In general $\frac{\sqrt{a}}{\sqrt{b}} \neq \sqrt{\frac{a}{b}}$ but if $a > 0$ and $b > 0$ then $\frac{\sqrt{a}}{\sqrt{b}} = \sqrt{\frac{a}{b}}$. The same is true for other fractional powers.
94
240
@@ -97,7 +243,7 @@ So if expressions like these are expected in the answer and/or response then it
97
243
The example given in the example problem set uses two EXPRESSION response areas. Both response areas uses `compareExpression` with answer `sqrt(a/b)`, `strict_syntax` set to false, `elementary_functions` set to true. One response area leaves `symbol_assumptions` unset and the other sets the parameter as described in the previous paragraph. Some examples of expressions that are accepted as correct when positivity is assumed:
The $\pm$ and $\mp$ symbols can be represented in the answer or response by `plus_minus` and `minus_plus` respectively. To use other symbols for $\pm$ and $\mp$ set the grading parameters `plus_minus` and `minus_plus` to the desired symbol. **Remark:** symbol replacement is brittle and can have unintended consequences.
103
249
@@ -106,14 +252,14 @@ It is considered good practice to make sure that the appropriate notation for $\
106
252
The example given in the example problem set uses an EXPRESSION response area that uses `compareExpression` with answer `plus_minus x**2 + minus_plus y**2`, `strict_syntax` set to false and `elementary_function` set to true. Some examples of expressions that are accepted as correct:
There is (limited) support for using equalities in the response and answer.
112
258
113
259
The example given in the example problem set uses an EXPRESSION response area that uses `compareExpression` with answer `x**2-5*y**2-7=0`. Some examples of expressions that are accepted as correct:
### 4 Checking the value of an expression or a physical quantity
262
+
### Checking the value of an expression or a physical quantity
117
263
118
264
If the parameter `physical_quantity` is set to true, the evaluation function can handle expressions that describe physical quantities. Which units are permitted and how they should be written depends on the `units_string` and `strictness` parameters respectively.
119
265
@@ -130,3 +276,35 @@ Here the answer is `2.00 km/h`. To restrict the answers to SI units `strictness`
130
276
#### Example (c)
131
277
132
278
Here the answer is `2.00 km/h`. To restrict the answers to imperial units `strictness` is set to `strict` and `units_string` is set to `imperial common`. Accepted response: `1.24 mile/hour`
279
+
280
+
### Changing convention for precedence for implicit and explicit multiplication
281
+
282
+
You can change what convention is used for precedence for explicit and implicit multiplication by setting the `convention` parameter.
283
+
284
+
There are two supported conventions:
285
+
286
+
`equal_precedence` Implicit multiplication have the same precedence as explicit multiplication, i.e. both `1/ab` and `1/a*b` will be equal to `(1/a)*b`.
287
+
288
+
`implicit_higher_precedence` Implicit multiplication have higher precedence than explicit multiplication, i.e. `1/ab` will be equal to `1/(ab)` and `1/a*b` will be equal to `(1/a)*b`.
289
+
290
+
In the examples set there is one response area for each of the two conventions, both with answer `1/ab`. Try `1/ab`, `(1/a)*b` and `1/(a*b)` in both response areas and note the differences in behaviour.
291
+
292
+
### Setting absolute or relative tolerances for numerical comparison
293
+
294
+
`compareExpressions` can be used both for symbolic and numerical comparisons. The default is symbolic comparisons.
295
+
296
+
The evaluation function can be configured to do numerical comparisons in the following ways:
297
+
298
+
- Setting the absolute error tolerance: This is done by setting the parameter `atol`. When `atol` is set to any positive value, then `response` will be considered correct if $|$`answer`$-$`response`$| < $`atol`.
299
+
300
+
- Setting the relative error tolerance: This is done by setting the parameter `rtol`. When `rtol` is set to any positive value, then `response` will be considered correct if $|$`answer`$-$`response`$|/|$`answer`$| < $`rtol`.
301
+
302
+
**Note:** If the response area is used to compare physical quantities (i.e. the parameter `physical_quantity` is set to `true`) comparisons will be numerical be default (since unit conversion has finite precision).
303
+
304
+
#### Setting the absolute tolerance
305
+
306
+
In the following response area the absolute tolerance (`atol`) has been set to $5$. There are three correct answers: $\sqrt{47}+\pi$ (approx. 9.9997), $\frac{13}{3}^{\pi}$ (approx. 99.228) and $9^{e+\ln(1.5305)}$ (approx. 1000.05). Any answer within the set absolute tolerance (i.e. $5<$`response`$<15$, $95<$`response`$<105$ or $995<$`response`$<1005$) of either answer will be considered correct.
307
+
308
+
#### Setting the relative tolerance
309
+
310
+
In the following response area the absolute tolerance (`atol`) has been set to $0.5$. There are three correct answers: $\sqrt{47}+\pi$ (approx. 9.9997), $\frac{13}{3}^{\pi}$ (approx. 99.228) and $9^{e+\ln(1.5305)}$ (approx. 1000.05). Any answer within the set absolute tolerance (i.e. $5<$`response`$<15$, $95<$`response`$<105$ or $995<$`response`$<1005$) of either answer will be considered correct.
0 commit comments