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: Units.

Formulas: Units: Difference between revisions

From MoodleDocs
(Redirected page to Formulas question type)
 
Line 1: Line 1:
{{Formulas question type}}
#REDIRECT [[Formulas_question_type]]
 
==Writing units==
In the '''Formulas question''', the writing of the unit symbols differs slightly from that in the '''SI''' because units are entered very simply on the computer. The rules for entering units in the '''Formulas question''' are described below.
* The multiplication of unit symbols is indicated by a space, as prescribed in Section 5.1 of '''SI'''. ''The half-high (centred) dot (⋅) is not supported''. For example, input 50 kN m (≡ 50 kN⋅m), as follows:<br>
      <pre style="font-size:113%;width: 97%;margin-top:-15px;">50 kN m</pre>
* Division of unit symbols is indicated by a solidus (oblique stroke, <span style="font-family:monospace;font-size:113%;">/</span>) or by negative exponents.For example, input 10 m/s, or 10 m s<sup>-1</sup>, as follows:<br>
      <pre style="font-size:113%;width: 97%;margin-top:-15px;">10 m/s  or  10 m s^(-1)</pre>
* Exponentiation is indicated by the circumflex accent (<span style="font-family:monospace;font-size:113%;">^</span>, UTF-8 <span style="font-family:monospace;font-size:113%;"><span style="font-size:165%;">﹠</span>#94;</span> or ASCII code 94 (alt+94)).For example, input 4.7 m<sup>2</sup>, as follows:<br>
      <pre style="font-size:113%;width: 97%;margin-top:-15px;">4.7 m^2</pre>
* Parentheses are required when there is a risk of misinterpretation. For example, '''do not input 8 kN m^-2''' but rather:
      <pre style="font-size:113%;width: 97%;margin-top:-15px;">8 kN m^(-2)</pre>
* Permutations of the unit symbols are allowed. For example, the following two entries are considered identical:
      <pre style="font-size:113%;width: 97%;margin-top:-15px;">3 m kg s^(-2)  or  3 kg m/s^2</pre>
 
<div style="background-color:#faffbd;
            border:1px solid #d9d9d9;
            color:#000000;
            padding:5px 15px 5px;
            margin: 15px 0 15px;
            ">Unit symbols are case sensitive. For example, kilonewton is written kN, not KN, kn or Kn.</div>
 
==Defining units==
<div style="background-color:#d3ffd3;
            border:1px solid #abdaac;
            color:#4f691a;
            padding:5px 15px 15px;
            margin: 15px 0 20px;
            ">
Units are defined on the '''Formulas question''' page, in the following three places:
 
* For each part, in the '''Unit''' field.
* For each part, in the '''Other rules''' field.
* Under '''Extra options''', in the '''[Global] - Basic conversion rule''' field.
</div>
 
===Unit field===
 
Specify a single or a combined unit.
 
<div style="border:1px solid #bce8f1;border-radius:4px;padding: 0px 15px 0px; margin:20px 0 25px;">
<div style="font-family:Lucida Sans Unicode;font-size:150%;color:#f98012;margin:10px 0 10px;>Example</div>
 
<pre style="font-size:113%;width: 97%;">
kg
N
m/s^2
</pre>
</div>
 
 
You can also specify single and combined units separated by <span style="font-family:monospace;font-size:113%;">=</span>.
 
<div style="border:1px solid #bce8f1;border-radius:4px;padding: 0px 15px 0px; margin:20px 0 25px;">
<div style="font-family:Lucida Sans Unicode;font-size:150%;color:#f98012;margin:10px 0 10px;>Example</div>
 
In order to accept N and kg m/s<sup>2</sup> as valid units, define '''Unit''' as follows:
<pre style="font-size:113%;width: 97%;">N = kg m/s^2</pre>
 
Note that <span style="font-family:monospace;font-size:113%;">/s^2</span> must be placed at the end of the unit. Hence,  <span style="font-family:monospace;font-size:113%;">N = /s^2 kg m</span>   and   <span style="font-family:monospace;font-size:113%;">N = kg /s^2 m</span>   will lead to an error.
 
With the above setting, the following units will be considered correct:
<pre style="font-size:113%;width: 97%;">
N
kg m/s^2
kg m /s^2
m kg /s^2
m kg s^(-2)
s^(-2) kg m
s^(-2) m kg
</pre>
</div>
 
<div style="border:1px solid #bce8f1;border-radius:4px;padding: 0px 15px 0px; margin:20px 0 25px;">
<div style="font-family:Lucida Sans Unicode;font-size:150%;color:#f98012;margin:10px 0 10px;> Example</div>
 
In order to accept W, J/s and m<sup>2</sup> kg  s<sup>-3</sup> as valid units, specify:
 
<pre style="font-size:113%;width: 97%;">W = J/s = m^2 kg s^(-3)</pre>
</div>
 
===Other rules field===
 
Add prefixes that are not defined in the '''[Global] - Basic conversion rule''' by writing units followed by a list of prefixes.
 
<div style="border:1px solid #bce8f1;border-radius:4px;padding: 0px 15px 0px; margin-bottom:25px;">
 
<div style="font-family:Lucida Sans Unicode;font-size:150%;color:#f98012;margin:10px 0 10px;>Example</div>
 
Specify that meganewton (MN) is an acceptable unit by writing the following:
 
<pre style="font-size:113%;width: 97%;">
N: M;
</pre>
 
</div>
 
Add conversions of single units by equating their values.
 
<div style="border:1px solid #bce8f1;border-radius:4px;padding: 0px 15px 0px; margin-bottom:25px;">
 
<div style="font-family:Lucida Sans Unicode;font-size:150%;color:#f98012;margin:10px 0 10px;>Example</div>
 
<pre style="font-size:113%;width: 97%;">
1 m = 39.3700787 in;
</pre>
 
With the above conversion rule, the following answers are equivalent:
<pre style="font-size:113%;width: 97%;">
10 in
0.254 m
25.4 cm
254 mm
</pre>
</div>
 
===[Global] - Basic conversion rule field===
Select  a basic conversion rule. Prefixes and conversion factors for different basic rules are defined in the flle '''conversion_rules.php'''. In the file downloaded from the '''Moodle plugins directory''', two rules are defined: '''None''' and '''Common SI units'''.
 
====None====
Select '''None''' if other rules contradicts the rule defined in '''[Global] - Basic conversion rule''' if any.
 
====Common SI units====
 
The '''Common SI units''' rule defines prefixes and conversion factors commonly used by physicists. The rule is as follows:
 
<pre style="font-size:113%;width: 97%;">
//Prefixes
m: k d c m u n p f;
s: m u n p f;
g: k m u n p f;
mol: m u n p;
N: k m u n p f;
A: m u n p f;
J: k M G T P m u n p f;
eV: k M G T P m u;
W: k M G T P m u n p f;
Pa: k M G T P;
Hz: k M G T P E;
C: k m u n p f;
V: k M G m u n p f;
ohm: m k M G T P;
F: m u n p f;
T: k m u n p;
H: k m u n p;
//Conversion factors
J = 6.24150947e+18 eV;
</pre>
 
Note that, for example, <span style="font-family:monospace;font-size:113%;">m: k c d m u n p f;</span> is equivalent to:
 
<pre style="font-size:113%;width: 97%;">
1 m = 1e-3 km = 1e1 dm = 1e2 cm = 1e3 mm = 1e6 um = 1e9 nm = 1e12 pm = 1e15 fm;
</pre>.
 
As the '''Common SI units''' prefixes and conversion factors concern mainly physicists, the rule could be renamed '''Physics Units'''.
 
<div style="border:1px solid #bce8f1;border-radius:4px;padding: 0px 15px 0px; margin-bottom:25px;">
 
<div style="font-family:Lucida Sans Unicode;font-size:150%;color:#f98012;margin:10px 0 10px;>Example</div>
 
With the '''Common SI units''' rule, the following answers are equivalent:
 
<pre style="font-size:113%;width: 97%;">
5 s                    0.2 m/s                1 m^2
5000 ms                200 mm/s                10000 cm^2
5e9 ns                                          1e-6 km^2
</pre>        
 
</div>
 
===User defined rules===
 
Other rules can be defined in the file '''conversion_rules.php'''.
 
<div style="border:1px solid #bce8f1;border-radius:4px;padding: 0px 15px 0px; margin-bottom:25px;">
 
<div style="font-family:Lucida Sans Unicode;font-size:150%;color:#f98012;margin:10px 0 10px;>Example</div>
 
Define a rule for ''structural engineering'' in the SI and US system of units:
 
<pre style="font-size:113%;width: 97%;">
$basic_unit_conversion_rules[101] = array('Structural Engineering','
// Prefixes
m: k c m ;
N: k M;
Hz: k;
s: m;
// Conversion factors
1 m = 3.28084 ft;
1 ft = 12 in;
3 ft = 1 yd;
1 kg = 0.001 t;
1 N = 0.22481 lb;
1 lb = 0.001 kip;
etc.
 
');
</pre>
</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:_Unidades Español]<br>
[https://docs.moodle.org/3x/fr/Formules:_Unités Français]

Latest revision as of 00:58, 1 February 2018