I am trying to create the code that will allow students to input a coordinate point into a math input and have that point appear on a graph (as the vertex to a parabola). I’m reading through the CL documentation and struggling. Thanks in advance!
Thank you. Do I need to define my variables in the Math input CL?
Essentially, I want to provide a graph y = (x -2)^2 + 5 and have students input the vertex (2,5) and see that it appears at the minimum point to connect that relationship between vertex form and the vertex.
No you don’t need to define variables in the math input, though you may want to add a correct sink to it, so you get a checkmark on the dashboard.
correct: parseOrderedPair(this.latex).x=2 and parseOrderedPair(this.latex).y=5
(You’ll also need readOnly: true in your graph CL.)
Also, I misunderstood your need. Instead of the function in the graph with variables h and k. Make a point (h,k). If you allow it to set sliders, you can choose a color. Then, delete the sliders or you’ll see an initial point.
Essentially, any component that can be “graded” (i.e. has a correct sink available) needs to have correctness defined or defined as read only to get a checkmark. Text inputs and explain prompts will never get checkmarks because it’s expected the teacher needs to look at those slides.
In my math input CL it says “objects of different types are never equal”. In my graph CL it says “sink number expects a number but got a latex”. In my graph, I have the equation y = (x-2)^2 + 5, a point (h,k) with sliders and I hid the point.
I always forget it outputs latex. Either put backticks around the 2 and 5, or (I think less likely to have errors) use numericValue around the left hand side of each:
correct: numericValue(parseOrderedPair(this.latex).x)=2 and numericValue(parseOrderedPair(this.latex).y)=5
Now, it says graph1 has no source for latex and gives me additional options. Here is what I have:
number(h): numericValue(parseOrderedPair(this.latex).x)
number(k): numericValue(parseOrderedPair(this.latex).y)
readOnly: true
Success. I really appreciate all of the help. Now that I have a working code, I’m hoping to work backwards to better understand some of the terms and language. Thanks.