Check coordinate point is on a line

I know this question has probably already been asked and answered but I can’t find it.

I want students to enter any coordinate point in a math input box and CL check if the point entered is on a specific line. Example: any point on y=3x

Thank you for all of your assistance!

f= simpleFunction(`3x`)
sPoint= parseOrderedPair(this.latex)
check= f.evaluateAt(sPoint.x)=sPoint.y
correct: check

Thank you for this code. I am getting an error on the “check” line: All arguments to evaluateAt must be numbers.

Try this edit:

f= simpleFunction(`3x`)
sPoint= parseOrderedPair(this.latex)
x=numericValue(sPoint.x)
y=numericValue(sPoint.y)
check= f.evaluateAt(x)=y
correct: check

I forgot sPoint.x and sPoint.y are latex, so you have to tweak it a little to convert them to numericValues.

1 Like