## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

No credit card required

# Plotting functions in two dimensions

Functions play an important role in mathematics. To visualize them to better understand their properties, so that we can see roots and extreme points, we can plot them in a coordinate system. In this recipe, we will see how to easily plot functions. First, let's print the polynomial function f(x) = x^3 - 5*x.

## How to do it...

We will use the pgfplots package, which is based on PGF/TikZ. We already used it in the previous chapter to draw various diagrams. Now it will plot a function for us. Follow these steps:

1. Start with a document class. For this recipe, we decide on the standalone class, which is great for creating single graphics with just a small margin, but you can choose the article class or another one as ...

## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

No credit card required