Calculated question : adding new math functions: Difference between revisions
Line 15: | Line 15: | ||
!Function | !Function | ||
!1,5+ | !1,5+ | ||
!Math | |||
lib | |||
!Eval | !Eval | ||
Math | Math | ||
Line 23: | Line 25: | ||
|- | |- | ||
|abs | |abs | ||
| # | |||
| # | | # | ||
| # | | # | ||
Line 31: | Line 34: | ||
|- | |- | ||
|acos | |acos | ||
| # | |||
| # | | # | ||
| # | | # | ||
Line 39: | Line 43: | ||
|- | |- | ||
|acosh | |acosh | ||
| # | |||
| # | | # | ||
| # | | # | ||
Line 47: | Line 52: | ||
|- | |- | ||
|asin | |asin | ||
| # | |||
| # | | # | ||
| # | | # | ||
Line 55: | Line 61: | ||
|- | |- | ||
|asinh | |asinh | ||
| # | |||
| # | | # | ||
| # | | # | ||
Line 63: | Line 70: | ||
|- | |- | ||
|atan2 | |atan2 | ||
| # | |||
| # | | # | ||
| | | | ||
Line 71: | Line 79: | ||
|- | |- | ||
|atan | |atan | ||
| # | |||
| # | | # | ||
| # | | # | ||
Line 79: | Line 88: | ||
|- | |- | ||
|atanh | |atanh | ||
| # | |||
| # | | # | ||
| # | | # | ||
Line 87: | Line 97: | ||
|- | |- | ||
|bindec | |bindec | ||
| # | |||
| # | | # | ||
| | | | ||
Line 95: | Line 106: | ||
|- | |- | ||
|ceil | |ceil | ||
| # | |||
| # | | # | ||
| # | | # | ||
Line 103: | Line 115: | ||
|- | |- | ||
|cos | |cos | ||
| # | |||
| # | | # | ||
| # | | # | ||
Line 111: | Line 124: | ||
|- | |- | ||
|cosh | |cosh | ||
| # | |||
| # | | # | ||
| # | | # | ||
Line 119: | Line 133: | ||
|- | |- | ||
|decbin | |decbin | ||
| # | |||
| # | | # | ||
| | | | ||
Line 127: | Line 142: | ||
|- | |- | ||
|decoct | |decoct | ||
| # | |||
| # | | # | ||
|new | |new | ||
Line 135: | Line 151: | ||
|- | |- | ||
|deg2rad | |deg2rad | ||
| # | |||
| # | | # | ||
|new | |new | ||
Line 143: | Line 160: | ||
|- | |- | ||
|exp | |exp | ||
| # | |||
| # | | # | ||
| # | | # | ||
Line 151: | Line 169: | ||
|- | |- | ||
|expm1 | |expm1 | ||
| | |||
| | | | ||
|new | |new | ||
Line 159: | Line 178: | ||
|- | |- | ||
|floor | |floor | ||
| | |||
| # | | # | ||
| # | | # | ||
Line 167: | Line 187: | ||
|- | |- | ||
|fmod | |fmod | ||
| # | |||
|new | |new | ||
| | | | ||
Line 175: | Line 196: | ||
|- | |- | ||
|is_finite | |is_finite | ||
| # | |||
| # | | # | ||
|new | |new | ||
Line 183: | Line 205: | ||
|- | |- | ||
|is_infinite | |is_infinite | ||
| # | |||
| # | | # | ||
|?? | |?? | ||
Line 191: | Line 214: | ||
|- | |- | ||
|is_nan | |is_nan | ||
| # | |||
| # | | # | ||
|?? | |?? | ||
Line 199: | Line 223: | ||
|- | |- | ||
|log10 | |log10 | ||
| # | |||
| # | | # | ||
|new | |new | ||
Line 207: | Line 232: | ||
|- | |- | ||
|log1p | |log1p | ||
| # | |||
| # | | # | ||
|new | |new | ||
Line 215: | Line 241: | ||
|- | |- | ||
|log | |log | ||
| # | |||
| # | | # | ||
| # | | # | ||
Line 223: | Line 250: | ||
|- | |- | ||
|Natural logarithm (''ln'') | |Natural logarithm (''ln'') | ||
| # | |||
| # | | # | ||
| # | | # | ||
Line 231: | Line 259: | ||
|- | |- | ||
|max | |max | ||
| # | |||
| # | | # | ||
| # | | # | ||
Line 239: | Line 268: | ||
|- | |- | ||
|min | |min | ||
| # | |||
| # | | # | ||
| # | | # | ||
Line 247: | Line 277: | ||
|- | |- | ||
|octdec | |octdec | ||
| # | |||
| # | | # | ||
|new | |new | ||
Line 255: | Line 286: | ||
|- | |- | ||
|pi() | |pi() | ||
| # | |||
| # | | # | ||
| # | | # | ||
Line 263: | Line 295: | ||
|- | |- | ||
|pow (numberToRaise, NumberRaisedTo) | |pow (numberToRaise, NumberRaisedTo) | ||
| # | |||
| # | | # | ||
|new | |new | ||
Line 278: | Line 311: | ||
|- | |- | ||
|rad2deg | |rad2deg | ||
| # | |||
| # | | # | ||
| | | | ||
Line 286: | Line 320: | ||
|- | |- | ||
|rand | |rand | ||
| # | |||
| # | | # | ||
|new | |new | ||
Line 295: | Line 330: | ||
|- | |- | ||
|rand_int | |rand_int | ||
| | |||
| | | | ||
| # | | # | ||
Line 304: | Line 340: | ||
|- | |- | ||
|rand_float | |rand_float | ||
| | |||
| | | | ||
| # | | # | ||
Line 312: | Line 349: | ||
|- | |- | ||
|round | |round | ||
| # | |||
| # | | # | ||
| # | | # | ||
Line 320: | Line 358: | ||
|- | |- | ||
|sin | |sin | ||
| # | |||
| # | | # | ||
| # | | # | ||
Line 328: | Line 367: | ||
|- | |- | ||
|sinh | |sinh | ||
| # | |||
| # | | # | ||
| # | | # | ||
Line 336: | Line 376: | ||
|- | |- | ||
|sqrt | |sqrt | ||
| # | |||
| # | | # | ||
| # | | # | ||
Line 344: | Line 385: | ||
|- | |- | ||
|tan | |tan | ||
| # | |||
| # | | # | ||
| # | | # | ||
Line 352: | Line 394: | ||
|- | |- | ||
|tanh | |tanh | ||
| # | |||
| # | | # | ||
| # | | # |
Revision as of 18:30, 12 December 2014
The calculated question type could benefit of the EvalMath module to increase the math functions useable in the Calculated, Simple calculated et Multiple choice calculated question types.
Available functions
Calculated questions can use more than simple arithmetic operators. The following functions are allowed in versions 1.5 and newer. In 2,9 we should continue to support the previous functions unless they can be unsafe. All functions will use either the EvalMath code or a more specific CalculatedEvalMath code. In the following table to be improved as ... there is some ambiguity on columns names (
# means that the function exists. new means that the function needs to be created in EvalMath or only in CalculatedEvalMath. (... to be explained more clearly ) OK will be used in test column to confirm that this property has been coded and testing code have been added in 2.9 NO i.e. no more supported in 2,9
Function | 1,5+ | Math
lib |
Eval
Math |
Calc | coded | tested | Explanation |
---|---|---|---|---|---|---|---|
abs | # | # | # | # | Absolute value | ||
acos | # | # | # | # | Arc cosine -- output in radians. | ||
acosh | # | # | # | # | Inverse hyperbolic cosine -- output in radians. | ||
asin | # | # | # | # | Arc sine -- output in radians. | ||
asinh | # | # | # | # | Inverse hyperbolic sine.-- output in radians. | ||
atan2 | # | # | Arc tangent of two variables -- pass in two values like (y, x), and you'll get the atan(y/x), adjusted to the proper quadrant. (Note: The variables are in the reverse order to atan2(x,y) in Excel) Output is radians. | ||||
atan | # | # | # | # | Arc tangent -- output in radians. | ||
atanh | # | # | # | # | Inverse hyperbolic tangent-- output in radians. | ||
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 | # | # | new | Decimal to octal | |||
deg2rad | # | # | new | Converts the number in degrees to the radian equivalent | |||
exp | # | # | # | # | Calculates the exponent of e | ||
expm1 | new | 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 | # | new | Returns the floating-point modulus of two numbers - i.e. the remainder when the first is divided by the second. | ||||
is_finite | # | # | new | 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 | # | # | new | Base-10 logarithm | |||
log1p | # | # | new | 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 | # | # | new | Octal to decimal | |||
pi() | # | # | # | # | Get value of pi - the function does not take an argument, like in Excel. | ||
pow (numberToRaise, NumberRaisedTo) | # | # | new | ||||
power (numberToRaise, NumberRaisedTo) | # | new | Exponential expression | ||||
rad2deg | # | # | Converts the radian number to the equivalent number in degrees | ||||
rand | # | # | new | Generate a random integer | |||
rand_int | # | Generate a random integer | |||||
rand_float | # | Generate a random float | |||||
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. |
to be completed --Pierre Pichet (talk) 12:12, 12 December 2014 (AWST)