Polar Coordinates

Description

To translate our standard Cartesian coordinates into polar coordinates we can use the functions

(1)
\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)$, provided $x > 0$.

Code

@interact
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$" %latex(x)))
    pretty_print(html(r"$y = %s$" %latex(y)))
    pretty_print(html(r"$r = %s$" %latex(r)))
    pretty_print(html(r"$t = %s$" %latex(t)))

Sage Cell

Option

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

(2)
\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})$.

Code

@interact
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$" %latex(r)))
    pretty_print(html(r"$t = %s$" %latex(t)))
    pretty_print(html(r"$x = %s$" %latex(x)))
    pretty_print(html(r"$y = %s$" %latex(y)))

Options

Primary Tags—Precalculus: Polar coordinates & vectors

Secondary Tags—Polar coordinates & vectors: Polar and rectangular coordinates

Tags

None

Related Cells

Permalink:

Author: J. A. Phillips

Attribute

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