Students are asked to write 7x^2 as a factor pair. The correct answer is 7x * 1x. They may type the answer as 7x * x which is also correct. I’ve been using countNumberUseage to look for the coefficients but in this case how can I check for the 1 if they don’t type it? When I just look for the 7 then it marks 7x^2 as correct.
As apossible work around I’m thinking I may have to prompt them to write x as a 1x but I’d rather not.
Here is my code (a is 7x^2 and e1 what the student submits)
c1=when simpleFunction(a,“x”).evaluateAt(3)=simpleFunction(e1,“x”).evaluateAt(3) and
countNumberUsage(e1,7)=1 and countNumberUsage(e1,1)=1 1
A couple ways you could get around this. First just a quick note. simpleFunction defaults to in terms of x, so you don’t need the “x” in your code. You only need to specify if it’s something other than x or if it’s multivariable.
You could just leave out searching for 1, and instead make sure 2 is missing:
Thanks! Didn’t realize that countNumberUsage would also look at exponents but it makes sense. Also, appreciate the nugget about simpleFunction defaulting to x.
You can also count all numbers by leaving out the second parameter. So, if you wanted for whatever reason to distinguish between students writing 1x and just x, you could use that like:
when countNumberUsage(e1)=2 and countNumberUsage(e1,1)=1...