# Checking cell content that includes more than one variable

**URL:** <https://cl.desmos.com/t/checking-cell-content-that-includes-more-than-one-variable/4524>\
**Category:** Questions\
**Tags:** validation, correctness\
**Created:** [October 28, 2022, 1:10pm UTC](https://cl.desmos.com/t/checking-cell-content-that-includes-more-than-one-variable/4524 "2022-10-28T13:10:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hannah\_Keith](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/hannah_keith/32/2709_2.png) [@Hannah\_Keith](https://cl.desmos.com/u/Hannah_Keith)\
**Post date:** [October 28, 2022, 1:10pm UTC](https://cl.desmos.com/t/checking-cell-content-that-includes-more-than-one-variable/4524/1 "2022-10-28T13:10:40Z")

</div>

On the screen below, I am hoping to add a column to check the correctness of the equations that students type in. Is there a way to do this in a table, even though there is no latex source? I had thought about using the evaluateAt function, but I don’t think that I can since there are variables on both sides of the equal sign.

 ![image](https://canada1.discourse-cdn.com/flex031/uploads/desmos/original/2X/1/120d5e5ea8362ebc0989055de45f09a99c6fa282.png)

---

<div class="post-metadata">

**Author:** ![ianmcmeek](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/ianmcmeek/32/3966_2.png) [@ianmcmeek](https://cl.desmos.com/u/ianmcmeek)\
**Post date:** [October 28, 2022, 2:25pm UTC](https://cl.desmos.com/t/checking-cell-content-that-includes-more-than-one-variable/4524/2 "2022-10-28T14:25:57Z")

</div>

By default, each column in a table is set to ‘Format as math’, and this means that when you use something like `this.cellContent(1,2)` you are automatically getting the Latex value of a student’s input. This opens up a few ways to add correctness checks depending on how thorough and complex you want to get:

1. You _could_ check the exact Latex string a student enters, but then you run the risk of marking some correct answers as incorrect based on format choices (e.g. a student enters 0.5 instead of 1/2 or they enter y - -4 instead of y + 4).

2. You can turn each equation into an `xyLine` and check its slope and y-intercept. This is a great way of checking that a student entered some correct equation, but it doesn’t differentiate between point-slope and slope-intercept formats for writing equations. This would look like  
`line12 = xyLine(this.cellContent(1,2))`  
`correct: (line12.slope = 0.5) and (line12.yIntercept = -4.5)`

3. You could build off #2 and add an additional check on just the left-hand side of the equation to differentiate between point-slope and slope-intercept equations. This gets tedious when you have lots of equations to check on the same screen, but it would look like  
`line12 = xyLine(this.cellContent(1,2))`  
`lhs12 = simpleFunction(parseEquation(this.cellContent(1,2)).lhs, "y")`  
`correct: (line12.slope = 0.5) and (line12.yIntercept = -4.5) and (lhs12.evaluateAt(0) = 4)`

So, the functionality to do what you want is definitely there 🙂 Other folks, please chime in if you have alternative, more elegant solutions. Good luck!

---

<div class="post-metadata">

**Author:** ![Hannah\_Keith](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/hannah_keith/32/2709_2.png) [@Hannah\_Keith](https://cl.desmos.com/u/Hannah_Keith)\
**Post date:** [October 28, 2022, 2:51pm UTC](https://cl.desmos.com/t/checking-cell-content-that-includes-more-than-one-variable/4524/3 "2022-10-28T14:51:31Z")

</div>

Thank you so much! This was very helpful! In case anyone else wants to see the finalized code, here is the check that I wrote for each line:

#Row 1:  
line1a=xyLine(Table10.cellContent(1,2))  
line1b=xyLine(Table10.cellContent(1,3))  
cellContent(1,4): when line1a.slope=0.5 and line1b.slope=0.5 and line1a.yIntercept=-4.5 and line1b.yIntercept=-4.5 “✔” otherwise “❌”
