How can I get screen 4 to accept either 2x + y = 10 OR 10 = 2x + y OR y + 2x = 10 as correct responses?
Here you are:
correct = input1.submitted and countNumberUsage(input1.latex,10)=1 and countNumberUsage(input1.latex,2)=1 and exp1.evaluateAt(2,6)=0 and exp1.evaluateAt(4,2)=0
#parseEquation splits the input into the left and right side of the equation
#differenceFunction makes an expression for left side - right side, here specifying variables x and y
#countNumberUsage checks how many times a number is used. (Here this will ensure that slope-intercept form isn’t correct.) It doesn’t accept negatives and if you leave out the second parameter it just tells how many numbers were used.
#evaluateAt() evaluates an expression. Since left - right = 0, I’m checking a few solutions instead of trying to match latex to latex which can cause problems.
Thank you so much! My CL skills are very basic so I would never have thought of this,
-2 will be counted as a 2 so this won’t actually check against slope intercept form. Watch out for countNumberUsage as it wasn’t meant to be used broadly like this. If you use it in a check, make sure that no other arrangements or uses of the numbers will produce the same result.
For linear equations we have a tool called xyLine that is designed for this sort of check:
Specifying form is not something we tend to like to do, but if you must, I’d recommend something similar to what Daniel has with separating the two sides and making sure that (1) the numeric value of one side is 10 (you can evaluate there as well to make sure no variables are tacked on), (2) that the other side evaluated at (0,1) = 1 and (3) the other side evaluated at (1,0) = 0
Alternatively, consider gently nudging students toward standard form with initialLatex clues and tweaking prompts to say things like “change the equation so that…”
Oh right! I was thinking for x+2y=10 since the division wouldn’t have the 10!