# Correctness from input - Credit: Jocelyn Dagenais

A student enter an equation of a line in an input. We check if the function is correct.

Is there a way to achieve this without a graph? I have a table of random values and want them to type a linear equation for the data. Tables don’t have slopeOfLine or yInterceptOfLine to access.

I’m having similar trouble (though I have a workaround, so maybe frustration) wanting to use variables I’ve created (really randomly generated constants) in simpleFunctions. Just thought I’d throw that one in, but really want a solution to the first question.

Fun fact: xyLine is a function and can be used basically anwyhere! likewise, slopeOfLine and yInterceptOfLine branch off of xyLine and can be used anywhere xyLine can.

In any case, here are two examples of checking linear equations without a graph:

When you’re using random points it might actually be better not to check for y-intercepts and slope. If you do that you’ll have to check for a multitude of things like vertical lines, and calculate the slope and y-intercepts between the points manually.

Method #1 uses xyLine to check that a line has been entered and then parseEquation to evaluate against he points.

Sorry this took so long!

I liked this example because of the results column in particular, but I didn’t like that it resets the Results when you click on a cell to edit it. I wanted to give students multiple (but limited) opportunities to check their answers and came up with this solution. How the answers are checked can obviously vary.

I also included a way of locking cells so they aren’t accidentally deleted after checking for correctness.

Multiple Check Answer w/ Locking Cells when Correct

I’ll post this in the Examples thread too.