Basic Engineering Mathematics

Sat 20 Aug 2016

Among the many short cuts to science, we badly need someone to teach us the art of learning with difficulty.

–J. Rousseau, Émile, ou De l’éducation, 1762.

I come across it again and again; capable students who struggle in Engineering because they lack a solid mathematical background. Prevention is better than cure so your first year of studies is the time1 to set a strong mathematical foundation and consequently build your engineering knowledge. If the foundation is weak it is going to be much harder to keep up with your studies. This is unfortunate, because for us engineers it is not the arithmetic, the manipulation of symbols or the numerical result that are the center of our study. The real importance lies in the applications of concepts and their corresponding impact to the physical or digital world. By the end of your education in Engineering you are not supposed to have all subjects memorized. You are supposed to have built a library of information that you should be able to decipher in a reasonable amount of time in order to solve the problem at hand. Having said that, since Engineering is built on physical phenomena—and how we can manipulate them to our advantage—the language of communication is mathematics. Hence, you need to be comfortable enough with mathematics to understand the Engineering lingo.

Mathematics as a Language

Mathematics is unlike spoken languages in the sense that it is very specific. We term that a formal language. A formal language is one that allows for the unambiguous definition of otherwise ambiguous statements. It does so by defining a simple alphabet with a set of strict rules or a grammar which determines precisely how this alphabet can be used to construct valid statements. Therefore, in order to begin doing mathematics you need to be able to read mathematics. The way you achieve that is by understanding and applying the symbols with the correct grammar. Becoming comfortable with mathematics is a matter of drilling problem sets and understanding and convincing yourself of the truths behind the theorems. After a while drilling becomes obsolete and the concepts become yours. At that point, you are able to comfortably apply mathematics to tackle engineering problems.

Rudimentary Knowledge

The basic concepts that you will need to become familiar with consist of the following:

  1. Quadratic equations
  2. Systems of equations
  3. Trigonometric functions

I am assuming you are comfortable with arithmetic and variables. While calculators make it very easy to get the correct arithmetic answers, it might be beneficial to invest time in becoming comfortable with doing calculations in your head or with pencil and paper. The reason for this is that a big part of being an Engineering student is spent conducting experiments which require “back of the envelope calculations”. By “back of the envelope calculations” we mean fast computations that provide approximate answers. Their objective is to gain insight on what the answer should, roughly, look like.

A necessary and often neglected part of mathematics is visualisation; a graph can contain more information, or provide more insight, than a function formula or a table of values. To see the latter, consider the following vectors:

\(\vec{x} = \langle 1.19, 1.34, 0.23, \cdots, -0.33, -0.57, -1.65 \rangle\)

\(\vec{y} = \langle 15.67, 17.21, 10.22, \cdots, 10.43, 11.30, 20.93 \rangle\)

Clearly, one can not easily detect the relationship, if any, between \(\vec{x}\) and \(\vec{y}\). However, a simple plot immediately reveals a quadratic trend that is precisely determined by the equation \(y=4x^2+10\) (Figure 1).

From Mathematics to Programming Instructions

There can be no modern discussion of basic engineering mathematics without the bare minimum of scientific computing. Scientific computing has revolutionized how we do Math. Scientific computing consists of the translation of mathematical constructs to programming instruction. While you will need to become familiar with a programming language’s notation, this is not the difficulty in scientific computations. Rather, the difficulty is setting up the problem. After you set up the problem it is fairly trivial, with some knowledge, to translate it into programming instructions.

I will be using Python, it’s a religious issue. You are welcome to investigate your favourite programming language’s documentation to convert any of the examples below. We are only going to scratch the surface here, namely by defining what a function is and computing it for a certain value, computing it for a certain range of values, and plotting it over a general range.

Consider any arbitrary function. A function relates a set of inputs to a set of outputs. It’s a black box. Depending on the application, the graph of a function provides more information about its operation than the literal form, as we proved by inspection, above.

More formally, a function maps the input to the output. For example:

\(f: \mathbb{R} \rightarrow \mathbb{R}, x \mapsto \sin{x}\)

Both the input and the output are in the set of real numbers, \(\mathbb{R}\). It should be obvious that this is not always the case. Consider the function: \(g: \mathbb{Z} \rightarrow \mathbb{N}, x \mapsto x^2\). In this case we have an input to the function \(g\) of integer type but our output is in the set of natural numbers. In general, we say that the input \(x\), if passed through the function \(f\), will map to \(\sin{x}\) and if \(x\) is passed through the function \(g\), will map to \(x^2\).

Below is the code that creates the “black box” of those two functions:

import numpy as np

def f(x):
    return np.sin(x)

def g(x):
    return x**2

Now we can pass in a certain value and get the output of the function or even a range of values whose output will be used to construct the graph of the function, alike doing it by hand.

print('$f(\pi) = {}$\n'.format(f(np.pi)))
print('$g(3) = {}$'.format(g(3)))

\(f(\pi) = 1.22464679915e-16\)

\(g(3) = 9\)

Notice that \(f(\pi)\) is very small but not exactly at zero. This is a limitation of how computers do arithmetic and has to do with floating point arithmetic error, which is beyond the scope of this document.

If we wanted to we could calculate and plot over a range of values (Figure 2).

# this is the library we'll use to "draw" on the canvas
import matplotlib.pyplot as plt

# we create a list of values between -π and π
x_range = np.linspace(-np.pi, np.pi)

# we calculate for each of the values the function f and
# plot them on the canvas against x
plt.plot(x_range, f(x_range))

# these are just for it to look pretty; they are not
# technically necessary
plt.xticks([-np.pi, -np.pi/2, 0, np.pi/2, np.pi],
           [r'$-\pi$', r'$-\pi/2$', r'$0$', r'$+\pi/2$', r'$+\pi$'])

plt.yticks([-1, 0, +1],
           [r'$-1$', r'$0$', r'$+1$'])

# always label though, usually with more substance
plt.xlabel('$x$')
plt.ylabel('$F$')

# we save the picture here;
# to save to png just change the extension
plt.savefig('F.svg')
Sorry, your browser does not support SVG.
Figure 1: Simple plot of \(\sin(x)\) over the range \([-\pi, \pi]\).

Let’s do the same for \(g(x)\).

# this is a minimal working example of a plot
x_range = np.linspace(-5, 5)

plt.plot(x_range, g(x_range))

plt.xlabel('$x$')
plt.ylabel('$G$')

plt.savefig('G.svg')
Sorry, your browser does not support SVG.
Figure 2: Simple plot of \(x^2\) over the range \([-5, 5]\).

Think about it for a second, this is exactly the same as when you were plotting functions by hand. The computer creates a list with numbers from \(-\pi\) to \(\pi\), then passes each one to the black box of \(f\). Similarly, we construct a list of numbers from \(-5\) to \(5\) and pass them to \(g\). Finally the computer has a list of numbers in the \(x\text{-axis}\) and list of numbers corresponding the the \(y\text{-axis}\), then it just draws them on a canvas exactly how a person would; in pairs, \((x_1, y_1)\), \((x_2, y_2)\), …, \((x_n, y_n)\).

When we work with derivatives we are going to treat them the same as functions. We will not symbolically find the derivative, albeit it is possible with external libraries. Rather we are going to compute the derivative by “hard coding” the answer as follows. This is usually faster and easier than actually computing the derivative. Don’t forget that these snippets of code will be used either for your further understanding of the material or to complete a homework exercise. Hence, it is more about the actual result than the implementation. In these cases the faster you can get the result and examine it will actually afford you more time on other homework later, which is of utmost importance in the “heavy-weight” season of homework.

def f_prime(x):
    return cos(x)
def g_prime(x):
    return 2*x

At this point you can proceed as above to produce plots and calculate a certain value or range of values. This is enough knowledge to assist you in finishing homework assignments in subsequent classes that are not on programmatic techniques.

Units

Units, units, units, … ad infinitum. Any quantity without units has no physical significance—it’s meaningless. You should always track your units and apply unit conversions as you go. Deriving the correct units after mathematical manipulation is an important indicator—albeit not the only one—that you have proceeded correctly. On the other hand, the opposite, getting units that you didn’t expect or being unable to convert the units to a unit that makes sense in the context of the operations is a certain indication that you have an incorrect answer. For example, consider Newton’s second law of motion:

\[ \vec{F} = m \vec{a} \]

We know that mass is measured in kilograms in Système international d’unités (SI). Similarly, we know that acceleration is measured in meters per second per second. From the above equation we know that \(kg \frac{m}{s^2}\) should be our unit which, as we know, is expressed as a Newton (\(N\)). Any other combination of units would have indicated an incorrect manipulation in previous steps. For example, a mistake could have occurred in calculating the acceleration. Notice that the prefix matters as well; an answer that had grams instead of kilograms couldn’t be converted to a Newton.

Incompatible use of units cause disasters:

Recommended Reading

It is difficult to include all the knowledge you need to have acquired during K-12. It is, however, easy to show you the way to catch up. It need not take too long and it can happen in parallel with your studies (most people with a basic high school background could probably refresh in a weekend if they were motivated enough).

A great resource to refresh your knowledge in mathematics as well as build a strong foundation if you have missed some courses is:

  • Basic Mathematics by Serge Lang

Another book that conveys the general approach to mathematical thinking and problem solving is:

  • How to Solve It by George Pólya

You will probably be revisiting these books throughout your studies for specific information; remember that this is about constructing a library of information that you can easily access and use to solve problems.

The above will provide you with mathematical background for further and more rigorous study of engineering concepts2.

Additionally, writing mathematics in a proper manner for coherence is not taught in most schools; even at the college level. An indispensable resource in that regard is:

Optionally, for people that want to familiarize themselves with discrete mathematics, I would recommend the following notes from a now defunct course at Stanford:

Finally, as a great introduction to Calculus I recommend:

Closing Remarks

Mathematics is not just solving specific challenging problems. Mathematics is a way of reasoning in a certain sequential, logical manner. The problem space can span from homework questions—which are by definition very clearly defined and feasible to solve—to general inquiries about the world around us and how it operates; inquiries that will not necessarily have a clear cut answer. While mathematics can be an interesting endeavor in and of itself, it also forms the basis for all the mentally stimulating things engineers do; from light emitters to modeling of attacks on a computing system.

Footnotes:

1

While this advice is general, the document is directed towards first year undergraduate students.

2

Logical literacy wouldn’t hurt either but you will get to that later in your studies and some of it is included in the Discrete Structures Lecture Notes if you wish to start early.