The main parameters for the above simulation are x and y.
and r=\sqrt{x^2+y^2}, \tan\theta=\frac{y}{-x} (cta is the variable for \theta)

You can find the above relations from [b]constraints[/b] page in EJS.
[code]
cta=-Math.atan2(x,y);
r=Math.sqrt(x*x+y*y);
[/code]

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 [b]Drag Action[/b] for the slider

[code]
cta=-Math.atan2(x,y);
x=-Math.sin(cta);
y=Math.cos(cta);
[/code]

However, you need to change
[code]
double r,r2,r3,cst;
[/code]
in Custom page to
[code]
double r2,r3,cst;
[/code]

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