Factoring Correct Check

Is there a way to correct check this factoring problem so that they cannot type in the original polynomial?

You can use pattern matching for this - it’s a fairly new feature so not fully documented yet, but essentially adding this to your CL:

answer = function.evaluateAt(0)=6 and function.evaluateAt(1)=12 and binom.matches(this.latex)

will only accept a correct product of two expressions - ie. (x+2)(x+3) - as the answer.

1 Like

Hi. I tried that. Now it won’t do the “check”. It won’t mark it as correct or incorrect…just get the dot…

You’ve kept in the line that said correct: answer…?

yes. I tried this: This works but only allows for 1 correct answer not allowing for commutative prop. I am totally new to this and I assume I can put in an or statement or something…

function = simpleFunction(this.latex)
check1 = function.evaluateAt(-2)=0 and function.evaluateAt(-3)=0 and binom.matches(this.latex)
correct: check1 and check2


In that case, check1 handles checking of the values (through evaluateAt) and that it’s in factorised form (through binom.matches). You don’t need check2.

1 Like