# 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!