Point Coordinate Components Can Not Be Written To

Point data cannot be changed, only read from. This probably isn’t a bug as much as it’s a feature request, but then again, why would points be readonly? (This is a genuine question.)
When I attempt to set a new x or y coordinate for a point, nothing happens – not even an error.
Here’s a link to a graph I made that shows my issue better than I can tell it.

Hi there!

The “dot access” notation is indeed read-only. For values to be well-defined, they need to have a unique definition; if you say p=(1,2) then the x-coordinate of p has already been defined as 1, so p.x simply uses that value. Similarly, if you say p=(x1, y1), then p.x will have the same value of x1 — so if you want to change the value of that x-coordinate, you will need to change the value of x1, wherever it was defined!

The reason you don’t see an error there is the same as why you don’t see an error writing 1=0. In essence, p.x=0 is asserting that the value of p.x is equal to zero, which is either true or false. (As an asside, if p is defined with coordinates that contain variables, writing p.x=0 could actually show you a graph representing the variable values where that statement hold — check out this example!)

Notwithstanding the fact that you can only define something in one place for it to be well-defined, there is a new feature called actions which can give you way to update that value in multiple places. Here’s a quick example.

Hope that helps!

Happy graphing
Andrew + Team Desmos

1 Like

Wow, the functionality of making a whole graph where well defined values are evaluate to something else is super cool! I really like the actions feature and was able to use it to not only find the answer to my recursive problem, but even visualize the function that got me there.
Thanks Andrew and the Desmos team!