## Moodle - Math Operator Syntax

Note:

UW-Madison has adopted Canvas as its single, centrally supported learning management system. As of 6/1/2018, support for Desire2Learn (D2L) and most Moodle courses has been discontinued. Access to those courses has permanently ended. However, certain Moodle courses that are part of the Adanced Quizzing Content Functional Gaps project are still available on Moodle. Those courses are located on the Moodle Extension site.

A listing and basic guide for the use of operators on calculations within Moodle

Declaring a random variable (e.g. variable x) : {x}
Subtraction: -
Multiplication: * (note: the multiplication symbol must be used.  3*x will work while 3x will not)
Division: /
Pi: pi() (please note that this is the only predefined constant.  For example, there is no e() function)

Function Explanation
absAbsolute value
acosArc cosine -- output in radians.
acoshInverse hyperbolic cosine -- output in radians.
asinArc sine -- output in radians.
asinhInverse hyperbolic sine.-- output in radians.
atan2Arc tangent of two variables -- pass in two values like (y, x), and you'll get the atah(y/x), adjusted to the proper quadrant. (Note: The variables are in the reverse order to atan2(x,y) in Excel) Output is radians.
atanArc tangent -- output in radians.
atanhInverse hyperbolic tangent-- output in radians.
bindecBinary to decimal
ceilRound fractions up
cosCosine -- in radians!!! Convert your degree measurement to radians before you take the cos of it.
coshHyperbolic cosine -- in radians!!! Convert your degree measurement to radians before you take the cosh of it.
decbinDecimal to binary
decoctDecimal to octal
expCalculates the exponent of e
expm1Returns exp(number) - 1, computed in a way that is accurate even when the value of number is close to zero
floorRound fractions down
fmodReturns the floating-point modulus of two numbers - i.e. the remainder when the first is divided by the second.
is_finiteFinds whether a value is a legal finite number
is_infiniteFinds whether a value is infinite
is_nanFinds whether a value is not a number
log10Base-10 logarithm
log1pReturns log(1 + number), computed in a way that is accurate even when the value of number is close to zero
logNatural logarithm (ln)
maxFind highest value
minFind lowest value
octdecOctal to decimal
pi()Get value of pi - the function does not take an argument, like in Excel.
pow (numberToRaise, NumberRaisedTo)Exponential expression
For example:  x3 would be written as pow(x,3)
randGenerate a random integer
roundRounds a float
sinSine -- in radians!!! Convert your degree measurement to radians before you take the sin of it.
sinhHyperbolic sine -- in radians!!! Convert your degree measurement to radians before you take the sinh of it.
sqrtSquare root
tanTangent -- in radians!!! Convert your degree measurement to radians before you take the tan of it.
tanhHyperbolic tangent -- in radians!!! Convert your degree measurement to radians before you take the tanh of it.

For a more comprehensive list of operators and more information see the Calculated Question Moodle docs page
For information on how to use the DragMath Equation Editor, visit the Equation Editor page.

Keywords: Doc ID: math, calculate, question, quiz, operator, syntax, 2.3, 2.4   Suggest keywords 26756 Elizabeth H. Moodle 2012-10-10 12:17 CDT 2018-03-05 17:56 CDT DoIT Help Desk, Moodle 8   0     Comment