| 1 |
\chapter{Mathematical Equations}\label{ch:mathematicalequations} |
| 2 |
There are many ways to include formulas in your thesis. |
| 3 |
This section will provide some different ways of adding them (inline and standalone), as well as provide some ways of referencing the equations. |
| 4 |
|
| 5 |
To start the simplest way to add an equation is using the built-in \LaTeX\ math mode. |
| 6 |
To enter and exit math mode one just needs to use the \cmd{(} and \cmd{)} symbols around an equation. While there also exists \lstinline|$<Equation>$| to add math, it is not recommended due to potential compatibility issues. Additionally, this, \lstinline|\(<Equation>\)|, method is capable of being redefined to add further customization. |
| 7 |
An example of using math mode to get an inline equation is by using the following command: |
| 8 |
\begin{center} |
| 9 |
\lstinline|\(\vec{F_{d}}=\frac{1}{2}\ A\ C_{d}\ \vec{V}^{2}\)| |
| 10 |
\end{center} |
| 11 |
The above command has the effect of creating the following output: \(\vec{F_{d}}=\frac{1}{2}\ A\ C_{d}\ \vec{V}^{2}\). |
| 12 |
Sometimes it can be quite beneficial to separate what would be an inline equation to be on its own line. |
| 13 |
For this, we have two different ways of doing it. |
| 14 |
The first was will produce an equation that has no reference: |
| 15 |
\[ |
| 16 |
E = m\ c^2 |
| 17 |
\] % shorthand for the following way of writing equations. |
| 18 |
\begin{equation*} |
| 19 |
E = m\ c^2 |
| 20 |
\end{equation*} |
| 21 |
The second will produce an equation with a reference. |
| 22 |
For this, there are two main ways of creating the reference, the first one, see \Cref{eq:Eq}, creates a numbered reference; the other one, see \Cref{eq:pi}, creates a reference with a `tag'. |
| 23 |
The difference between the two is the inclusion of a \cmd{tag}\mopt{<text>} command that will replace the regular number with \opt{<text>} and the changing from the \env{equation} environment to the \env{equation*} environment. |
| 24 |
If you do not want the brackets around the tag, as shown in \Cref{eq:otherpi}, use the starred version of the command: \cmd{tag*}\mopt{<text>}. This will not remove the braces in the reference for the equation, but will remove them from appearing next to the equation definition. |
| 25 |
|
| 26 |
\notice{Using the \cmd{tag} command in conjunction with the \cmd{label} command can create a \LaTeX\ warning when used in the non-star \env{equation} environment. This warning can be safely ignored, however, the better way to deal with this is to make sure one is using the star version, \env{equation*}.} |
| 27 |
|
| 28 |
\begin{equation} |
| 29 |
\label{eq:Eq} |
| 30 |
\pi = 3.14... |
| 31 |
\end{equation} |
| 32 |
\begin{equation*} |
| 33 |
\tag{Constant pi}\label{eq:pi} |
| 34 |
\pi = 3.1415... |
| 35 |
\end{equation*} |
| 36 |
\begin{equation*} |
| 37 |
\tag*{Constant pi}\label{eq:otherpi} |
| 38 |
\pi = 3.1415... |
| 39 |
\end{equation*} |
| 40 |
If you have multiple equations that you want arranged very neatly, use the \env{align} environment and you can assign individual equations numbers as shown in \Cref{eq:multiref:a,eq:multiref:b,eq:multiref:c}. |
| 41 |
Note that it is the \& symbol that determines what will be aligned. |
| 42 |
Further note that spaces in \enquote{math mode} are ignored and need to be specified using the space commands in %\Cref{}%TODO ADD SPACE COMMANDS |
| 43 |
\begin{align}%Note: Alignment happens at the "&" character |
| 44 |
\label{eq:multiref:a} Equation1 &= 1\\ |
| 45 |
\label{eq:multiref:b} Equation2 &= 2 + 2\\ |
| 46 |
\label{eq:multiref:c} Equation3 &= 3 + 3 + 3 |
| 47 |
\end{align} |
| 48 |
|
| 49 |
%TODO: ADD MORE TYPES OF EQUATIONS |
| 50 |
|
| 51 |
%TODO: ADD MORE MATH BASED MACROS AND MENTION THE USE OF THE AMSMATH PACKAGES |
| 52 |
|
| 53 |
%TODO: MOVE THE TABLES TO AN APPENDIX THEY ARE VERY BLOATED HERE AND NOTHING REFERENCES THEM. |
| 54 |
|
| 55 |
|
| 56 |
It may be very important in a math heavy thesis to be able to show your equations, or even data in a readable way. |
| 57 |
For this, we will explore some of the ways to create specific data. |
| 58 |
|
| 59 |
\section{Vector, Sets, Piecewise Functions, Matrix Math, and More} |
| 60 |
\begin{equation} |
| 61 |
\text{f}(x) = |
| 62 |
\begin{cases} |
| 63 |
x^{2*\ln{x}},&\text{if }x<3\\ |
| 64 |
-\frac{x}{2},&\text{if }3\leq{}x\leq{}4\\ |
| 65 |
x,&\text{if }4<x |
| 66 |
\end{cases} |
| 67 |
\end{equation} |
| 68 |
|
| 69 |
Vectors and Matrices are used in many fields of math and science and provide a convenient way to represent 2-Dimensional arrays of numbers. |
| 70 |
\begin{align} |
| 71 |
x&\in{}\left\{1,2,3,4,5,6,7\right\}\\ |
| 72 |
V_{1} &= {\left( |
| 73 |
\begin{array}{cccc} |
| 74 |
a, & b, & c, & d\\ |
| 75 |
\end{array} |
| 76 |
\right)}\\ |
| 77 |
V_{2} &= \left( |
| 78 |
\begin{array}{c} |
| 79 |
a \\ |
| 80 |
b \\ |
| 81 |
c \\ |
| 82 |
d \\ |
| 83 |
\end{array} |
| 84 |
\right)\\ |
| 85 |
M &= {\left[ |
| 86 |
\begin{array}{cccc} |
| 87 |
a & b & c & d\\ |
| 88 |
e & f & g & h\\ |
| 89 |
i & j & k & l\\ |
| 90 |
m & n & o & p\\ |
| 91 |
\end{array} |
| 92 |
\right]} |
| 93 |
\end{align} |
| 94 |
|
| 95 |
\begin{multline*} |
| 96 |
p(x) = 3x^6 + 14x^5y + 590x^4y^2 + 19x^3y^3\\ |
| 97 |
- 12x^2y^4 - 12xy^5 + 2y^6 - a^3b^3 |
| 98 |
\end{multline*} |
| 99 |
|
| 100 |
\begin{align} |
| 101 |
ralign &= lalign \\ |
| 102 |
ralign &= lalign |
| 103 |
\end{align} |
| 104 |
|
| 105 |
\begin{align*} |
| 106 |
x &= y & w &= z & a &= b+c \\ |
| 107 |
2x &= -y & 3w &= \frac{1}{2}z & a &= b \\ |
| 108 |
-4 + 5x &= 2+y & w+2 &= -1+w & ab &= cb |
| 109 |
\end{align*} |
| 110 |
|
| 111 |
\begin{alignat*}{3} |
| 112 |
& m \quad && \text{Modulo} \quad && m>0\\ |
| 113 |
& a \quad && \text{Multiplier} \quad && 0<a<m\\ |
| 114 |
& c \quad && \text{Constant} \quad && 0\leq c<m\\ |
| 115 |
& x_0 \quad && \text{Initial Value} \quad && 0\leq x_0 <m |
| 116 |
\end{alignat*} |
| 117 |
|
| 118 |
\begin{equation*} |
| 119 |
\begin{array}{lll} |
| 120 |
m & \text{Modulo} & m>0\\ |
| 121 |
a & \text{Multiplier} & 0<a<m\\ |
| 122 |
c & \text{Constant} & 0\leq c<m\\ |
| 123 |
x_0 & \text{Initial Value} & 0\leq x_0 <m |
| 124 |
\end{array} |
| 125 |
\end{equation*} |
| 126 |
|
| 127 |
\begin{gather} |
| 128 |
eqn1 = fdsjalk \\ |
| 129 |
eqn2 = fdsa * 243 |
| 130 |
\end{gather} |
| 131 |
|
| 132 |
\begin{multline} |
| 133 |
eqn \\ |
| 134 |
= eqn |
| 135 |
\end{multline} |
| 136 |
\section{Functions} |
| 137 |
|
| 138 |
\begin{equation*} |
| 139 |
\begin{array}{llllll} |
| 140 |
\text{\cmd{sin}} & \sin & \text{\cmd{cos}} & \cos & \text{\cmd{tan}} & \tan \\ |
| 141 |
\text{\cmd{arcsin}} & \arcsin & \text{\cmd{arccos}} & \arccos & \text{\cmd{arctan}} & \arctan \\ |
| 142 |
\text{\cmd{sec}} & \cos & \text{\cmd{csc}} & \csc & \text{\cmd{cot}} & \cot \\ |
| 143 |
\text{\cmd{sinh}} & \sinh & \text{\cmd{cosh}} & \cosh & \text{\cmd{tanh}} & \tanh \\ |
| 144 |
\text{\cmd{ln}} & \ln & \text{\cmd{log}} & \log & \text{\cmd{exp}} & \exp \\ |
| 145 |
\end{array} |
| 146 |
\end{equation*} |
| 147 |
\section{} |
| 148 |
|
| 149 |
\section{Vector, Sets, Piecewise Functions, Matrix Math, and More} |