Polar Coordinates


Polar coordinates are a coordinate system similar to our standard Cartesian coordinates, however instead we have the radius from the origin $r$ and an angle $\theta$ in radians. We define $\theta$ to be zero when the points are on the x-axis and to the right of the origin, and positive angles are in the counter-clockwise direction. To translate our standard Cartesian coordinates into polar coordinates we can use the functions

\begin{align} r = \sqrt{ x^2 + y^2 } \\ \theta = \tan^{-1} \left(\frac{ y }{ x }\right). \end{align}

The following Sage interact converts Cartesian coordinates into polar coordinates. The default values are $(x,y) = (1,1)$.


def _(x = input_box(default=1), y=input_box(default=1)):
    r = sqrt( x^2 + y^2 )
    t = arctan(y/x)
    pretty_print(html(r"$x = %s$" %x))
    pretty_print(html(r"$y = %s$" %y))
    pretty_print(html(r"$r = %s$" %r))
    pretty_print(html(r"$t = %s$" %t))

Sage Cell


We can also convert polar coordinates back into Cartesian coordinates using the formulas

\begin{align} x = r \cos \theta \\ y = r \sin \theta. \end{align}

The Sage interact below converts polar coordinates into Cartesian coordinates. The default values are $(r,\theta) = (2, \frac{ \pi}{2})$.


def _(r = input_box(default=2), t=input_box(default= pi/2 )):
    x = r*cos(t)
    y = r*sin(t)
    pretty_print(html(r"$r = %s$" %r))
    pretty_print(html(r"$t = %s$" %t))
    pretty_print(html(r"$x = %s$" %x))
    pretty_print(html(r"$y = %s$" %y))


Primary Tags:

Secondary Tags:


Any related cells go here. Provide a link to the page containing the information about the cell.

Related Cells




Date: 30 Oct 2018 17:31

Submitted by: James A Phillips

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License