# Type an expression into a table

**URL:** <https://cl.desmos.com/t/type-an-expression-into-a-table/777>\
**Category:** Examples\
**Created:** [March 31, 2020, 5:18pm UTC](https://cl.desmos.com/t/type-an-expression-into-a-table/777 "2020-03-31T17:18:41Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Roger\_Gemberling](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/roger_gemberling/32/558_2.png) [@Roger\_Gemberling](https://cl.desmos.com/u/Roger_Gemberling)\
**Post date:** [March 31, 2020, 5:18pm UTC](https://cl.desmos.com/t/type-an-expression-into-a-table/777/1 "2020-03-31T17:18:41Z")

</div>

Good day.

I’m creating table in which students can check their answers. Some of the answers are numbers and some are expressions. How to write the line for variable expression input?

Here are some of the lines for the number check. But I desire a line that would check 2r, as an example:

submitButtonText:“Check my work.”

isCorrect1=table3.cellNumericValue(1,2)=14 and table3.cellNumericValue(1,3)\>43.8 and table3.cellNumericValue(1,3)\<44  
isCorrect2=table3.cellNumericValue(2,1)=13.4 and table3.cellNumericValue(2,3)\>84 and table3.cellNumericValue(2,3)\<84.2  
isCorrect3=table3.cellNumericValue(3,1)=13 and table3.cellNumericValue(3,2)=26

---

<div class="post-metadata">

**Author:** ![Daniel\_Grubbs](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/daniel_grubbs/32/719_2.png) [@Daniel\_Grubbs](https://cl.desmos.com/u/Daniel_Grubbs)\
**Post date:** [March 31, 2020, 10:02pm UTC](https://cl.desmos.com/t/type-an-expression-into-a-table/777/2 "2020-03-31T22:02:21Z")

</div>

something like:

isCorrect4=simpleFunction(table3.cellContent(4,2).latex,“r”).evaluateAt(1)=2 and simpleFunction(table3.cellContent.latex(4,2),“r”).evaluateAt(2)=4

in simpleFunction, first parameter is whatever expression you want. Following that are any variables in the expression in quotes. evaluateAt() does what it sounds like. You need as many parameters as there are variable parameters in the simpleFunction.  
Then, if it was supposed to be “2r”, I’m saying if you evaluate at r=1, then it should be 2 and if you evaluate at r=2, it should be 4.  
You can clean up the above code by setting a variable for the function.

exp4=simpleFunction(table3.cellContent(4,2).latex, “r”)

isCorrect4=exp4.evaluateAt(1)=2 and exp4.evaluateAt(2)=4

If you have a graph component, there are other methods to calculate in the graph.

---

<div class="post-metadata">

**Author:** ![Jme](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/jme/32/516_2.png) [@Jme](https://cl.desmos.com/u/Jme)\
**Post date:** [February 26, 2021, 4:43pm UTC](https://cl.desmos.com/t/type-an-expression-into-a-table/777/3 "2021-02-26T16:43:46Z")

</div>

So… I tried the suggestion at the end of this post and the **.latex i** sn’t working in the table. How can I check a table for the correct expression with one variable?  
Here’s a picture of the table:

 ![table of expressions](https://canada1.discourse-cdn.com/flex031/uploads/desmos/original/2X/8/868e71452759d5fea20482543e1e2a247637f9d4.png)

I’ve got some code in it currently that checks the content in quotes , but I want that’s too limiting. Suggestions?

> **[✅Table of Equations with Variables • Activity Builder by Desmos](https://teacher.desmos.com/activitybuilder/custom/60391f0802c80131b48c5d18)**
>
> by Jme Munn

---

<div class="post-metadata">

**Author:** ![Daniel\_Grubbs](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/daniel_grubbs/32/719_2.png) [@Daniel\_Grubbs](https://cl.desmos.com/u/Daniel_Grubbs)\
**Post date:** [February 26, 2021, 5:13pm UTC](https://cl.desmos.com/t/type-an-expression-into-a-table/777/4 "2021-02-26T17:13:17Z")

</div>

I’ve learned a bit since then. Take out the `.latex` and I think it should work as is. If not, try it inside “${ }”.

---

<div class="post-metadata">

**Author:** ![Jme](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/jme/32/516_2.png) [@Jme](https://cl.desmos.com/u/Jme)\
**Post date:** [March 1, 2021, 3:50pm UTC](https://cl.desmos.com/t/type-an-expression-into-a-table/777/5 "2021-03-01T15:50:10Z")

</div>

> [@Daniel\_Grubbs](#):
>
> and exp4.evaluateAt(2)=4

I tried it without the .latex and it didn’t show an error on the CL, but it also didn’t show correct in the table. Where should the ${…} go? Other suggestion?

```auto
exp1=simpleFunction(this.cellContent(2,2),"3x+9")
isCorrect1=exp1.evaluateAt(1)=12 and exp1.evaluateAt(2)=15
cellSuffix(2,2): when isCorrect1 "✅" otherwise ""
```

---

<div class="post-metadata">

**Author:** ![Daniel\_Grubbs](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/daniel_grubbs/32/719_2.png) [@Daniel\_Grubbs](https://cl.desmos.com/u/Daniel_Grubbs)\
**Post date:** [March 1, 2021, 5:57pm UTC](https://cl.desmos.com/t/type-an-expression-into-a-table/777/6 "2021-03-01T17:57:34Z")

</div>

Take out “3x+9” in the simpleFunction.

---

<div class="post-metadata">

**Author:** ![Jme](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/jme/32/516_2.png) [@Jme](https://cl.desmos.com/u/Jme)\
**Post date:** [March 1, 2021, 10:11pm UTC](https://cl.desmos.com/t/type-an-expression-into-a-table/777/7 "2021-03-01T22:11:19Z")

</div>

Sweet! That totally worked! TY!

---

<div class="post-metadata">

**Author:** ![Daniel\_Grubbs](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/daniel_grubbs/32/719_2.png) [@Daniel\_Grubbs](https://cl.desmos.com/u/Daniel_Grubbs)\
**Post date:** [March 2, 2021, 2:55am UTC](https://cl.desmos.com/t/type-an-expression-into-a-table/777/8 "2021-03-02T02:55:26Z")

</div>

The second part of `simpleFunction` is for what variables your function is in terms of:

```auto
recArea=simpleFunction("l*w","l","w")
circArea=simpleFunction("\pi*r^2","r")

```

If there is no second parameter, it defaults to in terms of x.
