# Take 2: Transfer slope to graph from table input

Sorry I posted the wrong link from my last question.

I am having difficulty getting the following to happen on slide 7:

I want students to input a numeric value into a table. I want the graph component to pick up that input as a numeric value, and graph a small section of that line around the given point. This way students can see how their slope at particular point matches the slope field.

Ex: For the point (-4,2) the slope is -4, or the point (0,4) has a slope of 0.

Hmm from what Iâ€™m seeing, you should be good:

number(m_1):t1.cellNumericValue(1,3) is going to pass down the first pointâ€™s slope (1st row, 3rd column) into the graph, where line 6 is ready to graph a section of the line with that slope: y=m_1(x+4)+2{-4.02<x<-3.98}.

I might tweak that condition to be {distance((x,y),(-4,2)<0.3} so that the overall length of the line stays the same even with extreme slopes, but it feels like you just need some copy-paste-replace for the other rows of the table!

For a bit more robustness, though, hereâ€™s an alternate to your graph: https://www.desmos.com/calculator/vjoa7yvooi. It uses a polygon for each line segment, which can be a little bit faster for the calculator to draw, and also supports vertical lines for undefined slopes. For the â€śMultiple Pointsâ€ť folder, I replicated the logic of the Slope Field folder to get a d_rawSegmentWithSlope helper, and set it up to know about the m1 through m6 variables youâ€™d be passing down via CL. (Iâ€™m imagining in the case of und from the student, you could pass down \frac{1}{0}.)

2 Likes

Thanks for the help. I really appreciate the alternate graph, and like the way you can adjust the r value for a different radius. By seeing your example I realize the line was actually showing up, but changing the thickness allows you to see the line. I was able to copy the drawsegmentwith slope into the graph and everything worked well.

I like the condition to make the overall length of the slopes stay a set amount, but I couldnâ€™t get that to work on a linear equation the way I normally adjust the domain or range. Is that just something that works with the polygon feature, or is that something I should be able to adjust at the end of a function?

I think you need
distance((x,y),(-4,2))<0.3  (note that the â€śoutsideâ€ť brackets start after distance and finish after the second coordinate).