Populating Function Outputs in Table

Using CL in a table for Desmos Classroom, I was wondering if there was a way to populate outputs based on student inputs?

For example is there a way to create a two column table where the students enter their own function in the first row and their own numbers in the first column, and then have the cells in column two self populate the values based on the numbers and the function entered?

Something like this will do the trick, assuming the function is written as y=… or f(x)=… or similar, and placed in the top-left accessible cell.

A1=parseEquation(this.cellContent(1,1)).rhs

studentf=simpleFunction(A1,"x")


cellContent(2,2): "${studentf.evaluateAt(this.cellNumericValue(2,1))}"
cellContent(3,2): "${studentf.evaluateAt(this.cellNumericValue(3,1))}"
cellContent(4,2): "${studentf.evaluateAt(this.cellNumericValue(4,1))}"
cellContent(5,2): "${studentf.evaluateAt(this.cellNumericValue(5,1))}"
cellContent(6,2): "${studentf.evaluateAt(this.cellNumericValue(6,1))}"

For example, Sandbox / Testing • Activity Builder by Desmos

1 Like

You can just use simpleFunction() for y= or f(x)= form. It will accept just an expression, so use parseEquation().rhs if you want to require y= or f(x)= form.

Also simpleFunction defaults in terms of x, so the second parameter is only required if you want to use a different variable, or a multivariable function.

Awesome. That worked.