I’m creating table in which students can check their answers. Some of the answers are numbers and some are expressions. How to write the line for variable expression input?
Here are some of the lines for the number check. But I desire a line that would check 2r, as an example:
submitButtonText:“Check my work.”
isCorrect1=table3.cellNumericValue(1,2)=14 and table3.cellNumericValue(1,3)>43.8 and table3.cellNumericValue(1,3)<44
isCorrect2=table3.cellNumericValue(2,1)=13.4 and table3.cellNumericValue(2,3)>84 and table3.cellNumericValue(2,3)<84.2
isCorrect3=table3.cellNumericValue(3,1)=13 and table3.cellNumericValue(3,2)=26
isCorrect4=simpleFunction(table3.cellContent(4,2).latex,“r”).evaluateAt(1)=2 and simpleFunction(table3.cellContent.latex(4,2),“r”).evaluateAt(2)=4
in simpleFunction, first parameter is whatever expression you want. Following that are any variables in the expression in quotes. evaluateAt() does what it sounds like. You need as many parameters as there are variable parameters in the simpleFunction.
Then, if it was supposed to be “2r”, I’m saying if you evaluate at r=1, then it should be 2 and if you evaluate at r=2, it should be 4.
You can clean up the above code by setting a variable for the function.
So… I tried the suggestion at the end of this post and the .latex isn’t working in the table. How can I check a table for the correct expression with one variable?
Here’s a picture of the table:
I tried it without the .latex and it didn’t show an error on the CL, but it also didn’t show correct in the table. Where should the ${…} go? Other suggestion?
exp1=simpleFunction(this.cellContent(2,2),"3x+9")
isCorrect1=exp1.evaluateAt(1)=12 and exp1.evaluateAt(2)=15
cellSuffix(2,2): when isCorrect1 "✅" otherwise ""