Coding Line by Line Repeating Fraction

I am trying to have my amplify code to check each line of an expression. It works for all others, but I can’t figure out how to change it to work for an expression that is equivalent to 9 1/3 due to the repeating fraction. This is what I have used for the others:

cellDisableEvaluation(1,1): true
cellDisableEvaluation(2,1): true
cellDisableEvaluation(3,1): true
cellDisableEvaluation(4,1): true
cellDisableEvaluation(5,1): true
cellDisableEvaluation(6,1): true
cellDisableEvaluation(7,1): true
cellDisableEvaluation(8,1): true

maxRows: 8

cell1 = this.cellNumericValue(1,1)
cell2 = this.cellNumericValue(2,1)
cell3 = this.cellNumericValue(3,1)
cell4 = this.cellNumericValue(4,1)
cell5 = this.cellNumericValue(5,1)
cell6 = this.cellNumericValue(6,1)
cell7 = this.cellNumericValue(7,1)
cell8 = this.cellNumericValue(8,1)

#Evaluate the function at several values, make sure it evaluates the same as the answer key
blank1 = 12
blank2= 12
blank3 = 12
blank4 = 12
blank5= 12
blank6= 12
blank7= 12
blank8= 12

correct: blank1=cell1 and blank2=cell2 and blank3=cell3 and blank4=cell4 # and blank5=cell5

#Create the feedback

cellSuffix(1,1): when this.submitted and cell1=blank1 “:white_check_mark:” when this.submitted “:cross_mark: " otherwise “”
cellSuffix(2,1): when this.submitted and cell2=blank2 “:white_check_mark:” when this.submitted “:cross_mark:” otherwise”"
cellSuffix(3,1): when this.submitted and cell3=blank3 “:white_check_mark:” when this.submitted “:cross_mark:!” otherwise “”
cellSuffix(4,1): when this.submitted and cell4=blank4 “:white_check_mark:” when this.submitted “:cross_mark: Don’t forget terms are separated by addition and subtraction!” otherwise “”
cellSuffix(5,1): when this.submitted and cell5=blank5":white_check_mark:" when this.submitted “:cross_mark:” otherwise “”
cellSuffix(6,1): when this.submitted and cell6=blank6 “:white_check_mark:” when this.submitted “:cross_mark:” otherwise “”
cellSuffix(7,1): when this.submitted and cell7=blank7 “:white_check_mark:” when this.submitted “:cross_mark:” otherwise “”

cellSuffix(8,1): when this.submitted and cell8=blank8 “:white_check_mark:” when this.submitted “:cross_mark:” otherwise “”

submitButtonText:“Check expression and simplification”

For values that are not integers or terminating decimals, you’ll need to use simpleFunction() or numericValue(). For 9 1/3, I’d use numericValue(`9\frac{1}{3}`).

Caveat is that it may not validate correctly if a student enters an expression of some sort that should evaluate to the intended value. In this case, you may want to implement a tolerance instead of cell4=blank4:

tolerance = 0.01
cellSuffix... numericValue(`\abs(${cell4}-${blank4})`) <= tolerance ...

Side note: You can simplify your when-when-otherwise logic by nesting:

when this.submitted
   when cell4 = blank4 "✅"
   otherwise "❌"
otherwise ""