Polar coordinates

Hi @Salman_Sheikh Welcome to the forum! :slight_smile:

I believe you're trying to convert polar coordinates to Cartersian coordinates, or vice-versa. Either way, I asked our new AI Writer to write the snippet for me, and got the following snippets.

I checked them and it looks to be correct. Please let me know if it works for you.

Text Blaze Snippet
Copy to Text Blaze

To convert Cartesian coordinates to polar coordinates, please enter the values below:


Enter x-coordinate: 

namex

r =
sqrt(x^2+y^2)


Enter y-coordinate: 

namey

theta =
atan(y/x)



The polar coordinates (r, theta) are: (

=
r
, 
=
theta

)


The Jacobian (J) is: 

=
r


Snippet preview

To convert Cartesian coordinates to polar coordinates, please enter the values below:

Enter x-coordinate:

Enter y-coordinate:

The polar coordinates (r, theta) are: (0, NaN)

The Jacobian (J) is: 0

Text Blaze Snippet
Copy to Text Blaze

Polar Coordinate Input:


Radius (r): 

nameradius

r =
radius


Angle in degrees (θ): 

nameangle

theta =
angle





theta_rad =
theta*acos(-1)/180
 {# Convert angle to radians #}


Cartesian Coordinates:


X = r*cos(θ) = 

x =
round(r*cos(theta_rad))

=
x


Y = r*sin(θ) = 

y =
round(r*sin(theta_rad))

=
y


Snippet preview

Polar Coordinate Input:

Radius (r):

Angle in degrees (θ):

{# Convert angle to radians #}

Cartesian Coordinates:

X = r*cos(θ) = 0

Y = r*sin(θ) = 0