How do I code the computational layer to verify the input of the mathematical expression 128/x? And then have it provide feedback for being correct or incorrect. See the code I have created so far

input = this.latex
correctExpression = ‘128/x’

isCorrect = numericMatch(input, correctExpression)

correctMessage = “Correct! Great job!”
incorrectMessage = “Incorrect. Please try again.”

content: when isCorrect correctMessage otherwise incorrectMessage

Can you share a link to your activity? There’s some here that is not a CL function, so it’s either incomplete or a mistake, as well as what looks like CL that should be in different components and will not link as written.

I edited original post with the link for you

@Mark_Manganaro You’ll probably get better responses from others, but here are a few suggestions:

  • If you just want to match a student’s input in a math response box to an answer you’ve defined in the CL, you’ll want to type the answer you are looking for into an expression line of the graphing calculator. Then copy that input from the calculator and paste it into the CL of the math response component. For example, the fraction 128/x input into the calculator becomes \frac{128}{x} when pasted in to the CL.
  • The backtick key you want to put around latex type is in the top left of most keyboards - it is shared with the ~ symbol. So your expression 128/x can be designated as \frac{128}{x} not ‘128/x’ (The expression has one backtick before it and one backtick after it, so its style is being changed here in this post)
  • The Content sink can’t be used in a math response component. You can create a separate note component to appear when conditions of the math response component have been met. Use the Content sink to define when/what appears in place of that note component. You’ll want to put the related correctMessage and incorrectMessage variables in the note component along with the content you designate.
  • I’m not sure that numericMatch is a function (I’ve never used it), but you could just define your isCorrect variable as when the student’s input equals your correctExpression variable.

There are limitations to matching inputs with defined latex in the CL, but this modification of your activity gets you what you were looking for on screen 2 and can hopefully give you some ideas moving forward.