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.
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:
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…