CL for checking expressions in a table

I am creating an activity. I want the students to enter an input value into a table. I want the output to appear in the same table using a linear function for example y = 2x - 4.

I know how to code so that the graph shows up on the same screen, but I cannot get the outputs to appear. I don’t know the CL for that.

On the next slide I want the same graph and table to appear, but have the students enter an equation for the line.

Any help would be greatly appreciated.

If I understand, you want students to enter values in column 1, and column 2 to automatically generate output.

You’ll want to create the desired function. Then, for each output cell evaluate based on column 1.
In your table CL:

f=simpleFunction(`2x-4`)
cellContent(1,2): f.evaluateAt(this.cellNumericValue(1,1)) and not(isBlank(this.cellContent(1,1)))
cellContent(2,2): f.evaluateAt(this.cellNumericValue(2,1)) and not(isBlank(this.cellContent(1,1)))
...etc.

The not(isBlank( )) will keep the table from showing NaN if there is no entry in column 1.

Graphing is simple. If your first table is named say table1
In graph CL:

numberList(`X`): table1.columnNumericValues(1)
numberList(`Y`): table1.columnNumericValues(2)

And in your actual graph: (X,Y)

To recycle the table, you need to define every cell separately:

cellContent(1,1): table1.cellContent(1,1)
cellContent(1,2): table1.cellContent(1,2)
cellContent(2,1): table1.cellContent(2,1)
...etc

Thank you.

I have tried this but I am still getting the triangle. If you are willing to look at my activity, here is the link. If not, I understand and I will keep trying…

Teresa

There’s nothing there. You need to Publish your activity first.

I have published this activity now.

Thank you for taking the time to look at this. Once I figure out my mistake for these slides, I believe I can make adjustments for future slides.

Teresa

Oops. I see what I did. Sorry, try this.

cellContent(1,2): when not(isBlank(this.cellContent(1,1))) `${f.evaluateAt(this.cellNumericValue(1,1))}` 
                  otherwise ``