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: Hon Wai Lau's examples.

Formulas: Hon Wai Lau's examples: Difference between revisions

From MoodleDocs
(Redirected page to Formulas question type)
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{Formulas question type}}
#REDIRECT [[Formulas_question_type]]
 
=Hon Wai Lau's examples=
 
<div style="border:1px solid #bce8f1;border-radius:4px;padding: 0px 15px 0px; margin:30px 0 25px;">
====<div style="font-family:Lucida Sans Unicode;font-size:116%;color:#f98012;margin:-20px 0 10px;>Example 1.1: Minimal question</div>====
 
For a minimal question, you must define a sub-question with:
* mark
* answer
* grading criteria
* question text (optional)
 
<pre style="font-size:113%;width: 97%;">
General
  Question name!      Minimal question
Main question
  Question text!      What is 2 + 2?
Part 1
  Part's mark*        1
  Answer type          Number
  Answer*              4
  Grading criteria*    Relative error < 0.01
</pre>
 
The Formulas question should look like this:
 
[[File:Formules201801261903.png|818px]]
 
<div style="margin:20px 0 20px;">
<span style="background-color:#f98012;box-shadow: 0 5px 10px #cbcbcb;border: none;color:white;padding: 8px 16px;text-align:center;text-decoration: none;cursor:pointer;">[http://35.193.77.29/mod/quiz/view.php?id=291 <span style="color:white;">Play it </span>]</span>   [[Formulas_question_type#Examples|Login info]]  ''(Open in new tab: Ctrl+Shift+Click)''
</div>
</div>
 
<div style="border:1px solid #bce8f1;border-radius:4px;padding: 0px 15px 0px; margin:30px 0 25px;">
====<div style="font-family:Lucida Sans Unicode;font-size:116%;color:#f98012;margin:-20px 0 10px;>Example 1.2: Generate random data</div>====
 
Random data can be defined in the random variables, such as <span style="font-family:monospace;font-size:113%;">a = {2,3,4,5}</span>. Upon quiz generation, one deterministic value will be chosen.
 
<pre style="font-size:113%;width: 97%;">
General
  Question name!      Generate random data
Variables
  Random variables    a = {2,3,4,5};
Main question
  Question text!      In this instantiation, a takes the value {a}.
Part 1
  Part's mark*        1
  Answer type          Number
  Answer*              a
  Grading criteria*    Relative error < 0.01
  Part's text          Enter the value of a:
</pre>
 
The Formulas question should look like this:
 
[[File:Formules201801261929.png|680px]]
 
<div style="margin:20px 0 20px;">
<span style="background-color:#f98012;box-shadow: 0 5px 10px #cbcbcb;border: none;color:white;padding: 8px 16px;text-align:center;text-decoration: none;cursor:pointer;">[http://35.193.77.29/mod/quiz/view.php?id=293 <span style="color:white;">Play it </span>]</span>   [[Formulas_question_type#Examples|Login info]]  ''(Open in new tab: Ctrl+Shift+Click)''
</div>
 
</div>
 
<div style="border:1px solid #bce8f1;border-radius:4px;padding: 0px 15px 0px; margin:30px 0 25px;">
 
====<div style="font-family:Lucida Sans Unicode;font-size:116%;color:#f98012;margin:-20px 0 10px;>Example 1.3: Multiple parts</div>====
 
By default, all parts will be added at the end of the question. If placeholders are used, the parts will be inserted at the location of placeholders.
 
<pre style="font-size:113%;width: 97%;">
General
  Question name        Multiple parts
Main question
  Question text        This is the beginning of the main question text.
                      {#1}
                      This is the continuation of the main question text.
                      {#2}
                      This is the continuation and the end of the main question text.
Part 1
  Part's mark          1
  Answer type          Number
  Answer              3
  Grading criteria    Relative error < 0.01
  Placeholder name    #1
  Part's text          This is the text of Part 1. The correct answer is 3:
Part 2
  Part's mark          1
  Answer type          Number
  Answer              1
  Grading criteria    Relative error < 0.01
  Placeholder name    #2
  Part's text          This is the text of Part 2. The correct answer is 1:
Part 3
  Part's mark          1
  Answer type          Number
  Answer              4
  Grading criteria    Relative error < 0.01
  Part's text          This is the text of Part 3. The correct answer is 4:
</pre>
 
With the question behaviour set to '''Interactive with multiple tries''', the Formulas question should look like this:
 
[[File:Formules201801262037.png|818px]]
 
<div style="margin:20px 0 20px;">
<span style="background-color:#f98012;box-shadow: 0 5px 10px #cbcbcb;border: none;color:white;padding: 8px 16px;text-align:center;text-decoration: none;cursor:pointer;">[http://35.193.77.29/mod/quiz/view.php?id=319 <span style="color:white;">Play it </span>]</span>   [[Formulas_question_type#Examples|Login info]]  ''(Open in new tab: Ctrl+Shift+Click)''
</div>
 
With the question behaviour set to '''Adaptive mode''', the Formulas question should look like this:
 
[[File:Formules201801262039.png|818px]]
 
<div style="margin:20px 0 20px;">
<span style="background-color:#f98012;box-shadow: 0 5px 10px #cbcbcb;border: none;color:white;padding: 8px 16px;text-align:center;text-decoration: none;cursor:pointer;">[http://35.193.77.29/mod/quiz/view.php?id=318 <span style="color:white;">Play it </span>]</span>   [[Formulas_question_type#Examples|Login info]]  ''(Open in new tab: Ctrl+Shift+Click)''
</div>
 
<div style="background-color:#d3ffd3;
            border:1px solid #abdaac;
            border-radius:4px;
            color:#4f691a;
            padding:5px 15px 5px;
            margin: 15px 0 0;
            ">
An important advantage of the '''Adaptive mode''' behaviour is that '''''all''''' the answers do not have to be entered before they can be checked by clicking the '''Check''' button. Thus, the answers for each part can be checked one at a time or as they are entered.
</div>
 
</div>
 
<div style="border:1px solid #bce8f1;border-radius:4px;padding: 0px 15px 0px; margin:30px 0 25px;">
 
====<div style="font-family:Lucida Sans Unicode;font-size:116%;color:#f98012;margin:-20px 0 10px;>Example 1.4: Placeholders of numbers and unit</div>====
 
This question shows different display methods of the number and unit boxes.
 
<pre style="font-size:113%;width: 97%;">
General
  Question name        04  Placeholders of numbers and unit
Variables
Random variables      v = {20:100:10};
                      dt = {2:6};
Global variables      s = v*dt;
Main question
  Question text        If a car travels {s} m in {dt} s, what is the speed of the car?
Part 1
  Part's mark          1
  Answer type          Number
  Answer              v
  Grading criteria    Relative error < 0.01
  Unit                m/s
  Part's text          Number box and unit box side by side
                      {_0}{_u}
Part 2
  Part's mark          1
  Answer type          Number
  Answer              v
  Grading criteria    Relative error < 0.01
  Unit                m/s
  Part's text          Number box and unit box side by side
                      {_0} {_u}
Part 3
  Part's mark          1
  Answer type          Number
  Answer              v
  Grading criteria    Relative error < 0.01
  Unit                m/s
  Part's text          No unit box
                      {_0} m/s
Part 4
  Part's mark          1
  Answer type          Number
  Answer              v
  Grading criteria    Relative error < 0.01
  Unit                m/s
  Part's text          No unit box
                      speed = {_0} m/s
</pre>
 
The Formulas question should look like this:
 
[[File:Formules201801272226.png|680px]]
 
<div style="margin:20px 0 20px;">
<span style="background-color:#f98012;box-shadow: 0 5px 10px #cbcbcb;border: none;color:white;padding: 8px 16px;text-align:center;text-decoration: none;cursor:pointer;">[http://35.193.77.29/mod/quiz/view.php?id=325 <span style="color:white;">Play it </span>]</span>   [[Formulas_question_type#Examples|Login info]]  ''(Open in new tab: Ctrl+Shift+Click)''
</div>
 
</div>
 
<div style="border:1px solid #bce8f1;border-radius:4px;padding: 0px 15px 0px; margin:30px 0 25px;">
====<div style="font-family:Lucida Sans Unicode;font-size:116%;color:#f98012;margin:-20px 0 10px;>Example 3.2: Variable multiple and variable range</div>====
 
This question is similar to [[Formulas:_Answers_and_marking#Example:_Multiples_of_7_between_10_and_100.C2.A0.C2.A0.C2.A0.28Mark_.3D_0.2C_0.5_or_1.29|'''Example: Multiples of 7 between 10 and 100  (Mark = 0, 0.5 or 1)''']], except that the multiples are multiple of a variable ''d'' which can be 5, 6, 7, 8 or 9, and that the range is variable by requiring that ''x'' satisfies ''a'' < ''x'' < ''b'' where ''a'' = ''k''*''d''-3, ''b'' = (''k''+2)*''d''-2 and ''k'' ranges from 4 to 9.
 
<pre style="font-size:113%;width: 97%;">
General
  Question name        3.2  Variable multiple and variable range
Variables
  Random variables    k = {4:10:1};
                      d = {5,6,7,8,9};
  Global variables    a = k*d-3;
                      b = (k+2)*d-2;
Main question
  Question text        Two Grading criteria are defined here, each of which is worth half a mark.
Part 1
  Part's mark*        1
  Answer type          Number
  Answer*              k*d
  Grading variables    criterion1 = _0 % d == 0;
                      criterion2 = a <= _0 && _0 <= b;
  Grading criteria    (criterion1 + criterion2)/2
  Part's text          Give a number x that is a multiple of {d} and satisties {a} < x < {b}:
</pre>
 
The Formulas question should look like this:
 
[[File:Formulas en 20180128 2128.png|818px]]
 
<div style="margin:20px 0 20px;">
<span style="background-color:#f98012;box-shadow: 0 5px 10px #cbcbcb;border: none;color:white;padding: 8px 16px;text-align:center;text-decoration: none;cursor:pointer;">[http://35.193.77.29/mod/quiz/view.php?id=330 <span style="color:white;">Play it </span>]</span>   [[Formulas_question_type#Examples|Login info]]  ''(Open in new tab: Ctrl+Shift+Click)''
</div>
</div>
 
<div style="border:1px solid #bce8f1;border-radius:4px;padding: 0px 15px 0px; margin:30px 0 25px;">
====<div style="font-family:Lucida Sans Unicode;font-size:116%;color:#f98012;margin:-20px 0 10px;>Example 5.5: Roots of a quadratic function</div>====
 
<div style="background-color:#d3ffd3;
            border:1px solid #abdaac;
            border-radius:4px;
            color:#4f691a;
            padding:5px 15px 5px;
            margin: 15px 0 0;
            ">This question is a good example of how a question can be built by taking advantage of the power of the '''Formulas''' question. By formulating the solution in reverse, results can often be obtained that would be difficult or impossible to achieve otherwise.
</div>
 
The technique is illustrated by the problem of finding the roots of a quadratic function. Here is what is easily obtained: the coefficients of the quadratic function are variable and whole numbers, and the roots are always two, real and whole numbers. Here is how it is done:
 
Let<br>
      f(x) = x<sup>2</sup> + bx + c = 0<br>
where<br>
      b = -(r<sub>1</sub> + r<sub>2</sub>)<br>
and<br>
      c = r<sub>1</sub>*r<sub>2</sub><br>
Thus,<br>
      x<sup>2</sup> - (r<sub>1</sub> + r<sub>2</sub>)x + r<sub>1</sub>r<sub>2</sub> = 0<br>
with roots<br>
      x<sub>1</sub>, x<sub>2</sub> = [ (r<sub>1</sub> + r<sub>2</sub>) ± √ (r<sub>1</sub> + r<sub>2</sub>)<sup>2</sup> - 4 r<sub>1</sub> r<sub>2</sub> ] / 2<br>
            = r<sub>1</sub>, r<sub>2</sub>
 
The 'trick' is to define the coefficients of the quadratic as a function of the roots.
 
<pre style="font-size:113%;width: 97%;">
General
  Question name        5.5 Roots of a quadratic function
Variables
  Random variables    r1 = {-9:-1};
                      r2 = {-9:-1};
                      symbol = {"t","w","x","z"};
  Global variables    x1 = min(r1,r2);
                      x2 = max(r1,r2);
Main question
  Question text        Roots of a quadratic function
Part 1
  Part's mark          1
  Local variables      b = -(r1 + r2);
                      c = r1*r2;
  Answer type          Number
  Answer              [x1,x2]
  Grading criteria    Absolute error == 0
  Part's text          What are the roots of the quadratic function f({symbol}) = {symbol}<sup>2</sup> + {b}{symbol} + {c}?
                      Enter the smaller root first
                      {symbol} = {_0}  and  {symbol} = {_1}
</pre>
 
The Formulas question should look like this:
 
[[File:Formules201801261903.png|818px]]
 
<div style="margin:20px 0 20px;">
<span style="background-color:#f98012;box-shadow: 0 5px 10px #cbcbcb;border: none;color:white;padding: 8px 16px;text-align:center;text-decoration: none;cursor:pointer;">[http://35.193.77.29/mod/quiz/view.php?id=333 <span style="color:white;">Play it </span>]</span>   [[Formulas_question_type#Examples|Login info]]  ''(Open in new tab: Ctrl+Shift+Click)''
</div>
</div>
 
 
 
[[#top|Back to top of page]]
 
[[Formulas_question_type|← FORMULAS QUESTION TYPE]]
 
===In other languages===
[https://docs.moodle.org/all/es/F%C3%B3rmulas:_Los_ejemplos_de_Hon_Wai_Lau Español]<br>
[https://docs.moodle.org/3x/fr/Formules:_Les_exemples_de_Hon_Wai_Lau Français]

Latest revision as of 00:59, 1 February 2018