Plotting Inequalities in Sage

## Description

Here we will graph the inequality

(1)
\begin{align} y \leq 1 - x^2 \end{align}

Sage doesn't have a specific function to plot an inequality, so instead we will be plotting $y = 1 - x^2$ and shading all points that violate the inequality. To shade, we will set the fill, fillcolor and fillalpha parameters. fill fills from the y-value specified to the curve, fillcolor sets the color being used to fill and fillalpha sets how transparent the fill will be. We will also set ymin and ymax, otherwise Sage will plot from y = 10 to the local minima.

## Sage Cell

#### Code

plot(1 - x^2, (x, -2, 2), gridlines='minor', ymin=-2, ymax=2, fill=10, fillcolor='yellow', fillalpha=2/3)


## Options

#### Filling under the curve

We can fill under the curve by setting fill to a y-value below the curve instead of above. We will use -10 instead of 10.

#### Code

plot(1 - x^2, (x, -2, 2), gridlines='minor', ymin=-2, ymax=2, fill=-10, fillcolor='yellow', fillalpha=2/3)


## Tags

Primary Tags: Plotting: Two-dimensional plots

Secondary Tags: Two-dimensional plots: Plotting Inequalities