Plotting Nonlinear Inequalities


There are some inequalities where the relationship between $x$ and $y$ cannot be expressed as a function, such as

\begin{align} cos(x^2 + y^2) \leq 0 \end{align}

To plot these, we can use the region_plot command.

Sage Cell


y = var('y')
region_plot(cos(x^2 + y^2) <= 0, (x, -5, 5), (y, -5, 5))


Style Options

We can change the look of the graph by setting the bordercol (color of the border), incol (color of the fill) and alpha (transparency of the fill).


y = var('y')
region_plot(cos(x^2 + y^2) <= 0, (x, -5, 5), (y, -5, 5), bordercol='black', incol='yellow', alpha=2/3)


Primary Tags:

Secondary Tags:

A list of possible tags can be found at The WeBWorK Open Problem Library. For linear algebra tags see the Curated Courses Project.

Related Cells

Any related cells go here. Provide a link to the page containing the information about the cell.



Author: Gregory V. Bard. Sage for Undergraduates. American Mathematical Society, Providence, RI, 2015. Available at

Date: 03 Mar 2019 19:16

Submitted by: Zane Corbiere

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