Function in a table?

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?

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

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?)

1 Like

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

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

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
2 Likes