I’ve entered this code: (x^{2})(x^{4}-x^{2}+1) to check student’s work
when they factor this polynomial: x^{6}-x^{4}+x^{2}
The code is howing a check amrk when they put the right answer in. Any help is greatly appreciated.
I’ve entered this code: (x^{2})(x^{4}-x^{2}+1) to check student’s work
when they factor this polynomial: x^{6}-x^{4}+x^{2}
The code is howing a check amrk when they put the right answer in. Any help is greatly appreciated.
You need this to check it this way.
x^{2}\left(x^{4}-x^{2}+1\right)
Note this approach would mark the following incorrect.
\left(x^{4}-x^{2}+1\right)x^{2}
even though it would be correct mathematically.
This is another way to approach this. See screen 2.
Here’s a way with pattern matching:
exp1=`x^{6}-x^{4}+x^{2}`
ansF=simpleFunction(exp1)
studF=simpleFunction(this.latex)
p=patterns
prod=p.anyOf(p.product(p.expression,p.expression),p.product(p.number,p.expression,p.expression))
check= prod.matches(this.latex) and studF.evaluateAt(0)=ansF.evaluateAt(0) and studF.evaluateAt(2)=ansF.evaluateAt(2)
suffix: when not(this.submitted) "" when check "✅" otherwise "❌"
Thank you! Sister Kathy