Checking Text Answer in CL

#1

I want to provide students with a message (like “Great Job!”) if they enter the correct solution to a system of equations in the text input and a message like (“check your work to see if you can find your mistake. If you need help, ask your teacher or a classmate”). Is there a way to do this?

#2

You might want to use a math input instead of text input because extra spaces could unnecessarily mark the student’s answer wrong. Here’s an example of what you’re looking for.

#3

I want to do something similar, but in my case I want to evaluate an equation that the student enters. See the activity here.

I am comparing an equation to an expected solution. Can I make this more tolerant of different forms?

solution = “y=-2x+5”

content:
when exp1b.timeSinceSubmit>0
when exp1b.latex=solution “Excellent!”
otherwise “Almost! Try again.”
otherwise “Write the equation of the line that is perpendicular to the line y=1/2x+3 through the point (4, -3).”

#4

There is a nice solution for your question as well. In the first example, there is a function called parseOrderedPair that I used. It reads the input as an ordered pair and then you can match x and y values.

For your question, there’s a function called xyLine. It reads the equation and you can match the slope and y-intercept (along with a few other things). Check out slide 2 in the note and input component.

#5

Thanks so much! That works much better.

Two other quick questions.

  1. You changed the script associated with myNote1a to the following.
content: 
when exp1a.timeSinceSubmit>0 
  when exp1a.script.correct "Excellent!"
  otherwise "Almost! Try again."
otherwise "Write the equation of the line that is parallel to the line y=1/2x+3 through the point (4, -3)."

I’m confused by the expression “exp1a.script.correct”. Is that the sink for the exp1a or the variable (of the same name). If it’s the sink, couldn’t I just use “exp1a.correct”?

  1. I was hoping to format my equation in the note better. Is there any way to enter (and have Desmos render) a latex expression within the content of a note? I’d like to do better than simply “Write the equation of the line that is parallel to the line y=1/2x+3 through the point (4, -3).”

Thanks again for your assistance!

#6

Sorry, but one more question. I’m trying to apply your changes to other slides and am having difficulty checking for a slope of 1/3. I’ve tried:

equation = xyLine(exp2b.latex)

correct = equation.slope = 1/3 and equation.yIntercept=2

correct: correct

but I can see that it’s not that simple. Is there any way to compare the slope to a fractional value?

#7
  1. Since you had two different locations where you were defining the correct answer - the input component and the note component - I created a variable in the input component called “correct.” Since it was defined in the note component, I started by typing “exp1a” because that’s what you named the component. After that, .script looks for any defined variables in that component, and then .correct was the name of the variable. I suppose I should have named it something different so as not to be confused with the sink. Good question!

  2. To format the equation better, try typing the equation into the graphing calculator, then copying and pasting into the code. Your example would look like this after pasting: y=\frac{1}{2}x+3 You will need to put backticks ` around the equation and then insert another slash, so this should be the final look: image

1 Like
#8

For a non-terminating value, you need to set a tolerance range. Try equation.slope>0.333 and equation.slope<0.334

1 Like