 # initialLatex in Math answer box

Here is a copy of my activity. It is designed to give different feedback depending on whether or not a student got the right answer. The right answer is 16 and that is specified in the CL. However, regardless of what answer is given, the screen responds with the feedback for a wrong answer. It appears that the initialLatex is the issue because if I remove it, the screen works fine. However, I’d like to have that initial text in the answer box. Is there a way to correct the issue?

My suggestion would be to turn your student response area into a table and put your initial text in one box and leave the box next to it open for student response. You can do this by clicking the 3 dots to change the direction of the table. I’d love to see other options though.

You can use parseEquation for this situation:

``````check= numericValue( parseEquation(this.latex).rhs )=16
correct: check
``````

This basically takes the latex entry as an equation and checks the numericValue of the right hand side.
Then use mi7.script.check for hiding/displaying your notes.

2 Likes

This worked like a dream! Thank you so much!

1 Like

That is a great idea for certain types of screens I am working on. Thank you!!

I realize after the fact that using numericValue for something like “16x” will return 16, so to make it more accurate:

``````ans=simpleFunction(parseEquation(this.latex).rhs)
check= ans.evaluateAt(0)=16 and ans.evaluateAt(1)=16
correct: check
``````

Here, I’m instead turning the right hand side into a function, which should always evaluate to 16 (i.e. y=16), whereas “y=16x” would vary.

That’s great. It’s a way of checking for equivalent expressions. That is very helpful

Follow up question. The script works beautifully when the initialLatex incorporates variables or, say Greek letters, that are recognized in the Graphing Calculator. It works if the initial latex is a word, like “Expression=”… BUT, it does not work if I use a different symbol, like a capital Greek Letter, or an emoji in the initial latex, like “5🔱=”. Is there a reason why that is? Technically, when we specify rhs, the only expression of interest is to the right of the equal sign.

I believe that if you’d get an error typing it into the calculator, parseEquation( ) will just get an error. It has to be a valid equation (as far as the calculator is concerned) to be parsed in the first place.

1 Like