News
Working with MUMIE as author
- Initial steps:
- Articles:
- Problems:
- Programming with Python
- New Visualizations with JSXGraph
- Old Visualizations:
- Media Documents:
Working with MUMIE as teacher
Using MUMIE via plugin in local LMS
FAQ
You're not logged in
Working with MUMIE as author
Working with MUMIE as teacher
Using MUMIE via plugin in local LMS
FAQ
Every answer must be defined in an answer environment and will be represented by a single input field for entering values. Answers must use the \solution{
The precision in the generic problem is divided into:
There are three options for comparing the real answer with the solution:
If you use this option, make sure you tell the user that they must round the result with the given precision
Optionally, one can use the following commands within the answer environment:
The following example shows a question with a number as input which has one single constant as an answer:
1234567891011121314151617181920212223 \begin{question}
\begin{variables}
\function{f}{a/b}
\number{a}{11}
\number{b}{16}
\end{variables}
\type{input.number}
\field{real}
\displayprecision{3}
\correctorprecision[rounded]{3}
\text{Determine the decimal expansion of $\var{f}$ correct to three decimal places.}
\explanation{Think about what rounded off to three decimal places means.}
\begin{answer}
\text{Answer: }
\explanation{The explanation that belongs to this specific answer}
\solution{f}
\end{answer}
\end{question}
In the above example the following commands where used.
\correctorprecision
and \displayprecision
respectively.\precision
when comparing the correct solution with the user's answer.\precision
when displaying real numbers on the screen. Logically displayprecision $$\geq$$ correctorprecision123 % Real numbers will be shown with 4 digits behind the decimal mark,
% but correct with only 2 (default).
\displayprecision{4}
123 % The following is NOT allowed,
% since displayprecision (default 2) is now smaller then the correctorprecision
\correctorprecision{4}
If the question has the type input.function, then it is appropriate to compare the user's answer numerically with the pre-given solution.
This can be done using the command \checkAsFunction
. Here is an example:
1234567891011121314151617 \begin{question}
\begin{variables}
\function{f}{x^2+7*x}
\end{variables}
\type{input.function}
\field{real}
\text{Enter the solution to this problem as a function of x.}
\begin{answer}
\text{Answer: $f =$}
\solution{f}
\checkAsFunction{x}{-10}{10}{100}
\end{answer}
\end{question}
The corrector now compares the values of the function entered by the user to those of the function $$f = x^2+7x$$ at one
hundred randomly chosen points (steps) between -10 (min) and 10 (max) and accepts the solution if and only if
none of these differ by more than the standard $$epsilon = 1E-8.$$ I.e. $$|\text{UserAnswer} - \text{CorrectAnswer}| < 10^{-8}$$
So the syntax is given by \checkAsFunction{ _variable_}{ _min_}{ _max_}{ _steps_}
.
In case you wish to use a different tolerance value epsilon instead of the default 1E-8, you may submit it by an optional parameter:
\checkAsFunction[ _epsilon_]{ _variable_}{ _min_}{ _max_}{ _steps_}
.
In fact, the implemented comparison method uses randomly chosen points (as mentioned), and it does not take into account points, where the function f takes values which are very large.
These points are excluded for reasons of numerical stability. 'Very large' means larger in absolute value than the default $$cutoff = 1E5$$.
If you have to take into account a situation, where the correct result is determined only up to a constant (because the user is expected to find an indefinite integral, e.g.),
you can change the behavior of the method accordingly. So there is another extended syntax:
\checkAsFunction[ _epsilon_ | _cutoff_ | _random_ | _constDiff_ ]{ _variable_}{ _min_}{ _max_}{ _steps_}
.
This is an example:
1 \checkAsFunction[1E-2|1e7|false|true]{x}{-10}{10}{100}
The consequence of using \checkAsFunction
with that syntax is that
With the command \allowForInput[true|false]{<expression list>}
you can decide if some operations or symbols are
permitted/prohibited for answer input. The default value for the optional argument is true. The entries in the
expression list should be separated by blanks. Remarks:
In the following examples (i) sin and _pi_ are excluded from input, so the user can't give the given task as answer.
12345678910111213141516171819202122 \begin{problem}
\begin{question}
\begin{variables}
\function{f}{sin(pi)}
\end{variables}
\type{input.function}
\field{real}
\text{\textit{Compute} $\var{f}$.}
\explanation{}
\begin{answer}
\text{$ \var{f} = $}
\solution{f}
\allowForInput[false]{sin pi}
\end{answer}
\end{question}
\end{problem}
Any answers by a user to a problem (called user input) can be
Additionally the user's input may also be checked numerically using the command checkAsFunction.
How this is done is explained below including an example.
The user's input (answer to a problem) is stored in a variable using the command\inputAsFunction{<variable name>}{<identifier>}
. Hence we can refer to the user input by its identifier.
To check the user's answer
To check the user's answer numerically, you have to use the command \checkAsFunction.
Remarks:
\checkStringsForRelation
you need equal() (see the following example) as part of your conditions if\checkAsFunction
(see above) in addition to achieve a numeric comparison.123456789101112131415161718192021 \begin{problem}
\begin{question}
\begin{variables}
\function{f}{x^2 + 2x + 1}
\end{variables}
\type{input.function}
\field{real}
\text{\textit{Expand the expression} $(x+1)^2$.}
\explanation{}
\begin{answer}
\text{$(x+1)^2 = $}
\inputAsFunction{x}{g}
\solution{f}
\checkStringsForRelation{count(x,g)=2 AND count(+,g)=2 AND count(-,g)=0 AND count((,g)=0 AND equal(g,f)}
\end{answer}
\end{question}
In some cases, the correct user answer is not unique. For instance, if the user is expected to find two functions $$f$$, $$g$$ with $$f[g] = sqrt(2x^2+1)$$ , the number of possible correct answers is unlimited.
So $$f(y) = sqrt(2y+1)$$ with $$g(x) = x^2$$ or $$f(y) = sqrt(y)$$ with $$g(x) = 2x^2+1$$ is correct, as well as $$f = sqrt(y+1)$$ with $$g(x) = 2x^2$$,...
Consider the following code snippet:
1234567891011121314151617181920212223242526272829303132 \begin{problem}
\begin{question}
\begin{variables}
\function{c}{sqrt(2x^2+1)}
\function{f}{sqrt(y)}
\function{g}{2x^2+1}
\end{variables}
\type{input.function}
\field{real}
\text{\textit{Find two functions such that their composition is} $\var{c}$}
\explanation{}
\begin{answer}
\text{$ f(y) = $}
\solution{f}
\inputAsFunction{y}{h}
\end{answer}
\begin{answer}
\text{$ g(x) =$ }
\solution{g}
\inputAsFunction{x}{k}
\checkFuncForZero{h[k]-c}{-10}{10}{100}
\score{2.0}
\end{answer}
\end{question}
\end{problem}
\inputAsFunction{y}{h}
as a new function (of $$y$$) for subsequent use. It cannot be evaluated by its own.\inputAsFunction{x}{k}
as new function $$k$$, and the following command checks, whether $$h[k]$$ coincides numerically with $$c = sqrt(2x^2+1)$$.\checkFuncForZero
checks whether its first argument is zero on the interval from $$- 10$$ to $$10$$, using $$100$$ randomly generated checkpoints. The default precision value is $$1E-8$$.\checkFuncForZero[ _epsilon_ ]{ _expression_ }{ _start_value_ }{ _end_value_ }{ _number_of_checkpoints_ }
.\score
command, since it needs two correctly adjusted inputs. WebMiau example\checkFuncForZero{1-sign( _expression_ ) * theta( _expression_ )}{-10}{10}{100}
.Finally, you may use the syntax $$D[f]$$ to refer to the derivative of a function $$f$$, see the following code
1234567891011121314151617181920 \begin{question}
\begin{variables}
\function{f}{-cos(7x)}
\function{g}{7sin(7x)}
\end{variables}
\type{input.function}
\field{real}
\text{\textit{Find an anti-derivative F of $\var{g}$}}
\explanation{}
\begin{answer}
\text{$F(x) =$}
\solution{f}
\inputAsFunction{x}{k}
\checkFuncForZero{D[k]-g}{-10}{10}{100}
\end{answer}
\end{question}
\inputAsFunction
and \checkAsFunction
accept at first mandatory argument a comma separated list of
variable identifiers instead of only one identifier.
12345678910111213141516171819 \begin{question}
\begin{variables}
\function{f}{x^2+2xy+y^2}
\end{variables}
\type{input.function}
\field{real}
\text{Expand:}
\explanation{}
\begin{answer}
\text{$(x+y)^2 = $}
\solution{f}
\inputAsFunction{x,y}{g}
\checkStringsForRelation{count(x,g)=2 AND count(y,g)=2 AND count(+,g)=2 AND count(-,g)=0 AND count((,g)=0 AND equal(f,g)}
\end{answer}
\end{question}
Remark: Whitespaces in the list are not allowed.
$$D[k]$$ computes the derivative for function $$k$$ and the (default) variable $$x$$. If you want to
compute the derivative for a different variable e.g. $$y$$, you can achieve that by the following
notation: $$D[k,y]$$ (with function $$k$$ and variable $$y$$)
1 D[<function identifier>,<variable identifier>]
The same notation can be used for substitution: $$f[k,y]$$ with $$y$$ being the variable in function $$f$$ that
should be replaced with function $$k$$.
1 <function 1 identifier>[<function 2 identifier>,<variable identifier>]
12345678910111213141516171819202122232425 \begin{question}
\begin{variables}
\function{f}{sin(y)+cos(x)}
\derivative[normalize]{g}{f}{y}
\end{variables}
\type{input.function}
\field{real}
\text{Compute the partial derivative of $\var{f}$ with respect to $y$}
\begin{answer}
\text{Give a multivariate function $f$ with variables $x$ and $y$. $f(x,y) = $}
\solution{f}
\inputAsFunction{x,y}{k}
\end{answer}
\begin{answer}
\text{$\frac{\delta f}{\delta y} = $}
\solution{g}
\inputAsFunction{x,y}{l}
\checkFuncForZero{D[k,y]-l}{-10}{10}{100}
\end{answer}
\end{question}
In case the solutions of a question are a set, i.e. the answers $$x_1$$, $$x_2$$, $$x_3$$ are interchangeable,
the answers must be permutable (e.g. the roots $$x_1$$ , $$x_2$$ and $$x_3$$ of a cubic equation). This can be achieved
with the command \permuteAnswers
which takes a comma separated list of answer indices (numbering starts with one).
Currently this functionality is only available for questions with the types:
The function can't be used if you have different answer types in one question!
The following example demonstrates this technique for a question with two answers (index 1 and 2):
12345 begin{question}
\text{What are the roots of f(x)=$\var{f}$ ?}
\explanation{}
\type{input.number}
\field{real}
1 \permuteAnswers{1, 2, 3}
1234567891011121314151617181920212223
\begin{answer}
\text{$x_1 = $}
\solution{a}
\end{answer}
\begin{answer}
\text{$x_2 = $}
\solution{b}
\end{answer}
\begin{answer}
\text{$x_3 = $}
\solution{c}
\end{answer}
\begin{variables}
\function[expand]{f}{(x-a)(x-b)(x-c)}
\randint[Z]{a}{-5}{5}
\randint[Z]{b}{-5}{5}
\randint[Z]{c}{-5}{5}
\randadjustIf{a,b,c}{a=b OR a=c OR b=c}
\end{variables}
\end{question}
If you randomize variables, it could happen that the random values do not satisfy some conditions the author wishes to
be fulfilled in the question, or that the problem is not correctly posed for some combinations of the random values.
So they have to be adjusted. Therefore, you can use the following syntax to achieve this:
\randadjustIf{ _list_of_variables_ }{ _avoidance_relation_ }
Example
1234567 \begin{variables}
\randint{a}{2}{5}
\randint[Z]{b}{-5}{5}
\randint{c}{2}{5}
\randint{d}{-4}{4}
\randadjustIf{a,b,c}{a^2+b^2 > c^2 OR a=b}
\end{variables}
This has the following consequence:
If the random integer point $$[a,b]$$ is outside the circle (centered at the origin) with radius $$c$$, or if it is situated
at the main diagonal, then new values for $$a$$,$$b$$ and $$c$$ are picked up randomly, possibly several times, until the
given avoidance condition is no longer fulfilled.
The list_of_variables is a comma separated list which contains those random variables of the same variables
environment, for which the author wishes adjustment in case the avoidance_relation is fulfilled.
This avoidance_relation has to be a logical (boolean) combination (use $$NOT$$, $$AND$$, $$OR$$) of simple comparison
relations $$(=, !=, <, <=, >, >=)$$ between expressions in the variables.
These expressions may include random and non-random variables defined in the same environment.
See Expressions And Relations for a more detailed description.
Hint:
\randint
commands jointly define a product set which has to have a non-empty intersection with theIf the solution to a question is a row vector, a column vector or a matrix, the generic problem is of the type input.matrix.
You can define a matrix within the @variables@ environment using the following syntax:
1 \matrix[<options>]{<variable>}{<entries>}
Within the
Entries can be:
The \matrix
takes the same
Finally, one can specify a \format{<row_count>}{<col_count>}
within the answer environment.
\format
is specified, the user must specify both the row and column count himself.Example:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 \begin{problem}
%%% QUESTION 1 %%%
\begin{question}
\type{input.matrix}
\begin{variables}
% Row vector (1x4)
\number{a}{1/3}
\number{b}{1/7}
\matrix[calculate]{v_r}{a +1 & 1 & 3 & b}
% Column vector (4x1)
\matrix[calculate]{v_c}{3^2/7 \\ x \\ 10 \\ 0}
\end{variables}
\displayprecision{4}
\correctorprecision{3}
\field{real}
\text{
\textbf{Question 1}\\
Determine the decimal expansion of the entries in\\
$\var{v_r}$ and \\
$\var{v_c}$ \\
rounded to three decimal places.}
\explanation{Think about what rounded off to three decimal places means.}
}
\begin{answer}
\text{Answer: }
\solution{v_r}
\format{1}{-1}
\end{answer}
\begin{answer}
\text{Answer: }
\solution{v_c}
\format{-1}{1}
\end{answer}
\end{question}
%%% QUESTION 2 %%%
\begin{question}
\type{input.matrix}
\displayprecision{4}
\correctorprecision{2}
\field{real}
\begin{variables}
\matrix{m}{
3/7 & x^2 & 0 \\ % 3/7 is shown as a fraction
5 & 2 & 3
}
\matrix[calculate]{m_1}{
3/7 & x^2 & 0 \\ %3/7 is shown as a decimal rounded to _displayprecision_
5 & 2 & 3
}
\end{variables}
\text{
\textbf{Question 2}\\
Determine the decimal expansion of the entries in $\var{m}$ rounded to two decimal places.}
\explanation{Think about what rounded off to three decimal places means.}
}
\begin{answer}
\text{Answer: }
\solution{m_1}
\end{answer}
\end{question}
\end{problem}
\embedapplet{applet}
A new question type input.text has been implemented in generic framework.
In generic problem TeX files a new variable type \string{ varname }{ string-content }
can be used.
The user is expected to fill in fields of type MMString. The user answer can be checked for
\solution{ _varname_ }
as usualfulfilling some conditions; for this sake it has to be given a variable name first via: \inputAsString{ _user-varname_ }
(this is completely analogous to \inputAsFunction in input.function problems), and then several conditions can be checked.
As by now you can check:
length( user-varname ) e.g. \checkStringsForRelation{length( _user-varname_ ) < length( _varname_ ) AND length( _varname_ ) > 3}
count( symbol , user-varname ) e.g. \checkStringsForRelation{count((, _user-varname_ )+count(), _user-varname_ ) < 10}
i.e. total number of parentheses less than 10
valid( user-varname ) checks for user inputs to be valid math operations,
e.g. \checkStringsForRelation{valid( _user-varname1_ ) AND valid( _user-varname2_ )}
equal( user-varname , varname ) checks whether user-varname stores a valid operation which
is identical to the one stored in varname , e.g. \checkStringsForRelation{equal( user-varname , varname )}
Observe that identity of operations is tested here algebraically, not numerically, so only rather simple cases can be expected to work flawlessly
equalString( user-varname , varname ) Checks whether the stored strings are identical.
There is no validity or identity check of operations. Just a character comparision.
equalTrimmedString( user-varname , varname ) This does the same as equalString, but removes all
spaces before comparing the two strings.
Here is an example:
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 \usepackage{mumie.genericproblem}
\lang{de}{
\title{Eingabe von Textstrings}
}
\begin{problem}
\begin{variables}
\string{q}{Hallo}
\end{variables}
\begin{question}
\lang{de}{
\text{\textbf{Frage 1}\\
Schreib doch mal 'Hallo'!}
\explanation{'Hallo' und nix anderes!}
}
\type{input.text}
\begin{variables}
\string{f}{Hallo}
\end{variables}
\begin{answer}
\text{Answer: }
\solution{f} %%only 'Hallo' is accepted
\end{answer}
\end{question}
\begin{question}
\lang{de}{
\text{\textbf{Frage 2}\\
Schreibe bitte einen gültigen mathematischen Ausdruck!}
\explanation{}
}
\type{input.text}
\begin{variables}
\string{f}{x^2+3x+1}
\end{variables}
\begin{answer}
\text{Answer: }
\solution{q}
\inputAsString{g}
\checkStringsForRelation{valid(g)}
%%if you write 'sin x' it is not accepted, since only sin(x) is valid in MUMIE expressions
\end{answer}
\end{question}
\begin{question}
\lang{de}{
\text{\textbf{Frage 3}\\
Schreibe den Ausdruck '(sin(x))^2+(cos(x))^2'!}
\explanation{}
}
\type{input.text}
\begin{variables}
\string{h}{(sin(x))^2+(cos(x))^2}
\end{variables}
\begin{answer}
\text{Answer: }
\solution{h}
\inputAsString{w}
\checkStringsForRelation{equal(w,h)}
%% observe that the input '(cos(x))^2+(sin(x))^2' is accepted (commutativity),
but '1' is rejected, since the system does not know trigonometric identities
\end{answer}
\end{question}
\end{problem}
\embedapplet{applet}
Another input type in the generic framework is input.cases.function. This type is designed for case
differentiations of e.g. absolute value functions. Note that you can only use this input type in an
answer environment. The questions input type has to be set to input.generic.
In answer you must use the command \solution{<variable>=<if-else expression>}
where variable is an
identifier of an in the variables environment defined variable. With the if-else expression a correct solution
is defined. The syntax should be as followed: IFELSE{<if condition>}{<then implication>}{<else implication>}
.
The else implication can be another if-else expression.
The answer of the user is checked numerically in a default (or by the author defined) range and in dependence
of the users given answer. At the moment you can use the following commands in the answer environment:
\checkAsFunction
(see above for details) to customize the numeric comparison\checkAsFunction
in input.cases.function are set to:\allowForInput
(see above for details) to limit the users input for the implications in the case\allowForConditionInput
(analog to \allowForInput) to limit the users input for the conditions inAn example:
123456789101112131415161718192021222324252627282930 \begin{problem}
\begin{question}
\type{input.cases.function}
\text{Fallunterscheidung, distinguish cases}
\begin{variables}
\function{g}{abs(abs(x-1)+2x)}
\function{h}{sin(x)}
\end{variables}
\begin{answer}
\text{$\var{g} =$}
\solution{g=IFELSE{x>=1}{3x-1}{IFELSE{x<-1}{-x-1}{x+1}}}
\allowForInput[false]{abs}
\allowForConditionInput[false]{abs}
\end{answer}
\begin{answer}
\text{$(\sin(x))^2+(\cos(x))^2=1$. Bestimme für $0\le x\le 2\pi$ $\var{h} =$}
\solution{h=IFELSE{0<=x<=pi}{sqrt(1-(cos(x)^2))}{-sqrt(1-(cos(x)^2))}}
\allowForInput[false]{sin}
\allowForConditionInput[false]{sin}
\checkAsFunction[1E-6]{x}{0}{6.283}{100}
\end{answer}
\end{question}
\end{problem}
The type input.interval is explained on the page Interval
Updated by Andreas, 3 years, 9 months ago – 6444648