Making Semi-Log Plots

This laboratory will introduce you to Mathematica, commands for making semilog plots. This can be a useful way to present your data or calculations when the plots cover a wide range of values.

1. A semilog plot of a function.

Consider the following problem. It’s the same one you saw in the Mathematica notebook entitled introduction.nb.The radioactive decay of the element thorium is given by the equation 

                                                           (Subscript[N, f]) = (Subscript[N, i]) (e^(-λt))

where  λ=ln 2 / (Subscript[t, 1/2])  = 1.14×(10^(-8)) (s^(-1)) and (Subscript[N, f]) is the number of remaining thorium nuclei, (Subscript[N, i]) is the initial number of thorium nuclei, t is the time elapsed, and (Subscript[t, 1/2]) is  the half-life of the thorium. When t=0, (Subscript[N, f]) is equal to (Subscript[N, 0]) and no decay has occurred. As t increases the amount of thorium, (Subscript[N, f]) decreases. Below is a short code that calculates the amount of thorium remaining after a given time. Execute the code and investigate the functions of the different elements of the code. Notice the use of comments and variable names that make the code readable.

Ni= 1000.0; (* Initial Amount in kg *)
time = 2000; (* Decay time in seconds. *)
lambda = 1.14*(10^(-8)); (* Decay constant in s^(-1) *)
Nf[time_]:= Ni*Exp[-lambda*time];
p1=LogPlot[Nf[time],{time,0,(10^9)},
Frame->True,FrameLabel->{"t (s)", "N"},PlotStyle->RGBColor[1,0,0],
BaseStyle->FontSize->12
]

2. A semilog plot of data

Here is an example of using the Table command to construct a set of points that we plot.

t1 = Table[{t,Nf[t]},{t,0,(10^9),(10^8)}]; (* Make a table go from 0 to (10^9) in steps of (10^8). *)
p2=ListLogPlot[t1,
Frame->True,FrameLabel->{"t (s)", "N"},PlotStyle->{RGBColor[0,1,0],PointSize[0.04]},
BaseStyle->FontSize->12
]

3. Combining Plots.

To combine multiple plots together use the Show command and you can add labeling with the Graphics and Text commands.

Show[p1,p2,
Graphics[Text["Some text",{(10^8),1},{-1,0}]]
]

4. Getting Help.

Mathematica has help included with the software. To access the help click on ‘Help’ on the menubar at the top of the window and drag down to ‘Wolfram documentation’ (Mathematica was created by a guy name Stephen Wolfram who started the company that makes it). You get a new GUI with a search box at the top where you can enter words to search.