Keeping track of a current min/max

Students are trying to minimize the sum of the squares for a line of best fit activity.

I’d like for them to be able to “see” their lowest so far. Is there a way to keep track? It seems like variable assignments within the graph can’t be circular (I was trying to do something like m_n = min(m_n, S_r) where m_n is the current minimum and S_r is the sum of the squares of the residuals. Then I was thinking maybe it should go in the script, but the script is only for populating values between components, right?

What ideas do y’all have? Also, I just started using this two days ago so please forgive my ignorance :slight_smile:. Thank you!

You can use an action button. The capture sink can capture any numeric value when the button is pressed, and it stores a history of those values.

In the button CL, this tells the button what value you to capture. You can name it like any variable in CL.
capture(“Sum”): graph.number(“S_r”)

In the graph CL:
numberList(“L”): button.history(“Sum”)

In the actual graph: