Occasional Issues in Polar Plotting

## Description

Here we will discuss certain problems that arise when plotting an exponential spiral and a lemniscate.

## Sage Cell

#### Exponential Spiral

Exponential spirals of large domains require a larger amount of plot points to be specified to produce a smooth curve. Compare this cell, which produces a spiral with the default 200 points using the function

(1)
\begin{align} e^{\theta/10}, -12\pi \leq \theta \leq 2\pi \end{align}

The plot looks polygonal due to the large domain of the function. Sage draws curves by creating a piecewise linear function of a default amount of 200 points. 200 points out of a domain of $14\pi$ results in about 4.5 points per radian, not enough to produce a smooth curve. To remedy this, we will manually set plot_points to a larger value: 10,000.

Note how much smoother the curve is, as we now have about 227.3 points per radian

#### Code

theta = var('theta')
polar_plot(exp(theta/10), (theta, -12*pi, 2*pi))

theta = var('theta')
polar_plot(exp(theta/10), (theta, -12*pi, 2*pi), plot_points=10000)


## Options

#### Lemniscates

Due to certain properties of functions which produce this shape and their derivatives plotting will often go awry, regardless of the amount of points set. Compare the graphs of a lemniscate plotted with 200 points and one with 10000 points using this function:

(2)
\begin{align} 3\sqrt{\cos(2\theta)} \end{align}

#### Code

theta = var('theta')
polar_plot(3*sqrt(cos(2*theta)), (theta, -6*pi, 6*pi))

theta = var('theta')
polar_plot(3*sqrt(cos(2*theta)), (theta, -6*pi, 6*pi), plot_points=10000)


## Tags

Primary Tags: Plotting: Two-dimensional plots

Secondary Tags: Two-dimensional plots: Polar plots

## Attribute

Permalink:

Author: Gregory V. Bard. Sage for Undergraduates. American Mathematical Society, Providence, RI, 2015. Available at http://www.gregorybard.com/Sage.html.

Date: 28 Feb 2019 21:10

Submitted by: Zane Corbiere

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