Greetings,

I am not an experienced WeBWorK problem writer, and I am looking for suggestions on ways (if any) to implement certain answer restrictions in the following problem that I am trying to write.

Problem 1. Expand the log expression as far as you can using properties of logarithms:

\[ \ln \sqrt[3]{\frac{x^2}{1 + \sqrt{x^2 + 1}}} \]

The main restrictions in the entered answer that I want are:

(a) "No decimals": Numerical terms/fractions entered in the answer cannot contain decimal points; and

(b) "Logs fully expanded": For any occurrence of the ln() function in the answer, its argument, i.e. the expression directly enclosed by the ln() function, cannot be in the form of a product, quotient, or a power operator, or a sqrt function.

(In particular, the answer must be a numerical linear combination of fully expanded log terms where the numerical scalar coefficients do not contain decimal points.)

Examples of acceptable and unacceptable answer entries for the problem:

Acceptable: (1/3) * (2 * ln(x) - ln(1 + sqrt(x^2 + 1)))

Acceptable: (2/3) * ln(x) - (ln(1 + sqrt(x^2 + 1)))/3

Unacceptable: 0.333333 * (2 * ln(x) - ln(1 + sqrt(x^2 + 1)))

Unacceptable: (1/3) * (ln(x^2) - ln(1 + sqrt(x^2 + 1)))

(Also, the answer should not contain irrelevant functions such as sin(), and WeBWorK should display the correct answer with the above restrictions as well.)

I can try to enforce entering of numerical fractions without decimals with Context("Fraction") and "Parser::Number::NoDecimals". I can also try enforcing log expansion with Context()->functions->disable() and Context()->operators->undefine() on functions/operators like sqrt, "/", "**", "^", etc (as explained in the Introduction to Contexts wiki page), but the problem is that some of those functions/operators need to be allowed in parts of the entered answer.

Any ideas on how can I do the above?

Thanks,

A.D.