Perform calculations with numbers in a table

I am creating an activity where students discover their sum of interior angles in a triangle. I would like them to insert the angle measures into a table, then have the 4th column add those measures so they see that everytime it equals 180. Is this possible in the computation layer using cellContent?

Yup, cellContent and cellNumericValue. Make the cells in column 4 be equal to the numeric value of the sums of the other columnNumericValues.

The easiest way to represent this will depend on whether or not you have a graph component to make use of.

Thanks! I ended up cracking the code by using the graph component to do the math for me. So I assigned variables to the numeric values in the cells, then had the graph component perform the calculations assigning the result to a variable which I then recalled in the table using cellContent.

I was hoping there was some sort of “sum()” feature similar to excel that I could’ve used in the table’s CL, but this work around wasn’t too tricky.

Awesome! Totally not a workaround, in fact it’s the recommended and most reliable way to do it! If you want to do it without the graph you can use numericValue() and put whatever computation you want inside.

1 Like

Could you provide me a link to a sample activity of how you solved this?
I can’t quite seem to work out the exact dialogue to make this work correctly.

Without the graph component it could look something like this:

Whoa, Mr. Chow, when did it become possible to do math in the CL??? If “+” is available what other operations are in play?

It’s been possible with numericValue and simpleFunction for a while. Pretty much any operation on numbers will work.

1 Like

Thank You! I’ve been trying to figure how to do simple math without using the graph component.,

This is really helpful thank you. Would it be able to calulate with logs? So if column was a and colummn 2 b could column 3 be log_a(b)?

Thanks,

Sarah

Any calculations that could be done in the calculator should be viable with the table. You may want to make a simpleFunction, and the evaluateAt for column 3:

log=simpleFunction("\log_{a}b","a","b")
cellContent(1,3): log.evaluateAt(this.cellNumericValue(1,1),this.cellNumericValue(1,2))
#repeat changing the row value

Hello! thank you for the activity! When I put this into a table and then did student preview I was not able to type number is columns 1,2,3.

Looks like your missing some of the code. Can you share your activity?