Calculated question type: Difference between revisions
- Managing questions
- Question behaviours
- Question types
- Calculated
- Simple Calculated
- Drag and drop into text
- Drag and drop markers
- Drag and drop onto image
- Calculated Multichoice
- Description
- Essay
- Matching
- Embedded Answers (Cloze)
- Multiple Choice
- Random Short Answer Matching
- Select missing words
- Short-Answer
- Numerical
- True/False
- Third-party question types
- Questions FAQ
No edit summary |
No edit summary |
||
Line 4: | Line 4: | ||
For example, if you want to create a large number of '''calculate the area of a rectangle''' problems to drill your students, you could create a question with two wildcards (i.e. '''{base}''', '''{height}''') and put in the '''Correct Answer Formula=''' input field fiel '''{base}''' * '''{height}''' ( * being the multiplication sign ). | For example, if you want to create a large number of '''calculate the area of a rectangle''' problems to drill your students, you could create a question with two wildcards (i.e. '''{base}''', '''{height}''') and put in the '''Correct Answer Formula=''' input field fiel '''{base}''' * '''{height}''' ( * being the multiplication sign ). | ||
'''Correct Answer Formula=''' | '''Correct Answer Formula=''' {base}*{height} | ||
Revision as of 13:29, 11 June 2007
Calculated questions offer a way to create individual numerical questions by the use of the use of wildcards (i.e {x} , {y})that are substituted with random values when the quiz is taken.
For example, if you want to create a large number of calculate the area of a rectangle problems to drill your students, you could create a question with two wildcards (i.e. {base}, {height}) and put in the Correct Answer Formula= input field fiel {base} * {height} ( * being the multiplication sign ).
Correct Answer Formula= {base}*{height}
When a student takes the test, Moodle will randomly select values for {base} and {height} and grade the response using the result of the Correct Answer Formula=.
The test will very rarely appear the same way twice.
CAUTION: At least ONE wildcard in one of the answers
The main purpose of calculated question is to create multiple versions of a question with different numerical values. Otherwise use numerical question.
Question set-up
- Give the question a descriptive name.
- Enter your question into the question field. All variables you want Moodle to replace with generated values must be placed in curly braces.
- If you wish, add general feedback.
- Enter the formula for the answer. Be sure to use the same placeholders so Moodle can substitute the same values.
- Determine the tolerance for error that you will accept in the answer. The tolerance and tolerance type combine to give a range of acceptable scores.
- Select the number of significant figures you want in the correct answer.
- Add correct answer feedback.
- Enter the units for the answer (e.g. meters, kg, etc.). Moodle will look for the correct units. If you want to enter other acceptable units, such as metric versus imperial distances, enter them along with a conversion factor.
- Click Save changes.
- On the next screen, choose whether to create substitution values for each placeholder only for this question, or for other questions in the same category.
- Click Save changes.
- Create a dataset for the question or questions in the category. For each placeholder, generate a series of acceptable values. The more values you generate, the more a question can be used without repeating values.
- Click Back to quiz editing.
Calculated question format
- As a general rule, write these formulas like you would in a calculator e.g.
3 + 5 * sin (3/{x})
- Each function's placeholders and other arguments should be in parentheses (brackets). For example, if you want students to calculate the sine of one angle and two times cosine of another, you would enter
sin({a}) + cos({b}*2)
. - It's usually better to have too many parentheses (brackets) than too few. The server won't care, and the more specific you are about what you mean, the more likely it will like your complex formulas.
- There is no implicit multiplication. To you, the human editor, "5(23)" or "5x" may seem perfectly obvious. To the server doing the math, it's crazy talk and won't be understood. Always use the "*" for multiplication.
- Any special mathematical function must have parentheses around its values. Take the sine function in the first bullet point for instance. Notice that the 3 / x is wrapped in parentheses (brackets)--this is so the server can understand it properly. Without those parentheses, the server won't know if you mean "(sin 3) / x" or "sin (3 / x)" and will reject the entire formula accordingly.
Available functions
- Calculated questions can use more than simple arithmetic operators. See below for a table of available functions (taken from PHP: Mathematical Functions, where you can get further functions, though be careful, as the page may contain more information than you want!).
Function | Explanation |
---|---|
abs | Absolute value |
acos | Arc cosine -- in radians!!! Convert your degree measurement to radians before you take the acos of it. |
acosh | Inverse hyperbolic cosine -- in radians!!! Convert your degree measurement to radians before you take the acosh of it. |
asin | Arc sine -- in radians!!! Convert your degree measurement to radians before you take the asin of it. |
asinh | Inverse hyperbolic sine -- in radians!!! Convert your degree measurement to radians before you take the asing of it. |
atan2 | Arc tangent of two variables -- pass in two values like (x, y), and you'll get the atah(y/x), adjusted to the proper quadrant. |
atan | Arc tangent -- in radians!!! Convert your degree measurement to radians before you take the atan of it. |
atanh | Inverse hyperbolic tangent |
base_convert | Convert a number between arbitrary bases. Example: to get the value of 50 (in base 10) in base 5, you'd write "base_convert(50, 10, 5)" |
bindec | Binary to decimal |
ceil | Round fractions up |
cos | Cosine -- in radians!!! Convert your degree measurement to radians before you take the cos of it. |
cosh | Hyperbolic cosine -- in radians!!! Convert your degree measurement to radians before you take the cosh of it. |
decbin | Decimal to binary |
dechex | Decimal to hexadecimal |
decoct | Decimal to octal |
deg2rad | Converts the number in degrees to the radian equivalent |
exp | Calculates the exponent of e |
expm1 | Returns exp(number) - 1, computed in a way that is accurate even when the value of number is close to zero |
floor | Round fractions down |
fmod | Returns the floating point remainder (modulo) of the division of the arguments |
hexdec | Hexadecimal to decimal |
is_finite | Finds whether a value is a legal finite number |
is_infinite | Finds whether a value is infinite |
log10 | Base-10 logarithm |
log1p | Returns log(1 + number), computed in a way that is accurate even when the value of number is close to zero |
log | Natural logarithm (ln) |
max | Find highest value |
min | Find lowest value |
mt_rand | Generate a better random value |
octdec | Octal to decimal |
pi | Get value of pi |
pow | Exponential expression |
rad2deg | Converts the radian number to the equivalent number in degrees |
rand | Generate a random integer |
round | Rounds a float |
sin | Sine -- in radians!!! Convert your degree measurement to radians before you take the sin of it. |
sinh | Hyperbolic sine -- in radians!!! Convert your degree measurement to radians before you take the sinh of it. |
sqrt | Square root |
tan | Tangent -- in radians!!! Convert your degree measurement to radians before you take the tan of it. |
tanh | Hyperbolic tangent -- in radians!!! Convert your degree measurement to radians before you take the tanh of it. |
Predefined constants
- Some predefined constants are available for you to use. A table of these appears below, altered from PHP: Mathematical Functions, where you can get more information. (Be careful, as the page may contain more information than you want!)
Constant | Value | Description |
---|---|---|
M_PI | 3.14159265358979323846 | Pi |
M_E | 2.7182818284590452354 | e |
M_LOG2E | 1.4426950408889634074 | log_2 e |
M_LOG10E | 0.43429448190325182765 | log_10 e |
M_LN2 | 0.69314718055994530942 | log_e 2 |
M_LN10 | 2.30258509299404568402 | log_e 10 |
M_PI_2 | 1.57079632679489661923 | pi/2 |
M_PI_4 | 0.78539816339744830962 | pi/4 |
M_1_PI | 0.31830988618379067154 | 1/pi |
M_2_PI | 0.63661977236758134308 | 2/pi |
M_2_SQRTPI | 1.12837916709551257390 | 2/sqrt(pi) |
M_SQRT2 | 1.41421356237309504880 | sqrt(2) |
M_SQRT1_2 | 0.70710678118654752440 | 1/sqrt(2) |
Additional predefined constants
- Some other constants may be available, depending on how your instance of Moodle is set up.
Constant | Value | Description |
---|---|---|
M_SQRTPI | 1.77245385090551602729 | sqrt(pi) |
M_SQRT3 | 1.73205080756887729352 | sqrt(3) |
M_LNPI | 1.14472988584940017414 | log_e(pi) |
M_EULER | 0.57721566490153286061 | Euler constant |