content: when orderedPairinput2.submitted and numericValue(myPair.x)="’\frac{4}{3}’" and numericValue(myPair.y)="’\frac{4}{3}’" “Great job!”
when orderedPairinput2.submitted “Check your work to see if you can find your mistake.”
otherwise "Solve the system of equations through substitution:
correct: orderedPairinput2.submitted and numericValue(myPair.x)="\frac{4}{3}" and numericValue(myPair.y)="\frac{20}{3}"
It’s giving me an error saying “Objects of different types are never equal (in this case number and string)”. Could you help me? I’m trying to have them submit an answer with fractions as the x- and y-values of the coordinates.
I don’t believe this is possible yet, at least not as you’ve stated. The issue is that the \frac is really a string (or a latex object) but numericValue will give you a number like 0.4
An added complication is that your example fractions don’t evaluate to nice decimals so you would need to test whether they are in the vicinity of 1.333333, for example.
@Bryn is correct. Basically, if you’re using quotes around the whole thing, it’s a string. Your comparison should probably compare rounded values as well:
correct: orderedPairinput2.submitted and numericValue("\round(${myPair.x},1)") = numericValue("\round(\frac{4}{3},1)")
Change the 1’s to however many decimal places you feel is appropriate.
Also, if you want answers in fraction form, you can also use countNumberUsage to check for values they used. You might want to add this to correct:
...and countNumberUsage(orderedPairinput2.latex,4)=1 and countNumberUsage(orderedPairinput2.latex,3)=1
Note that countNumberUsage doesn’t take negative values, so if a student was supposed to enter -4/3 you’d use 4 to check not -4. numericValue should take care of any ambiguity of positive versus negative.