Online Math Test

Instruction on mathematics exercise setting

(1) Using SymPy commands in question settings

When setting the parameters and the answer for a question, you can utilize the following SymPy commands to apply CAS (Computer Algebra System) operations to the expression.
Note that these commands are disabled for students while they are working on the exercises.

factor expand collect diff integrate

Examples for the SymPy commands:

 factor(x^2-1)
 expand((x-1)^2)
 collect(x^2+y^2+xy,x)   (Result: x^2 + xy + y^2) 
 diff(x^3,x), diff(x^3,x,2)
 integrate(x^2,x), integrate(x^2,(x,0,1))

Example of question setting:

Question:
Calculate the factorization of polynomial $f$:
$$
f(x) = x^2 + b x + a
$$
Parameters:
a=1,...,8
b=1 + a
g=x^2 + b x + a
Answer:
factor(g,x)

(2) About indefinite integral

By enabling the option Allow the addition of a constant (e.g., indefinite integral), the question is processed under the "indefinite integral" mode. In this mode, an answer that differs from the given answer by a constant is allowed.

For example, both (x+1) (x+2) and x^2 + 3x are correct if the specified answer is x^2 + 3x .

Note that, if the provided answer is given by x^2 + 3x + C, then a correct answer should also have the "+C" term. For example, (x+1) (x+2) + C .

Example of question setting:

Question:
Calculate the indefinite integral of function $f$:
$$
f(x) = a x + b
$$
Parameters:
a=1,...,5
b=1,...,5
Answer:
integrate(a x + b, x) + C
Allow the addition of a constant (e.g., indefinite integral)
Acceptable answer:
x^2+3x + C
OR
x^2+3x+1 + C 
(In case a = 2, b = 3.)

Last updated: 2023/09/10