Operations, functions, and variables
The Mastering series uses algebraic expression matching to determine if student submissions match the answer you coded. If the correct answer is 0.5*m*v^2 and a student enters v*m*(v/2), the answer is graded as correct.
When you enter a wrong answer response for a symbolic question, the program matches any expression a student submits that is algebraically equivalent to that response. If the wrong answer is a number, then it matches any student-submitted number within the specified tolerance.
Notation
Code symbolic answers using standard infix notation, shown below.
Important: Always use parentheses and multiplication signs in your answers. For example, when coding the product of "a" and "(b+c)", the correct syntax is:
a*(b+c)
not
a(b+c)
The latter indicates that a is a function of b+c.
Arithmetic operators
The Mastering series recognizes:
- Standard arithmetic operators (+, -, *, / )
- The exponentiation operator (^)
For example, 1 * 10^{-1} would be another way of coding 0.1.
Order of Operations
Note the following as you code your answers:
- Terms inside the most deeply nested set of parentheses are evaluated first.
- Exponents are evaluated next. They are always evaluated from right to left. For example, 3^2^2 is evaluated as 3^(2^2), but 3/2/2 is evaluated as (3/2)/2.
- Multiplication and division are evaluated next, from left to right.
- The Mastering series evaluates addition and subtraction last, from left to right.
Randomized Variables
An answer of type solutionSymbolic may be a function of any or all of the randomized variables as defined using the varDefinition element.
Note: A correct answer cannot be a combination of symbolic and randomized symbolic. For example, you cannot have a correct answer of type 2*sin(theta)*cos(n*theta), where theta is a fixed symbol and n is a randomized variable.
Recognized Functions
You can add the functions below to symbolic answers.
Important: Functions are case sensitive.
Arguments in radians or degrees: The arguments of trigonometric functions are in radians, not degrees. Alternatively, you can set the arguments to degrees in the item attributes. When the answer should be in degrees, be sure to specify this in the problem statement. (Otherwise, students expect that they should be answering in radians.)
For this special function | Enter this from your keyboard | What the student types |
---|---|---|
absolute value | abs(x) | | |
arccosine | acos(x) | arccos(x), acos(x), or cos^-1(x) |
arcotangent | acot(x) | arccot(x), acot(x), or cot^-1(x) |
arcosecant | ascs(x) | arcscs(x), ascs(x) or csc^-1(x) |
arcsecant | asec(x) | arcsec(x), asec(x), or sec^-1(x) |
arcsine | asin(x) | arcsin(x), asin(x), or sin^-1(x) |
arctangent | atan(x) | arctan(x), atan(x), or tan^-1(x) |
cosine | cos(x) | cos(x) |
cotangent | cot(x) | cot(x) |
cosecant | csc(x) | csc(x) |
e raised to a power Note: Avoid using the solutionSymbolic or solutionSymbolicSet answer type for large positive or negative exponents, such as exp(37000) or exp(-37000). Currently Mastering doesn’t always evaluate large exponents correctly. Instead, use another answer type, such as a multiple choice (solutionMultipleChoiceRadio/Dropdown or solutionMultipleSelect). |
e^(x) or exp(x) |
e^x or exp(x) |
natural logarithm (base e) | ln(x) | ln(x) |
common logarithm (base 10) | log(x) | log(x) |
secant | sec(x) | sec(x) |
sine | sin(x) | sin(x) |
square root | sqrt(x) | \sqrt |
tangent | tan(x) | tan(x) |
The following functions are available in Mastering for authors, but are not needed by students.
Function | Use this format | Purpose and example |
---|---|---|
ceiling | ceil(value) |
Purpose:
Example:
|
floor | floor(value) |
Purpose:
Example:
|
ifthenelse | ifthenelse(test,true_value,false_value) |
Purpose:
Example:
|
integer | int(value) | Purpose:
Same as the floor function (rounds a value down to the nearest integer).
Example: |
random | rand(range-start,range-end,exponent) | Purpose:
Generates a random number within a specified range, optionally rounded to a specific power of 10.
Example: |
round | round(value, exponent) | Purpose:
Rounds a value to a specific power of 10.
Example: |
significant digits | sigdig(value, exponent) | Purpose:
Rounds a value to a specific number of significant digits.
Example: |
See also: