The main parameters for the above simulation are x and y.

and $r=sqrt{x^2+y^2}$, $ an heta=frac{y}{-x}$ (cta is the variable for $ heta$)

You can find the above relations from

**constraints** page in EJS.

cta=-Math.atan2(x,y);

r=Math.sqrt(x*x+y*y);

If you want to add slider or numerical input for r (to change r by slider or numerical input).

you need to add code (at On drag property: i.e what need to be changed when the slider were dragged).

You can add the following code for the

**Drag Action** for the slider

cta=-Math.atan2(x,y);

x=-Math.sin(cta);

y=Math.cos(cta);

However, you need to change

double r,r2,r3,cst;

in Custom page to

double r2,r3,cst;

and add a new variable r in the variable page (so that you can use it in view too).