Simplefunction and tables

I want to have students type expressions into a table and be able to plot these on a graph.

I had previously found a way to do this using rawexpression, but in looking for some information saw answers indicating that rawexpression is deprecated and simplefunction should be used instead.

How do I use simplefunction to take an expression from a table and plot it on the graph?

Three good ways to do this:

  1. If you’re graphing an explicit function and want it to be traceable use simpleFunction
  2. If you’re graphing any straight line, explicit or implicit use xyLine
  3. If you’re graphing any function (implicit or explicit) but don’t necessarily need it to be traceable use parseEquation.

I’ve included an example of each. Make sure you check the graph to see what needs to be typed into the expression list. graph from table • Activity Builder by Desmos

1 Like

Thanks. Is it possible to concatenate doing this?

For example, I previously had this:

rawExpression(“f”): “f\left(x\right)=x^2${table1.cellContent(1,2)}”

The students could enter a domain in the table which would be concatenated with the x^2 so that the graph would graph the function over their specified domain.

For example, the student enters “{3<x<5}” and the graph would plot x^2 over that domain.

Not with inequalities, unfortunately. You’d have to list the lower and upper bounds in a table separately and use the calc for that one.

I have been working with rawExpression anyways because I don’t want students typing bounds in separately as if they’re just filling in a table but want them to be getting used to listing the bounds the way that they would in a piecewise function. Thus I have:

rawExpression("f"): "f\\left(x\\right)=${table1.cellContent(1,1)}{${table1.cellContent(1,2)}"
rawExpressionColor("f"): "orange"

This draws an expression like x^2 from the left column of the table and concatenates it with the domain given in the right hand column so that the calculator is fed something like, “x^2{2 < x < 5}”

Right now they would be entering the right hand column exactly as it would appear in the calculator: “{2 < x < 5}”. This works perfectly.

However, I would really rather they just be able to type “2 < x < 5” in (so that they don’t get in the habit of nesting a bunch of { } in piecewise function definitions) and to fill in the { }{ in the script itself. I have tried putting \left{ and \right} as a part of the string:

rawExpression("f"): "f\\left(x\\right)=${table1.cellContent(1,1)}\left\{{${table1.cellContent(1,2)}\right\}"

When I do this, it breaks. The expression is no longer graphed and nothing entered in the right hand column matters.

Two things:

  1. You need double backslashes \\left\\ and \\right\\
  2. You have an extra squiggly brace.

I used this and it worked:
rawExpression("f"): "f\\left(x\\right)=${table1.cellContent(1,1)}\\left\\{${table1.cellContent(1,2)}\\right\\}"

Not that I recommend rawExpression but if you gotta use it you gotta use it… Just be careful.

Thanks! I was copying the latex from the calculator so I thought that would work.

As for using rawExpression, I’m perfectly happy to use a better method if anyone an suggest one. I am trying to put something together for practicing with piecewise functions, and I don’t want to have kids just plugging individual bounds in fields. If I say to them, “graph |x| but only do it when x is more than 5,” they get it. Their problem is looking at the big picture where you have a several different expressions each with it’s own set of bounds with compound inequalities and all, that’s the problem, so I want them to be able to, as far as possible, enter stuff that looks like it’s supposed to (although I do want the expressions to be separate from the bounds).

If there is a better way to do that, I am happy to learn.

No better method. Yet. Keep checking in for updates!