Checking expression or equation as answer

I want students to enter the formula for the circumference of a circle and check it and give some feedback.

I found this in a similar question:

correct = this.latex = -5p-20 or this.latex = -5p+-20

But I want the C = 2 pi r. The above doesn’t like the = in the answer or the pi which turns into the Greek letter when students type in the math interface. So I guess I think my question is how to I get the checker to recognize the = and or the pi letter?

I guess I can do it as multiple choice, but I prefer the free response type answers.

I usually like to involve a graph for my correctness checks, but it can be done without a graph. I strongly recommend using math input when a variable is involved instead of checking for exactly matching LaTeX because there are many ways to represent the same expression. I passed the value of the math input to the graph as a function. I then checked the function outputs at 4 points to make sure it matched the desired formula. Check it out. Also, I used an area question instead of a circumference question, but that’s easily fixed.

2 Likes

If you want to have students type a formula like this, and don’t want to evaluate numerically, you can use patterns. Here is an example for how to match c = 2πr

2 Likes

I’d recommend leading with initialLatex in order to avoid things like students writing the word “Circumference”, etc. and perhaps building in some friendly errorMessage’ing to gently push them in whatever direction you’d like them to go.

2 Likes