# Function in Graph evaluated in table?

I have f(x) defined in the graph.
I want students to type x-values in table column1. Then I want the table to automatically evaluate the y-values into column2.
And then I plan to graph the points from the table.

How does this look? I only made two adjustments - the number lists were included to show the points and then I got the simple function variable to work.

(sigh, SMH, LOL) When you’ve tried so many variations that you don’t know why your tries weren’t working. (But very thankful!)

Questions: (all similar with different wording/variations)

1. So now the table references a function f that is completely unique from the graph’s function f (defined inside the graph area). Is there a way to define the graphed function AND the function being used in the table to be identical (without double coding)?

2. Can you define a function in the graph CL that is used inside the graph?

3. When you define a function in one area of CL, how do you reference it in another section of CL?
(eg defined in table, reuse in note or graph)

I think the answer is “yes” to all of your questions. I took the function that was defined in the table component and moved it to the graph CL. Then I used the function sink in the graph CL so the function gets graphed. I opened up the graphing calculator and just typed in f(x) instead of f(x)=b^x. Doing all of this allows you to just change your function in the CL. Finally, I called on that function in the table by using graph.script.f.

I noticed the animation on the movable point lags, so I’m sure there is a better way to do this, but here’s my attempt.

Regarding animation: even when f is defined in graph (separately from the simplefunction in table); I notice that the points from the table have a delay.
Thank you for sharing again, as I’m still trying to learn how everything communicates!

I also learned something VERY important: (BUG?)
put () around your b!
If b is negative, my table was giving incorrect values!?!?

f=simpleFunction("\${graph.number(“b”)}^x") is incorrect!
for b=-2, it appears to be calculating y=-2^x instead of y=(-2)^x. But since the negative is with the b?

But when I place () around the b, I got the correct results:

When you interpolate the number as a string into the function it will read as is. So an input of -2 will read the function as -2^x rather than b^x evaluated at -2