Checking for correct formatting of ordered pair

I’m wondering if there is a way to check the formatting of an input for an ordered pair. I did set up initialLatex to clue them in, but…

You can use something along the lines of isUndefined(parseOrderedPair…) that worked for me in a note

p=parseOrderedPair(exp2.latex)
number("x_1"):numericValue(p.x)
number("y_1"):numericValue(p.y)

content:when isUndefined(graph2.script.p) "enter a coordinate pair in the form (x,y)"
otherwise ""

Do you have an example activity for this?

sure: Parse Point Check • Activity Builder by Desmos

1 Like

This is exactly what I was looking for. I’m trying to have students identify the coordinate of parabolas and make the connections to Vertex Form with the point. The problem is, I can’t get the original note to display. The coding is overwriting the previous content. Is there a particular way to input it in the coding so I can display both?

This helped me, but I want to also check for the correctness of a specific coordinate, say (-2,4).

Could y’all please help with that part?
Thanks!

If I understand your question correctly, after checking the coordinates are in the appropriate format, you want to then check that the coordinates entered match a specific coordinate?

If so, just check the numbers “x_1” and “y_1” against your specific coordinates. For example, checking against your proposed (-2,4):

content:when isUndefined(graph2.script.p) “enter a coordinate pair in the form (x,y)”
when graph2.number(“x_1”)=-2 and graph2.number(“y_1”)=4 “Your message here.”
otherwise “”

Yeah!

I appreciate the prompt reply and help!

Thanks! That did it!

None of this makes sense nor work.
Can someone give me a good website to learn this?
Thank you

For me, I started by copying and modifying AB’s built by others. The documentation is helpful, but not complete. I also watch the videos that Desmos has posted, which have been very helpful. (Create — Learn Desmos) Also, the people on this forum have been incredibly generous with their time and very helpful. I’ve made progress, but it has taken a lot of work! In terms of the specific quote you posted, if you can share a link to your AB, then maybe someone will be able to help. Hang in there.

1 Like

I think you could just use “isUndefined(p)” instead. I’m guessing you don’t have p defined in the graph component (or your input is not called “exp2”), and that may be why it doesn’t work.

parseOrderedPair takes latex in the form (x,y) and makes an ordered pair object. If the latex is not in that form it would come back “undefined” and so the content would show the instructions.

1 Like