Description
We will be plotting a function with vertical asymptotes using multiple plotting functions. Due to the nature of the way Sage generates graphs, not using these options will likely result in a graph with an enormous range and inaccurate function values near the asymptotes. Specifically, we will be setting ymin, ymax, and detect_poles.
Sage Cell
Setting ymin and ymax prevents Sage from plotting on a range in the thousands, while setting detect_poles=True prevents Sage from mistakenly graphing on the asymptote (for this example, had we not set detect_poles=True we would have seen a line on $-2$ and $2$).
Code
plot(1/(x^3 -x ), -2, 2, ymin=-5, ymax=5, detect_poles=True)
Options
Option
Showing the asymptotes with a dashed line. Simply set select_poles='show'. Note the single quotes around 'show' because show is not a Sage keyword.
Code
plot(1/(x^3 -x ), -2, 2, ymin=-5, ymax=5, detect_poles='show')
Tags
Primary Tags—Plotting: Two-dimensional plots; Precalculus: Rational equations and functions
Secondary Tags—Two-dimensional plots: Rectangular plots; Rational equations and functions: Asymptotes
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
- Multiple Annotation Techniques for Graphing
- Occasional Issues in Polar Plotting
- 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: 15 Feb 2019 01:20
Submitted by: Zane Corbiere