Log and Log-Log Graphing
This notebook is a modification of Paul Wellin's
EngineeringDemo.nb.
 | Download
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.
Setup
Load the Graphics package. This is done using the command Get,
<<, in Mathematica.
![[Graphics:Images/index_gr_1.gif]](Images/index_gr_1.gif)
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 .
![[Graphics:Images/index_gr_3.gif]](Images/index_gr_3.gif)
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
Mathematica.
![[Graphics:Images/index_gr_7.gif]](Images/index_gr_7.gif)
![[Graphics:Images/index_gr_8.gif]](Images/index_gr_8.gif)
You can define a function as a combination of Mathematica functions.
![[Graphics:Images/index_gr_9.gif]](Images/index_gr_9.gif)
You can evaluate the function across a collection of values and save it
in a data variable using Mathematica's function Table.
![[Graphics:Images/index_gr_11.gif]](Images/index_gr_11.gif)
Log Plot of a Function
Take the data that you collected, and produce a visualization of this data using LogPlot.
![[Graphics:Images/index_gr_12.gif]](Images/index_gr_12.gif)
![[Graphics:Images/index_gr_13.gif]](Images/index_gr_13.gif)
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.
![[Graphics:Images/index_gr_14.gif]](Images/index_gr_14.gif)
![[Graphics:Images/index_gr_15.gif]](Images/index_gr_15.gif)
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.
![[Graphics:Images/index_gr_16.gif]](Images/index_gr_16.gif)
Log-Log Plot of a Function
You can use LogLogPLot to create a log-log plot of a function.
![[Graphics:Images/index_gr_18.gif]](Images/index_gr_18.gif)
![[Graphics:Images/index_gr_19.gif]](Images/index_gr_19.gif)
![[Graphics:Images/index_gr_20.gif]](Images/index_gr_20.gif)
Log List Plot of Data
Mathematica also has LogListPlot, a function that will produce a log list
plot of the data.
![[Graphics:Images/index_gr_22.gif]](Images/index_gr_22.gif)
![[Graphics:Images/index_gr_23.gif]](Images/index_gr_23.gif)
![[Graphics:Images/index_gr_24.gif]](Images/index_gr_24.gif)
Log-Log List Plot of Data
Log-log list plots of data can be produced using LogLogListPlot.
![[Graphics:Images/index_gr_27.gif]](Images/index_gr_27.gif)
![[Graphics:Images/index_gr_28.gif]](Images/index_gr_28.gif)
![[Graphics:Images/index_gr_29.gif]](Images/index_gr_29.gif)
Combining Plots
You can use GraphicsArray and then apply
the command Show to combine all four plots into one graph.
![[Graphics:Images/index_gr_32.gif]](Images/index_gr_32.gif)
![[Graphics:Images/index_gr_33.gif]](Images/index_gr_33.gif)
![[Graphics:Images/index_gr_34.gif]](Images/index_gr_34.gif)
![[Graphics:Images/index_gr_35.gif]](Images/index_gr_35.gif)
![[Graphics:Images/index_gr_36.gif]](Images/index_gr_36.gif)
|