Tracking Selected Objects

Hi.

Trying to wrap my head around how to make create more involved activities (ex: where students click on objects).

Got something working reasonably well now that desmos supports the (assignment?) operator :
SelectingObjects

Interesting programming model

Many features of Desmos feels very LISP-y to me. Very interesting.

Problem

I find it very difficult to work with evolving state in Desmos. Although my example works well, it is quite involved to figure out how to do this.

I get the impression teachers would create better content if the barrier for saving/manipulating state was lowered somehow.

Though I agree that concepts from LISP seem to model problems encountered in math very well, I think most people (including myself) have difficulty thinking in this LISP-like state-less fashion.

edit1: More accurately: it is difficult to modify state programmatically (There is, of course, state in the graphs variables).

edit2: Desmos programs seem to be declarative in nature (so maybe Prolog is a better comparison than LISP?).

More examples?

Maybe someone could build up a well catalogued database of examples on how to build up more complex activities?

→ So I suppose this is my first example — hoping it will make it easier for teachers to create more interesting activities.

Just noticed someone else posted an interesting set of examples:

Hi, welcome to the forum!

A database of complex examples is very interesting to me – the difficulty there is finding the right way to organize things so that there is a reasonable entry point for everyone. Complex examples can get quite complex! But it’s something I like to think about not infrequently.

As for manipulating graph state, actions (->) are the only non-hacky way to make this sort of change. I have found lists and list operations to be key for most of my complex builds.

I like your example! Here’s my recreation, with a slightly different click update implemented in line 4: Untitled Graph

Thanks for the example.

Conditionals for updating state

I’ve never thought you could use conditionals this way to toggle elements of “HasBeenClicked”.

Kind of nice that you don’t need extra lines to generate a “bit mask” like I’ve had to do.

Always looking for good ways to balance number of lines with the overall complexity of the code in order to keep things manageable & readable (even if I’m the only one looking at my code).

More boolean manipulations

I’ve also never seen selection being possible by (multiplying?) a set of points by a vector of booleans (line 4):
(xi,yi)[1=HasBeenClicked]

Actually, I can clearly see it is not a multiplication, because if I do:
(xi,yi)([1=HasBeenClicked]*2)
The calculation fails

Toggle vs enable

One thing to note is that your code toggles, whereas mine simply enables (won’t re-enable). But I can surely adapt this solution to my situation. Thanks.

Oh yeah…

I really like the idea of placing all the points in a table like you did. It seems to better group similar things & de-clutter the calculator code.

I just wish there was a way to set common restrictions on the (x,y) coordinates (namely step size) so students can deal with integer values to simplify mental calculations, etc.

Column names

I would highly suggest naming the columns to something like x_i & y_i instead of the default x_1 & y_1, though. x_1 sort of sounds like the x-coordinate of point 1 - and I find that a bit confusing.

Not a multiplication as such (as you discovered) but using the ‘elements of the list that satisfy a condition’ implementation mentioned here: https://help.desmos.com/hc/en-us/articles/4407889068557-Lists

So (x_i,y_i) is a list of points, narrowed to only the elements of that list in the positions where HasBeenClicked equals 1.

1 Like

Excellent! Thanks for pointing me to the doc – and providing me with a search term (I would probably not have found the relevant snippet otherwise).

This is great! I get to use modulo arithmetic with this filtering tool:
L[mod(L,2)=0]