Log and Log-Log Graphing
This notebook is a modification of Paul Wellin's
this example as a Mathematica notebook. |
LogPlot is one of many advanced functions that reside in one of the many external
packages that come with Mathematica. These packages may be loaded into
Mathematica as their functionality is needed. A style guide to use as
you begin to write your own packages is also provided.
Load the Graphics package. This is done using the command Get,
<<, in Mathematica.
Define the function to be graphed. This is done in a format similar to the popular standards
and traditional written formula criteria. The name of the function is on the left-hand side of
the equation, and the variables of the function are represented with an underscore attached.
Everything to the right of := defines the function. For instance, defined
below is a function .
is a function of .
So that Mathematica knows the definitions of
you evaluate the cell. Now, if you evaluate this function at some value, its value will be returned by
You can define a function as a combination of Mathematica functions.
You can evaluate the function across a collection of values and save it
in a data variable using Mathematica's function Table.
Log Plot of a Function
Take the data that you collected, and produce a visualization of this data using LogPlot.
You can also add options to many Mathematica functions. The current option settings
for a particular function can be viewed by using the command Options.
Now create a log plot of this function, setting a few options for the
graphic output. Notice that you assign the plot a name plot1 in order
to refer to it later.
Log-Log Plot of a Function
You can use LogLogPLot to create a log-log plot of a function.
Log List Plot of Data
Mathematica also has LogListPlot, a function that will produce a log list
plot of the data.
Log-Log List Plot of Data
Log-log list plots of data can be produced using LogLogListPlot.
You can use GraphicsArray and then apply
the command Show to combine all four plots into one graph.