# Function in a table?

**URL:** <https://cl.desmos.com/t/function-in-a-table/3176>\
**Category:** Questions\
**Created:** [April 26, 2021, 5:20pm UTC](https://cl.desmos.com/t/function-in-a-table/3176 "2021-04-26T17:20:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mikki\_Stuart](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/mikki_stuart/32/2596_2.png) [@Mikki\_Stuart](https://cl.desmos.com/u/Mikki_Stuart)\
**Post date:** [April 26, 2021, 5:20pm UTC](https://cl.desmos.com/t/function-in-a-table/3176/1 "2021-04-26T17:20:43Z")

</div>

I am brand new to this, but I am having students fill in a table with the rise and run from a graph. I want the third column of my table to show the ratio after students have typed in the values for the first two columns. Is there a way to have desmos automatically do this?

---

<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:** [April 26, 2021, 5:39pm UTC](https://cl.desmos.com/t/function-in-a-table/3176/2 "2021-04-26T17:39:51Z")

</div>

So if first column is rise and second is run, you want the third to give the slope?

```auto
cellContent(1,3): `\frac{${this.cellContent(1,1)}}{${this.cellContent(1,2)}}`

```

If you want it reduced, you’ll need additional calculation. (Is it just one row? Or multiple?)

---

<div class="post-metadata">

**Author:** ![Aethir](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/aethir/32/2767_2.png) [@Aethir](https://cl.desmos.com/u/Aethir)\
**Post date:** [April 26, 2021, 5:41pm UTC](https://cl.desmos.com/t/function-in-a-table/3176/3 "2021-04-26T17:41:13Z")

</div>

Ha! Daniel beat me. If you want to see this in action:

> **[Auto-fill table cell • Activity Builder by Desmos](https://teacher.desmos.com/activitybuilder/custom/6086fa7803e3940cf187c71d)**
>
> by Zachary Armstrong

---

<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:** [April 26, 2021, 6:02pm UTC](https://cl.desmos.com/t/function-in-a-table/3176/4 "2021-04-26T18:02:37Z")

</div>

Here’s reduced slope with sign before the fraction if negative.

```auto
rise=this.cellNumericValue(1,1)
run=this.cellNumericValue(1,2)
gcf=numericValue(`\gcf(${rise},${run})`)
#reduced numerator and denominator
redNum= numericValue(`\abs(${rise}/${gcf})`)
redDen= numericValue(`\abs(${run}/${gcf})`)
sign=when numericValue(`${rise}*${run}`)<0 `-` otherwise ``
slope= when redDen=1 `${sign}${redNum}` 
       otherwise `${sign}\frac{${redNum}}{${redDen}}`

cellContent(1,3): slope

```
