Correct in Math Input in one form by not another

I want the math input to be correct for certain algebraic forms but not others.

I want it to be correct when the latex is 2x^2+5x+3-\frac{16}{4x-9} or 2x^2+5x+3+\frac{-16}{4x-9} but not correct when the latex is \frac{8x^3+2x^2-33x-43}{4x-9} or something similar even though the algebraic expressions are equivalent. I tried the code above, but it doesn’t quite work, and marks it correct regardless of the form.

The question I am asking is:

so the form is important, to a degree…

You could add the use of countNumberUsage instead of the not(submit14.latex...). (Also, FYI you’re not making use of defining input=submit14.latex in correct and submitDisabled to simplify your code.)

...and countNumberUsage(input,5)=1 and countNumberUsage(input,16)=1 ...

It checks how many times a value is used. It doesn’t take negatives, so the count for 16 will be 1 whether they use 16 or -16. I only used 5 and 16 because they were the only unique values in the correct answer. You can also eliminate the use of values if you felt it was necessary:
...and countNumberUsage(input,8)=0...

Thanks so much! I am wondering how I could define an input to simplify the code so I don’t have to list what need to be correct multiple times. Thanks again!

1 Like

This may be useful to you.