Set coordinate value by button click

I am new to desmos CL, make my first steps.
I have in a graph component a movable point with one coordinate with parameter a.
With a button “loesung01” I want to set that parameter a to a specific value like 50, I tried in graph CL

number(“a”): when loesung01.pressCount>0 50

but I need a “otherwise” command. This otherwise fixes the point making it not moveable anymore.
How can I solve that?

You always need an otherwise. Here’s a way to do what you want.
In the CL:
number(n): when loesung01.pressCount>0 1 otherwise 0

In graph I’m using sliders, x1 and y1, and a piecewise to allow x1 to be fixed or moved. In this example, y1 can always be moved. (You could use a capture with the button if you wanted to lock it on the last value.)


leads to that if n=1 A jumps as I like to x-coordinate 50, but the value of x_1 stays the old one. At the label I use ${x_1} and therefore x_1 also must change to 50.
Any ideas?

Set your label to ${A.x} then it will show the x coordinate of point A.

I appreciate your answers. Thanks, helps me a lot.
In a label ${A.x} does not work. But I defined a new variable e.g. k_1=A.x and then you can use in the label ${k_1}.

1 Like