Can authors in WeBWorK specify how often a given character is allowed in answers? As I recall, the MyOpenMath homework system allows the exercise author to specify how often a character is allowed in an answer, with different specifications for different answers in multi-part exercises. (MyOpenMath uses some parameter name like “answertimes”?)

Here’s why I interested in such an option.

I’m in the midst of trying to code WeBWorK exercises to match an open college algebra text (https://aimath.org/textbooks/approved-textbooks/yoshiwara/ ). In many of the exercises, the point is for the students to put answers in a particular format.

The common WeBWorK strategies for coding such problems seem to involve setting an appropriate context, appropriately disabling relevant functions and operations, and/or having students parse their answer and input parts in separate answer boxes.

For example, I just tried to code something for a set of exercises with the instructions, “Simplify by applying the laws of exponents. Write your answers with positive exponents only. Assume that all variables represent positive numbers.” The expressions the student sees involve arithmetic operations on power functions (kx^p) with rational exponents p.

So the answers expected in the textbook would have the form kx^p or k/x^p. The real constant k may or may not be a positive integer, and the positive rational exponent p might or might not be an integer.

I don’t see a way to get WeBWorK to reject equivalent expressions to the desired answer in a single answer box because the correct answer involves multiplication, powers, and perhaps negation and/or division. That is, the desired answer for simplifying -x^(1/3) / x^(5/3) will require the use of both the “-” symbol and the “/” symbol, but I don’t want the student to get credit for copying the given expression nor for entering “-x^(-4/3)”--instructions specify positive exponents.

On the other hand, I don’t want to ask the student to answer in two boxes, namely one for the constant (-1) and another for the exponent, because I don’t want to give away that the answer for this particular problem requires the student to put the power in a denominator—one goal of the exercise is for students to recognize that having a negative exponent corresponds to a reciprocal. (And the textbook typically has several parts to each exercise, one part’s answer will have the power in the denominator and another won’t.)

I’m looking for a way to code to this particular type of problem, and I’m hoping it might smoothly generalize to lots of other exercises that restrict the form of the answer.

So using the MyOpenMath capability in my example, I could specify that the “-” occurs exactly once, “/” occurs exactly twice, and the decimal point "." not occur at all in any correct answer. (Depending on the Context, I might specify that “root” not occur at all.) Or instead of counting occurrences of “/”, perhaps I might specify that “(“ occurs at most once.

Yes I do see issues with MyOpenMath rejecting what should probably be acceptable, and it’s tricky specifying the right restrictions. But I think the optional capability of specifying characters on a per-answer basis offers a lot more flexibility in exercises that require a specific format.

Cheers.

Bruce