Graphing Equations with GNUPlot

Many algebra and calculus problems can be understood more clearly once they are plotted. As a standalone tool GNUPlot can generate 2D and 3D plots either interatively or from datafiles generated in other applications.

Graphing of Linear Functions

Linear functions, i.e., functions of the line, are the basis for later analysis methods. It is vitally important that linear functions are understood completely in order to understand more complex equations.
We can begin with the simplest case, a graph of a function f(x) = C where C is a constant. We start GNUPlot by typing:
  > gnuplot
  

at the shell prompt. This brings up the GNUPlot command prompt where we can graph functions using the plot and splot functions. In our example we used f(x) = C, where C is a constant. To graph this, we do the following:
  gnuplot> plot 5
  
This creates a graph of the function f(x) = 5. As expected, this creates a graph parallel to the X-axis at 5.

Plot of f(x) = 5

To graph an equation in slope-intercept form is simple. We can graph an equation of the form y = mx + b, e.g., y = 2x + 3 by typing:
  gnuplot> plot 2*x + 3
  
This is simple enough. However, the power of a graphing tool becomes apparent when we change one aspect of the function. For example, we can vary the sign or magnitude of the slope and quickly see how changes affect the graph. as follows:

Plot of f(x)=2x + 3 plot of f(x)=-2x + 3 plot of f(x)=2x + 1

In the first image we plot y=2x + 3. Next, we change the sign of the slope to become y=-2x + 3. By the graph it becomes apparent that a positive slope increases the graph from left to right. Finally, we change the intercept. This illustrates a vertical shift in the graph. Click on the images for a detailed view.

Graphing of Quadratic Equations