% basic_maths.tex - examples of different mathematical elements.
%
% Andrew Roberts - 27th April 2004
\documentclass[a4paper]{article}
\usepackage{times}
% The mathptmx package does for maths equations what the times package
% does for the main text. That is, uses scalable fonts rather than the
% default bitmapped ones. This is useful if you later want to convert
% your postscript file to PDF.
\usepackage{mathptmx}
\usepackage{multirow}
\begin{document}
\title{Basic Mathematical Elements}
\author{Andrew Roberts}
\date{}
\maketitle
\section{Fractions}
To create a fraction, you must use the
\verb|\frac{numerator}{demoninator}| command. (For those who need their
memories refreshed, that's the top and bottom respectively!) You can
also embed fractions within fractions, as shown in the examples below:
\[\frac{x+y}{y-z}\]
To illustrate nested fractions:
\[\frac{\frac{1}{x}+\frac{1}{y}}{y-z}\]
\section{Powers and Indices}
Powers and indices are mathematically equivalent to superscripts and
subscripts in normal text mode. The carat (\verb|^|) character is used to raise
something, and the underscore (\_) is for lowering. How to use them is
best shown by example:
\begin{center}
\begin{tabular}{ | l | l | l | }
\hline
\multirow{2}{*}{Powers} & \verb|$x^n$| & $x^n$ \\
& \verb|$x^{2n}$| & $x^{2n}$ \\ \hline
\multirow{2}{*}{Indices} & \verb|$n_i$| & $n_i$ \\
& \verb|$n_{ij}$| & $n_{ij}$ \\
\hline
\end{tabular}
\end{center}
\section{Roots}
The typical square root can be achieved with \verb|\sqrt{x}|:
\[\sqrt{x}\]
Regardless of the size of root you want, you still use the
\verb|\sqrt{}| command, even if you want the cube-root. You simply pass
an additional option to the command if you want to change the default
behavour. E.g., \verb|\sqrt[3]{8}|
\[\sqrt[3]{\frac{x^2}{4xy + \pi} }\]
Note how the length and height of the root notation automatically
resizes to the size of the equation within it.
\section{Brackets}
You may recall that you already have the ( ) [ ] symbols at your
disposal, which should be more than adequate for most peoples' needs. So
why the need for a decicated section? Well, I think that can be shown by
example:
\begin{equation}
(\frac{x^2}{y^3})
\label{wrong}
\end{equation}
As you can see, equation \ref{wrong} looks odd, because the brackets do
not scale to contain the entire fraction. What we wanted is illustrated
in equation \ref{correct}:
\begin{equation}
\left(\frac{x^2}{y^3}\right)
\label{correct}
\end{equation}
This was achieved using special bracket commands. You tell \LaTeX that
you want a left bracket, rather than the literal `(' symbol, and then it
will determine the appropriate size for it once it processes the
internal contents.
\begin{center}
\begin{tabular}{| l | l | c |}
\hline
Left & Right & Output \\ \hline
\verb|\left(| & \verb|\right)| & $\left(\ldots\right)$ \\ \hline
\verb|\left[| & \verb|\right]| & $\left[\ldots\right]$ \\ \hline
\verb|\left\{| & \verb|\right\}| & $\left\{\ldots\right\}$ \\ \hline
\verb#\left|# & \verb#\right|# & $\left|\ldots\right|$ \\ \hline
\end{tabular}
\end{center}
\end{document}