CanvasFormulaQuizQuestionHelperFunctions
CanvasFormulaQuizQuestionHelperFunctions
Canvas requires users to manually input formulas when creating formula quiz questions with variables. The
Formula Definition section of the formula quiz question builder includes a text field where users must define the
quiz question formula (see image below).
For more information about using the Math Editor in the Rich Content Editor to build formula quiz questions, view
additional PDF resources: How do I use the Math Editor in the Rich Content Editor?, Canvas Equation Editor Tips:
Basic View and Canvas Equation Editor Tips: Advanced View.
Helper Functions
Use the helper functions listed below to build formulas in the Formula Definition section of the Formula question
quiz question creator.
Notes:
● All functions accept only numeric parameters.
● All trigonometric function calculations are performed in radians. To convert to or from degrees, use the
deg_to_rad( ) or rad_to_deg( ) functions.
● The Formula Definition text field does not designate definable variables with square brackets.
● Variables must start with a letter and may be followed by any combination of letters and numbers. Keep
in mind that variable names are case sensitive and characters other than letters and numbers are not
recognized.
● In the Formula Definition text field, Canvas translates the entry of the letter “e” as the constant e.
● Helper functions can be nested. For an example of nested helper functions, see the entry for At in the
table below.
● Several functions operate on a list of numbers. Unless otherwise noted, the list parameter is defined with
a comma-separated list of values or with a nested reverse( ) or sort( ) function. For example, use either
median (x1, x2, x3) or median(reverse(x3,x2,x1)).
● To negate an expression in the Formula Definition field, multiply the function by -1. For example, type
-1*sqrt(5x).
Arccosine acos(x) ● Returns the inverse cosine of a real number x as a radian measure
Arcsine asin(x) ● Returns the inverse sine of a real number x as a radian measure
Arctangent atan(x) ● Returns the inverse tangent of a real number x as a radian measure
● This function does not support two parameters
Ceiling ceil(x) ● Returns the smallest integer greater than or equal to the given value
Combination comb(n, k) ● Returns the number of combinations when k is chosen from a group of n
Degrees to Radians deg_to_rad(degrees) ● Converts an angle x from degrees into radians by multiplying by 𝜋/180
Floor floor(x) ● Returns the smallest integer less than or equal to the given value
If if(bool, success, fail) ● If the first expression evaluates to a non-zero value, then it returns the
second value, otherwise it returns the third value
Logarithm (natural) ln(x) ● Returns the natural log of the given value
Logarithm (common) log(x, [base]) ● Returns the log of the given value with an optional base
Mean mean(list) ● Returns the arithmetic mean or average of the values in the list
Permutation perm(n, k) ● Returns the permutation result for the given values
Radians to Degrees rad_to_deg(radians) ● Converts an angle x from radians to degrees by multiplying by 180/𝜋
Random rand(x) ● Returns a random number between zero and the range specified, or one
if no number is given
Round round(x) ● Returns the given value rounded to the nearest whole number
Sort sort(list) ● Returns the list of values, sorted from lowest to highest
Square Root sqrt(x) ● Returns the square root of the given real number x
● To obtain the negative square root, use -1*sqrt(x)