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
+95-2Lines changed: 95 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -254,7 +254,7 @@ The example given in the example problem set uses an EXPRESSION response area th
254
254
255
255
### Equalities in the answer and response
256
256
257
-
There is (limited) support for using equalities in the response and answer.
257
+
There is (limited) support for using equalities in the response and answer. More precisely, if the answer is of the form $f(x_1,\ldots,x_n) = g(x_1,\ldots,x_n)$ and the response is of the form $\tilde{f}(x_1,\ldots,x_n) = \tilde{g}(x_1,\ldots,x_n)$ then the function checks if $f(x_1,\ldots,x_n) - g(x_1,\ldots,x_n)$ is a multiple of $\tilde{f}(x_1,\ldots,x_n) / \tilde{g}(x_1,\ldots,x_n)$.
258
258
259
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:
@@ -307,4 +307,97 @@ In the following response area the absolute tolerance (`atol`) has been set to $
307
307
308
308
#### Setting the relative tolerance
309
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.
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.
311
+
312
+
### Using complex numbers
313
+
314
+
If the parameter `complexNumbers` is set to true then `I` will be interpreted as the imaginary constant $i$.
315
+
316
+
In the example set there is a response area with `complexNumbers` set to `true` and answer `2+I`. An input symbols has also been added so that `I` can be replaced with `i` or `j`.
317
+
318
+
Any response that is mathematically equivalent to $2+i$ will be accepted, e.g. `2+I`, `2+(-1)^(1/2)`, `conjugate(2-I)`, `2sqrt(2)e^(I*pi/4)+e^(I*3*pi/2)` or `re(2-I)-im(2-I)*I`.
319
+
320
+
**Note:** If the particular way that the answer is written matter, e.g. only answers on cartesian form should be accepted, then that requires further configuration, see the example *Syntactical comparison*.
321
+
322
+
### Using `constant` and `function` assumptions
323
+
324
+
Examples of how to use the `constant` and `function` assumptions for symbols.
$$\alpha k \frac{\partial^2 T}{\partial x^2}+ \alpha \dot{q} = k \frac{\partial T}{\partial t}$$
335
+
336
+
In general, if both the response and the answer are equalities, i.e. the response is $a=b$, and the answer is $c=d$, `compareExpressions` compares the answer and respose by checking if $\dfrac{a-b}{c-d}$ is a constant, i.e. it is assumed that $a-b$ and $c-d$ are not simplifyable to zero without assuming $a-b=c-d=0$.
337
+
338
+
By default `compareExpressions` assumes that symbols are independent of each other, a consequence of this is that derivatives will become zero, e.g. $\dfrac{\mathrm{d}T}{\mathrm{d}t} = 0$. This can be prevented by assuming that some symbols are functions (a symbol assumed to be a function is assumed to depend on all other symbols). In this example we want to take derivatives of $T$ and $q$ so we add `('T','function') ('q','function')` to the `symbol_assumptions` parameter.
339
+
340
+
Taking the ratio of the given answer and the example response gives:
341
+
$$ \frac{\frac{\partial^2 T}{\partial x^2}+\frac{\dot{q}}{k} - \frac{1}{\alpha}\frac{\partial T}{\partial t}}{\alpha k \frac{\partial^2 T}{\partial x^2}+ \alpha \dot{q} - k \frac{\partial T}{\partial t}} = \alpha k $$
342
+
343
+
By default $\alpha$ and $k$ are assumed to be variables so the ratio is not seen as a constant. This can be fixed by addding `('alpha','constant') ('k','constant')` to the `symbol_asssumptions` parameter.
344
+
345
+
The make it simpler and more intuitive to write valid reponses we add the following input symbols:
Typically `compareExpressions` only checks if the response is mathematically equivalent to the answer. If we want to require that the answer is written in a cetain way, e.g. Cartesian form vs. exponential form of a complex number or standard form vs factorized form of a polynomial, further comparsions need to be done. There are some built in standard forms that can be detected, as well as a method that tries to match the way that the response is written in a limited fashion. Either method can be activated either by setting the flag `syntactical_comparison` to `true`, or by using the criteria `response written as answer`.
381
+
382
+
#### Standard forms for complex numbers
383
+
384
+
For complex numbers there are two known forms, Cartesian form, $a+bi$, and exponential form, $ae^{bi}$.
385
+
386
+
For either form the pattern detection only works if $a$ and $b$ are written as numbers on decimal form, i.e. no fractions or other mathematical expressions.
387
+
388
+
The example set has two response areas, one with an answer written in Cartesian form ($2+2i$) and one with the answer written in exponential form ($2e^{2i}$). For both response areas the parameter `complexNumbers` is set to `true` (so that `I` will be treated as the imaginary constant) and `syntactical_comparison` is set to `true` (to activate the syntactical comparison). There is also an input symbol that makes `I`, `i` and `j` all be interpreted as the imaginary constant $i$. The evaluation function automatically detects the form of the answer and uses it as the basis of the comparison.
389
+
390
+
#### Arbitrary syntactical comparison by comparing the form of the response to the form of the answer
391
+
392
+
If the answer is not written in a known form the evaluation function assumes that any response that we can get by taking the answer and replacing any numbers in it with other numbers is considered to be written in the same form. For example, if the answer is `(x-4)^2+5` then any expression written as `(x-A)^B-C` where `A`, `B` and `C` are replaced with non-negative numbers will be considered to be written in the correct form, see the table below for some examples.
**Note:** This type of comparison is quite limited in many cases and may need to be augmented with extra feedback cases or customised feedback for incorrect responses that clarifies the specifics of the expected form.
0 commit comments