計算題

来自MoodleDocs
stephen Liu讨论 | 贡献2009年3月11日 (三) 02:33的版本
跳转至:导航、​搜索


計算題提供了一種建立個別數字題的方法,題目裏使用通配符(例如 {x} , {y})答題時通配符會被亂數替換。

舉一個例,如果你想要建立很多"矩形面積的計算"問題給你的學生練習,你可以建立有兩個通配符的試題(例如{base}, {height})然後放在"正確答案公式="的輸入欄位{base} * {height} ( * 是乘法的符號)。

正確答案公式= {base}*{height}


當學生作答時,Moodle會隨機選取{base}{height}的值然後使用 正確答案公式來評分。

這個測驗很難同時出現兩次一樣的題目。

這真的是你要的題型嗎?

計算題的主要目的是建立有很多數值的試題版本,這個意思是你必須在答案中有一個以上的通配符。

假如你不需要亂數值,使用數字題型來取代。

通配符及資料集

當Moodle傳送一個計算題給學生,通配符會被隨機選擇的值所取代,然而這些值不總是隨機的- 他們是從已經預先定義好可能數值的資料集中隨機選出的,這樣可以允許你控制一些所選擇的可能值 - 舉個例來說,這是為了確定這些數字是實際的。

這些資料集可以是私用的共享的 - 私用的資料集在一個計算題被一個通配符所使用;共享的資料集是所有的計算題都可以共用這個通配符。

試題設定

要新增(或編輯)計算題有三頁要處理,下面的操作會帶你一步一步地操作這些頁面:

第一頁.編輯計算題

  1. 選取試題類別
  2. 這個類別中共享的通配符會列在下面。假如你改變類別,你需要點擊"更新題庫"按鈕來更新這個列表,有可能沒有共享的通配符 - 假如沒有你可以稍後依照你自己的意願來新增。
  3. 給定試題描述的名稱 - 這個可以允許你在題庫中辦認。
  4. 輸入試題內容,這應該是你想要學生回答的試題,而且必須包含所有要計算答案的資訊,因此他必須含有至少一個通配符在大括弧內,例如,假如你想要學生計算A加B,這個試題內容很可能是這樣:"{A} + {B}=多少?"
  5. 假如你鄉要新增一個試題的圖片就選擇一個圖片來顯示,對學生來說,圖片會顯示在試題內容後答案前,假如你想要控制圖片如何顯示,就把他放在試題內容中用HTML編輯器處理。
  6. 設定預設題目得分 (例如,這個試題的最高分)。
  7. 設定倒扣條件 (見下面的倒扣條件)。
  8. Moodle 1.7+: 假如你願意,新增一般的回饋,這是顯示給學生回答後所要顯示的文字。
  9. 接下來新增正確答案公式這個公式必須含有試題內容中一個以上的通配符,見正確答案公式語法有更進一步的資料。
  10. 選擇成績這個成績是學生針對該試題所給的答案得到的,這應該是題目得分的一個百分比,例如,你可以給正確答案100%,而接近正確答案則給50%,答案中有一個必須是100%分
  11. 決定你可以接受答案錯誤的容許誤差,這個容許誤差及誤差類型設定可以提供一個可接受分數的範圍,所以假如容許誤差 = t,正確答案 = x 且使用者的答案跟正確答案的差為dx,那麼誤差類型如下:
    1. 額定誤差 - 假如 dx <= t 就是正確的
    2. 相對誤差 - 假如 dx / x <= t 就是正確的
    3. 幾何誤差 - 假如 dx² / x² <= t²就是正確的
  12. 接下來兩個設定,"顯示正確的答案"及"格式"決定答案的精度,使用這些來選擇你想要使用的小數位數或顯著數字的數字。
  13. 新增一些回饋在學生輸入答案時可以看到。
  14. 你可以指定許多你喜歡的正確答案公式 - 點擊"新增另一個答案空格"來新增。
  15. 你也可以指定答案的單位,例如,假如你在這裡輸入'cm'單位,接受的答案是15,那麼答案是'15cm'及'15'都是正確的答案,假如你要新增一個以上的單位,你也可以用倍數的方式指定,所以,假如你的主要答案是5500,單位W,你也可以新增單位kW其倍數是0.001,這表示答案'5500'、'5500W'或'5.5kW'都是正確的,注意接受的錯誤也是倍數的,所以允許100W的錯誤會變成0.1kW的錯誤。
  16. 最後(!)你可以點擊"下一頁"來儲存你所作及繼續前進,假如擬是編輯原有試題,你可以點擊 "下一頁(新的問題)"來根據現有的試題新增一個全新的試題。

倒扣條件

'倒扣條件'只用在試題用在測驗卷使用適性模式時 - 例如,學生允許在測驗時試很多次即使是同樣的測試,假如倒扣條件大於0,那麼學生在成功的嘗試後將會失去最高分的機會,舉一個例假如預設的分數是10,倒扣條件是0.2,那麼在第一次嘗試後才成功的話將會發生倒扣0.2 x 10 = 2分。

第二頁.選擇資料集屬性

每一個在答案正確公式裡的通配符必須有一個相關可能的值域 - 這就是資料集,列在這一頁的每個通配符有一個資料集的選擇:

  • 私用的 例如只使用在這個試題
  • 共享的例如在相同類別裡共享其他的計算題

使用共享的資料集可以節省時間在你要新增很多類似的計算題時。

假如在是堤內榮中有任何像是通配符的東西,但是卻沒有出現在答案公式裡頭,你可以指定這是否是通配符,假如是你可以選擇要作為私用的或共享的資料集。

要繼續,針對每個通配符選擇你喜歡的資料集,然後點擊"下一頁"。

第三頁.修改資料集

現在我們需要新增每個通配符可能的值,警告 - 這一頁有點亂!

有兩種方法可以新增值 - 你可以自己輸入然後加到列表中,或是你可以讓Moodle來幫你產生。

新增/刪除你自己的值

新增個人的值到列表中是容易的:

  1. 在'參數'的欄位針對每一個通配符輸入你要的值
  2. 下拉捲軸到'新增'的部份然後點擊新增按鈕(保留該項的數字設為1)
  3. 需要的話可以重複上面的步驟很多次(該項數字最大到100)

要從列表中刪除值:

  1. 在'刪除'的部份,選擇要刪除的項目編號
  2. 點擊刪除按鈕

Letting Moodle create values

  1. Start with the "Range of Values" fields, and enter the lower and upper limits for the values you would accept
  2. Choose a number of decimal places for the value
  3. Choose the distribution of values between the limits - 'uniform' means any value between the limits is equally likely to be generated; 'loguniform' means that values towards the lower limit are more likely.
  4. Now move down to the 'Add' section and click on "force regeneration"
  5. In the menu next to the Add button, choose the number of sets of random values (items) you wish to add to the list. (Note that the maximum total number of items in your list is 100.)
  6. Finally, click Add to append the new values to the list
  7. Note: If you want more control over the items that Moodle adds, you can do them one at a time and preview the values before you add them. Click the "Get New Item to Add" button to make Moodle generate new values in the "Item to Add" section at the top. If you like them, click "Add" for 1 item; if not, click "Get New Item to Add" again to get new values.

Finishing off

Once your list of items (values) is complete, you are finished. It's up to you how many values you add - the more values you add, the more a question can be used by the students without them seeing the same values repeatedly.

Note that if you delete values from the list, you can put them back again. Change the "Next Item to Add" option to "reuse previous value if available", then the next time you add items, Moodle will restore your previously-deleted items from the dataset.

Once your list of values is complete, you can click 'Save changes' to finish.

What does the 'Update the datasets parameters' button do?

As far as I can tell, it has the same function as the "Get New Item to Add" button, i.e. it generates a new set of values and displays them in the "Item to Add" section. However, it is less conveniently placed that that button, so it is probably best ignored.

Correct answer formula syntax

DO NOT PUT THE = sign in the formula.

  • In the recent versions of the calculated question type, you could have more than one answer formula and applied a specific grading value to each of them as long as there is at least one 100% correct answer formula.
If more than one correct answer formula input field are displayed when editing, 
your site has the multiple answer feature. 


  • As a general rule, write these formulas like you would in a calculator e.g. 3 + 5 * sin(3/{x}) A notable exception is exponentiation, where x3 cannot be entered as {x}^3, but instead should be entered as pow(x, 3).
  • 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. The following functions are allowed in versions 1.5 and newer.

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
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
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 modulus of two numbers - i.e. the remainder when the first is divided by the second.
is_finite Finds whether a value is a legal finite number
is_infinite Finds whether a value is infinite
is_nan Finds whether a value is not a number
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
octdec Octal to decimal
pi Get value of pi
pow (numberToRaise, NumberRaisedTo) 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

Actually there is NO Predefined constant that is allowed other than pi() as a function without parameter.