Contact Us!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

| Download
Views: 148
Image: ubuntu2204
Kernel: SageMath 10.1

Polar Coordinates

  • useful for calculating multiple integrals in the future

  • useful in describing the paths of planets and satellites

Polar Coordinates

We fix an origin OO (the pole) and an initial ray from OO. (Usually, the positive xx-axis is set as the initial ray.) Then each point PP corresponds to a polar coordinate pair (r,θ)(r,\theta), in which rr is the directed distance from OO to PP, and θ\theta is the directed angle from the initial ray to ray OPOP. We label the point PP as P(r,θ)P(r,\theta)

  • θ\theta is positive when measured counterclockwise and negative when measured clockwise.

  • The angle θ\theta is not unique.

  • The distance can be negative.

reset() var('theta') r = 2*(1+cos(theta)) p1 = polar_plot(r, (theta,0,2*pi), color="grey", title=r"$%s$"%latex(r), thickness=3) r = 4*cos(2*theta) p2 = polar_plot(r, (theta,0,2*pi), color="brown", title=r"$%s$"%latex(r), thickness=3, fill = true) r = 4*(1-sin(theta)) p3 = polar_plot(r, (theta,0,2*pi), color="blue", title=r"$%s$"%latex(r), thickness=3) r = 4*sin(5*theta) p4 = polar_plot(r, (theta,0,2*pi), color="red", title=r"$%s$"%latex(r), thickness=3) graphics_array([p1,p2,p3,p4],2,2)
Image in a Jupyter notebook
reset() var('theta') r = 1 p1 = polar_plot(r, (theta,0,2*pi), color="grey", title=r"$%s$"%latex(r), thickness=3) r = -1 p2 = polar_plot(r, (theta,0,2*pi), color="brown", title=r"$%s$"%latex(r), thickness=3) graphics_array([p1,p2],1,2)
Image in a Jupyter notebook

Relation between Polar and Cartesian Coordinates

  • Polar to Cartesian x=rcosθ, y=rsinθx=r\cos\theta,~y=r\sin \theta

  • Cartesian to Polar r=x2+y2, θ=arctan(y/x)r=\sqrt{x^2+y^2},~\theta=\arctan(y/x)

E.<x,y> = EuclideanSpace(2) cartesian = E.cartesian_coordinates() polar.<r,t> = E.polar_coordinates() x, y = E.coord_change(polar, cartesian)(r,t) print('The polar coordinate to cartesian coordianate is: x=', x, ', y=', y)
The polar coordinate to cartesian coordianate is: x= r*cos(t) , y= r*sin(t)
E.<x,y> = EuclideanSpace(2) cartesian = E.cartesian_coordinates() polar.<r,t> = E.polar_coordinates() r, t = E.coord_change(cartesian, polar)(x,y) print('\nThe cartesian coordinate to polar coordianate is: r=', r, ', t=', t)
The cartesian coordinate to polar coordianate is: r= sqrt(x^2 + y^2) , t= arctan2(y, x)

The Polar equation

r=1cosθr = 1-\cos\theta

The Cartesian equivalent

x4+y4+2x2y2+2x3+2xy2y2=0x^4+y^4+2x^2y^2+2x^3+2xy^2-y^2=0
var('t, x, y') f = 1-cos(t) p1 = polar_plot(f, (t,0,2*pi), color="grey", title=r"$%s$"%latex(f), thickness=3) p2 = implicit_plot(x^4 + y^4 +2*x^2*y^2+2*x^3+2*x*y^2-y^2 ==0, (x,-2,1), (y,-2,2)) L = [p1,p2] graphics_array(L,1,2)
Image in a Jupyter notebook

It isn't easy to implicitly plot the equation in the polar coordinates; we can work around it to add more plots.

r2=4cosθr^2=4\cos\thetar2=sin(2θ)r^2 = \sin(2\theta)
var('t') f = 2*sqrt(cos(t)) p2 = polar_plot(f, (t,0,2*pi), color="grey", legend_label=r"$%s$"%latex(f), thickness=3) f = -2*sqrt(cos(t)) p2 += polar_plot(f, (t,0,2*pi), color="brown", legend_label=r"$%s$"%latex(f), thickness=3) f = sqrt(sin(2*t)) p3 = polar_plot(f, (t,0,2*pi), color="grey", legend_label=r"$%s$"%latex(f), thickness=3) f = -sqrt(sin(2*t)) p3 += polar_plot(f, (t,0,2*pi), color="brown", legend_label=r"$%s$"%latex(f), thickness=3) L = [p2,p3] graphics_array(L,1,2)
verbose 0 (3935: plot.py, generate_plot_points) WARNING: When plotting, failed to evaluate function at 100 points. verbose 0 (3935: plot.py, generate_plot_points) Last error message: 'Unable to compute f(4.7003488323708815)' verbose 0 (3935: plot.py, generate_plot_points) WARNING: When plotting, failed to evaluate function at 100 points. verbose 0 (3935: plot.py, generate_plot_points) Last error message: 'Unable to compute f(4.697302114090265)' verbose 0 (3935: plot.py, generate_plot_points) WARNING: When plotting, failed to evaluate function at 100 points. verbose 0 (3935: plot.py, generate_plot_points) Last error message: 'Unable to compute f(6.283185307179586)' verbose 0 (3935: plot.py, generate_plot_points) WARNING: When plotting, failed to evaluate function at 100 points. verbose 0 (3935: plot.py, generate_plot_points) Last error message: 'Unable to compute f(6.283185307179586)'
Image in a Jupyter notebook

Slope of a polar curve

If the curve r=f(θ)r=f(\theta) passes through (f(θ0),θ0)(f(\theta_0),\theta_0) in the Polar coordinate, then the slope at (f(θ0),θ0)(f(\theta_0),\theta_0) is

dydx=df(θ)sinθdθdf(θ)cosθdθ=f(θ)sinθ+f(θ)cosθf(θ)cosθf(θ)sinθ{dy\over dx}={{df(\theta)\sin\theta\over d\theta}\over{df(\theta)\cos\theta\over d\theta}}={f'(\theta)\sin\theta+f(\theta)\cos\theta\over f'(\theta)\cos\theta-f(\theta)\sin\theta}

If the curve r=f(θ)r=f(\theta) passes through the origin at θ=θ0\theta=\theta_0, then f(θ0)=0f(\theta_0)=0, and the slope at (0,θ0)(0,\theta_0) is

dydx=df(θ)sinθdθdf(θ)cosθdθ=f(θ)sinθ+f(θ)cosθf(θ)cosθf(θ)sinθ=tanθ0{dy\over dx}={{df(\theta)\sin\theta\over d\theta}\over{df(\theta)\cos\theta\over d\theta}}={f'(\theta)\sin\theta+f(\theta)\cos\theta\over f'(\theta)\cos\theta-f(\theta)\sin\theta}=\tan\theta_0
var('t') f(t) = 2*(1+cos(t)) p = polar_plot(f, (t,0,2*pi), color="grey", title=r"$%s$"%latex(f(t)), thickness=3) for theta in sxrange(pi/3,2*pi,1.5): p += plot(f(theta)*sin(theta)+ (diff(f)(theta)*sin(theta)+f(theta)*cos(theta))/(diff(f)(theta)*cos(theta)-f(theta)*sin(theta))*(x-f(theta)*cos(theta)), (x,-1,4), ymin=-1, ymax=4) p.show()
Image in a Jupyter notebook

Area of the Fan-Shaped Region Between the Origin and the Curve

Let the curve be r=f(θ),αθβr =f(\theta), \alpha\leq\theta\leq \beta.

The area of the fan with angle from θ\theta to θ+dθ\theta+d\theta and the radius f(θ+0.5dθ)f(\theta+0.5d\theta) is 12r(θ+0.5dθ)2dθ12r2(θ)dθ.\begin{align*}{1\over 2} r(\theta+0.5d\theta)^2d\theta \approx {1\over 2} r^2(\theta)d\theta \end{align*}.

Therefore, the area of the fan-shaped region is A=αβ12r2dθ.A=\int_\alpha^\beta {1\over 2}r^2 d\theta.

var('t') alpha = 0 beta = 6 f(t) = 2*(1 + cos(t)) p = polar_plot(f, (t,alpha,beta), color="grey", title=r"$%s$"%latex(f), thickness=3) n_end = 100 estimate = 0 dt = (beta-alpha)/n_end for n in [1..n_end]: t1 = alpha+(n-1)*(beta-alpha)/n_end p += polar_plot(f(t1+0.5*dt), (t,t1,t1+dt), color="red", title=r"$%s$"%latex(f), thickness=3, fill=0, fillcolor='red') estimate += N(0.5*dt*f(t1+0.5*dt)^2) p.show() print('The estimation of the area is ', estimate) true_area = integral(0.5*f^2, t, alpha, beta) print('The true area is', true_area, 'which is approximately', N(true_area))
Image in a Jupyter notebook
The estimation of the area is 16.6137228417910 The true area is 0.5*sin(12) + 4.0*sin(6) + 18.0 which is approximately 16.6140515482041

Find the area of the region that lies inside the circle r=1r = 1 and outside the cardioid r=1cosθr = 1 - \cos \theta.

var('t') f1 = 1 p = polar_plot(1, (t,0,2*pi), color="blue", legend_label=r"$%s$"%latex(f), thickness=3, fill = 0, fillcolor='blue') f2(t) = 1- cos(t) p += polar_plot(f2, (t,0,2*pi), color="orange", legend_label=r"$%s$"%latex(f2(t)), thickness=3, fill =0, fillcolor='white') p.show() true_area = integral(0.5*f1^2-0.5*f2^2, t, -pi/2, pi/2) print('The true area is', true_area, 'which is approximately', N(true_area))
Image in a Jupyter notebook
The true area is -0.25*pi + 2.0 which is approximately 1.21460183660255

Length of a Polar Curve

Let the curve be r=f(θ)r=f(\theta).

When dtdt is small, the length of the line segment from θ\theta to θ+dθ\theta+d\theta is (r(θ+dθ)cos(θ+dθ)r(θ)cos(θ))2+(r(θ+dθ)sin(θ+dθ)r(θ)sin(θ))2(r(θ)cos(θ)r(θ)sin(θ))2+(r(θ)sin(θ)+r(θ)cos(θ))2dθ=(r(θ))2+(r(θ))2dθ.\begin{align*}&\sqrt{(r(\theta+d\theta)\cos(\theta+d\theta)-r(\theta)\cos(\theta))^2 +(r(\theta+d\theta)\sin(\theta+d\theta)-r(\theta)\sin(\theta))^2}\\\approx & \sqrt{(r'(\theta)\cos(\theta)-r(\theta)\sin(\theta))^2 +(r'(\theta)\sin(\theta)+r(\theta)\cos(\theta))^2}d\theta\\= &\sqrt{(r(\theta))^2 +(r'(\theta))^2}d\theta\end{align*}.

Then the length of the curve from θ=α\theta=\alpha to θ=β\theta=\beta is L=αβr2+(drdθ)2dθ.L=\int_\alpha^\beta \sqrt{r^2+\left({dr\over d\theta}\right)^2} d\theta.

var('t') alpha = 0 beta = pi f(t) = 1-cos(t) p = polar_plot(f, (t,alpha,beta), color="grey", title=r"$%s$"%latex(f(t)), thickness=3) n_end = 10 estimate = 0 dt = (beta-alpha)/n_end for n in [1..n_end]: t1 = alpha+(n-1)*(beta-alpha)/n_end p += line([(f(t1)*cos(t1),f(t1)*sin(t1)),(f(t1+dt)*cos(t1+dt),f(t1+dt)*sin(t1+dt))]) estimate += N(sqrt((f(t1)*cos(t1)-f(t1+dt)*cos(t1+dt))^2+(f(t1)*sin(t1)-f(t1+dt)*sin(t1+dt))^2)) p.show() print('The estimation of the area is ', estimate) true_length = integral(abs(sqrt(f(t)^2+diff(f,t)^2)), t, alpha, beta) print('The true length is', true_length, 'which is approximately', N(true_length))
Image in a Jupyter notebook
The estimation of the area is 3.96338800119626 The true length is 4 which is approximately 4.00000000000000