Occasional Issues in Polar Plotting


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

\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


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)



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:

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


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)


Primary Tags: Plotting: Two-dimensional plots

Secondary Tags: Two-dimensional plots: Polar plots

Related Cells



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