The following mathematical functions can be used by a designer in the formula of a calculated quiz question.
| Supported Function | Description | Available in WebCT version |
|---|---|---|
| ( ) | Parentheses, used to group elements for precedence | All |
| + | Add | All |
| - | Subtract | All |
| * | Multiply | All |
| / | Divide | All |
| ** | Exponent. For example, 2**3 = 8 | All |
| % | Modulus or remainder. For example, 10%3 = 1 | CE 3.8 and later |
| ! | see fact(x) | CE 3.8 and later |
| abs(x) | Absolute value. For example, abs(-3) = 3 | All |
| acos(x) |
Arc cosine (calculated in radians). |
CE 3.8 and later |
| asin(x) |
Arc sine (calculated in radians). |
CE 3.8 and later |
| atan(x) | Arc tangent (calculated in radians). See also Note 2. Tip: If atan(x) is not available in your version of WebCT, use atan2(x,1) |
CE 3.8 and later |
| atan2(x,y) | Arc tangent. Calculates the arctangent, in radians, of the two variables x and y. It is similar to calculating the arc tangent of x / y, except that the signs of both arguments are used to determine the quadrant of the result. See also Note 2. | All |
| ceil(x) | ceil(x) rounds x up to the nearest integer. For example, ceil(-2.34) = -2 |
CE 3.8 and later |
| cos(x) | Cosine. Calculates the cosine of x where x is measured in radians. See also Note 2. | All |
| cosh(x) | cosh(x) returns the hyperbolic cosine of x, which is defined mathematically as (exp(x) + exp(-x)) / 2 |
CE 3.8 and later |
| exp(x) | Natural exponent, ex. For example, exp(1) = 2.71828 | All |
| fact(x) x! |
Factorial. For example, fact(3) = 3! = 3*2*1 = 6 |
CE 3.8 and later |
| floor(x) | floor(x) rounds x down to the nearest integer. For example, floor(-2.34) = -3 |
CE 3.8 and later |
| int(x) | Integer portion of expression. For example: int(5.99) = 5; int(-3.99) = -3. | All |
| ln(x) | Natural logarithm. | CE 3.8 and later |
| log(x) | Natural logarithm, loge(x) or ln(x). For example, log(2.71828) = 1 | All |
| log10(x) | Base-10 logarithm. Tip: If log10(x) is not available your version of WebCT, use log(x)/log(10) |
CE 3.8 and later |
| max(x,y,…) | The maximum of the parameters. For example, max(1,5,3,2) = 5 |
CE 3.8 and later |
| min(x,y,…) | The minimum of the parameters. For example, min(1,5,3,2) = 1 |
CE 3.8 and later |
| round(d,x) | Rounds x to d decimal places. Halfway cases round away from zero. For example, round(0,1.5) = 2; round(0,-2.5) = -3; round(2,-2.666) = -2.67; round(-3,5555) = 6000 |
CE 3.8 and later |
| sin(x) | Sine. Calculates the sine of x where x is measured in radians. See also Note 2. | All |
| sinh(x) | sinh(x) returns the hyperbolic sine of x, which is defined mathematically as (exp(x) - exp(-x)) / 2. |
CE 3.8 and later |
| sqrt(x) | Square root. For example, sqrt(9) = 3 | All |
| sum(:v,x,y,z) |
Summation, where:
Example usage in a calculated quiz question: |
CE 3.8 and later |
| tan(x) | Tangent. tan(x) is defined as sin(x)/cos(x). Calculates the tan of x where x is measured in radians. See also Note 2. Tip: If tan(x) is not available in your version of WebCT, use sin(x)/cos(x) |
CE 3.8 and later |
| tanh(x) | Hyperbolic tangent. tanh(x) is defined as (exp(x)-exp(-x))/(exp(x) + exp(-x)) |
CE 3.8 and later |