# Check table value

I am hopelessly lost in all of this, but I feel like there should be a way to do what I want…

Here’s my Work In Progress: https://teacher.desmos.com/activitybuilder/custom/5e9f5198762da1796f45598e

I would like to check if the values students enter into the table on the last screen really are solutions to the system of equations and have a check mark appear in the dashboard.

I created a c_orrect number in the first graph, then copied that graph through. My hope is that I can use the values in the table to set numbers “a” and “b” in graph1 (screen 9), then on screen 12, I can check to see if “a” and “b” set the value of c_orrect to 1. Ultimately, I would use all of the inequalities, but I’m just testing with the first one. I would then hide all of that work and not display those lines.

Is this the right approach? Can it be tweaked to work?

Try checking out some of this thread…

I have used a template posted for checking values in a table. Every example has integer values assigned to the answer variable. How do I assign an irrational number or for that matter a negative fraction to the answer checking cell?

You mean the parameters in evaluateAt() if I’m understanding correctly. You can use numericValue to directly calculate something as a parameter. You can also use variables you create, which is less messy. Just be careful with irrational and non-terminating variables. You’ll always want to round. Say I already had an equation in terms of x, eq1 and I want to evaluate for pi:
n = eq1.evaluateAt(numericValue("\pi"))
or

pi=numericValue("\pi")
n = eq1.evaluateAt(pi)


or a negative fraction:
n = eq1.evaluateAt(numericValue("-2/3"))
or

myFraction = numericValue("-2/3")
n = eq1.evaluateAt(myFraction)


Thanks but what I want to do is check whether an irrational number value entered by a student in a table is the correct answer. For instance in the code you posted for “table based automatic checking” your example checks answer1=1. I want to check: answer= \sqrt(2)/2

Right. What I was trying to get across was to use numericValue if you need non-integer.

answer = numericValue("\sqrt(2)/2")

But just recognize with non-terminating decimals comparisons do not always work cleanly and you’ll want to do something similar to the other thread I referenced. Like this anwer rounded to 4 decimal places would be better for comparison:
answer = numericValue("\round(\sqrt(2)/2, 4)")

(In my original response to you replace the pi or myFraction with answer.)

Ahh, got it…thanks so much

I tried your rounding hack (4 decimal places) but when I enter the symbolic representation in the answer field it is not comparing correctly.

Oh, you’ll want to compare to the cell value rounded as well so something like:

answer = numericValue("\round(\sqrt(2)/2, 4)")
student = numericValue("\round(\${this.cellContent(1,2)}, 4)")


where answer is the target answer and student is the student’s input in row 1 column 2, each rounded to 4 decimal places. correct outputs true or false for whether answer=student.

The rounding seems like extra, but comparing unrounded decimals can lead to errors. I’m not a developer so I can’t precisely explain why.

That makes perfect sense but I still can’t get it to work. Would you have a look at my code? The offending screen is #9.

Looks like answer5 and answer6 were coming up undefined. I put -sqrt2/2 into the desmos calculator, then copy/pasted into CL and this works as a replacement:

answer5 = numericValue("\round(-\frac{\sqrt{2}}{2}, 4)")

Parentheses instead of curly braces for sqrt was probably the main culprit.

Also, I might suggest using cellSuffix to give feedback for each individual cells instead of trying to conditionally change your note so much. Here’s my version. I also used countNumberUsage to ensure students are typing the radical.

Excellent! thanks, one last question. How would I check for an answer “undefined”

You could use isUndefined().

check1= isUndefined(this.cellNumericValue(1,2))

(I didn’t try it, but something to that effect.)

Great, that does exactly what I want.