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)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)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
Related Cells
- Plotting a Circle
- Plotting a Polygon
- Plotting an Implicit Function
- Two-Dimensional Plots
- Parametric Plots
- Line Plots
- Plotting Two-Dimensional Vector Fields
- Multiple Plots on the Same Graph
- Controlling the Viewing Window of a Plot
- Plotting Functions with Asymptotes
- Multiple Annotation Techniques for Graphing
- Constructing Contour Plots in Sage
- Plotting Inequalities in Sage
- Plotting Systems of Linear Inequalities
- Plotting Nonlinear Inequalities in Sage
- Making log-log Plots in Sage
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