# Graphing equations entered on a previous slide

I’m trying to do a few things. I’ve searched the forum but haven’t quite found examples that show what I need

I would like to know how to do the following:
On 1 slide, I have students complete a table (the x is labeled as Raisins and the y is labeled as Walnuts)
On the next slide, they will write an equation in standard form to represent the scenario.

I would like the 3rd slide to be a graph that graphs their data from the table on slide 1 AND the equation on slide 2. I don’t care if their inputs were correct (actually, I prefer it if they can see their errors if the table values don’t align with the equation) that’s kind of the idea of the activity is for them to recognize the table and equation as creating the same set of data on a graph.

But, I can’t seem to find the right coding for the table script, equation script and graph script to get the table and equation to appear on the graph.

Can anyone help?

Something like this?

I think @James is on the right track, but it won’t graph standard form (also not sure the when-otherwise is necessary). For standard form, change the function in the graph CL to:

``````function("f_1"): parseEquation(input.latex).differenceFunction("x","y")
``````

and change `y=f_1(x)` in the graph to `0=f_1(x,y)`.

You also may want to add some CL to set the bounds of the graph.

Updated with Daniel’s suggestions.

Thanks! I’ll try in the morning when I’m at my computer and then let you know how it goes!!

I’m new to the whole scripting thing. Usually, I can figure some stuff out after trial and error but this one has had me stumped cuz I can’t seem to figure out the language of the scripting

UPDATE: Thanks for this! I copied the code from James’ sample and it didn’t work on the activity I had created BUT, I copied HIS template and added all my instructions/media and it is working just fine So, I’m sure there is a different issue in my original draft of the activity. Thank you for providing a template I could use

If you’re components were named correctly and you copied all the CL, you may have been missing the expressions in the actual graph (not the CL).

Makes sense. I opted to start from the template I knew was working made life a little less stressful not having to figure out what was wrong with mine! LOL

I have one additional question for the same project for anyone who is able to help… I took the 3 slides James created and copied them for students to work through a 2nd, similar problem. Then I created a 7th slide where I would like to have the 2 graphs appear from slides 3 and 6 so the students can see how they overlap (we’re learning about solutions to systems so slides 1 - 3 will guide them to seeing 1 equation, slides 4 - 6 will see them through the 2nd equation and the final slide will take all the data from both equations & tables and put it all on 1 graph).

I tried just copying the CL from the graphs for slides 3 and 6 and pasting them to slide 7 but I’m getting errors.

#plot points from table
numberList(“p”): table1.columnNumericValues(1)
numberList(“q”): table1.columnNumericValues(2)
numberList(“p”): table2.columnNumericValues(1)
numberList(“q”): table2.columnNumericValues(2)

#graph line from input
function(“f_1”): parseEquation(input.latex).differenceFunction(“x”,“y”)
function(“f_1”): parseEquation(input2.latex).differenceFunction(“x”,“y”)

Can you share a link to your activity so we can better see what you are going for?
I modified my template to what I think you wanted

You’ll need different names for lists from table2. You’re currently trying to create two pairs of lists with the same names. Same with the function. Give them different names and they’ll work.

``````#plot points from table
numberList(“p”): table1.columnNumericValues(1)
numberList(“q”): table1.columnNumericValues(2)
numberList(“p_2”): table2.columnNumericValues(1)
numberList(“q_2”): table2.columnNumericValues(2)

#graph line from input
function(“f_1”): parseEquation(input.latex).differenceFunction(“x”,“y”)
function(“f_2”): parseEquation(input2.latex).differenceFunction(“x”,“y”)
``````

You’ll need another `0=f_2(x,y)` to graph the second equation.

OMG! I GOT IT! Thank you guys so much. I hadn’t realized I needed to edit the graph itself not just the CL! After reviewing James’ update and trying to figure out what David meant by needing another 0=f_2(x,y) I was able to see where I was going wrong Thank you both so much for the help!

1 Like