Self Checking Quadratic equations

I’m trying to get my activity to tell a student if they got the answer correct and what I’ve done works if the answer only has an exponent of 1 (x) but when I try the same technique with x^2 it doesnt recognize it. Any ideas?

isCorrect= input1.latex = “x^2”
isDoubled = input1.latex = “2x”

content:
when input1.submitted and isCorrect “That is correct!”
when input1.submitted and not(isCorrect) and not(isDoubled) “Try again, remember that area is (length)(width)”
when input1.submitted and not(isCorrect) and isDoubled “That means 2 times x, not x times x, try again.”
otherwise “”

Nice to see you here. :wink: Welcome.

Try using backticks (by the 1 key) instead of quotes.

Alternatively, you can use a computational method:

eq=simpleFunction(input1.latex)
isCorrect= eq.evaluateAt(3)=9 and eq.evaluateAt(4)=16
isDoubled= eq.evaluateAt(3)=6 and eq.evaluateAt(4)=8
...
1 Like

As always Daniel, YOU ARE THE BOMB!!!

1 Like