Mathematical Preliminaries
To get the most out of these lessons, I need you to be familiar with a
few different mathematical concepts. If you’ve had a course in algebra at some
point in your life, you may dimly remember some of what’s below, but in case
you don’t, I thought I’d go over the things you’ll need. This is a light
treatment of these concepts, but it’s really all that we’ll make use of. If you
want to know more, there are a ton of resources online to get into the
mathematics more rigorously.
Besides these
specific concepts, I also need you to be comfortable with basic arithmetic
(adding, subtracting, multiplying, and dividing) and to have some fluency
thinking about the graph of a function (y=f(x) and such). We’ve already used some material that relies on arranging numbers into lists (which we’ll call
vectors) and soon we'll be working with arrays (which we’ll call matrices), but we won’t work with any
tools for manipulating these besides what you see here.
Calculating Distances
At several points in the course of these lessons, we’ll use distance as a tool for
comparing things (colors, objects, etc.). This concept of distance is much like
what you’re used to thinking about in everyday situations: How far away is one
place from another? To be precise about this, we need to describe both places
with numbers that we’ll call coordinates.
You can think of coordinates as just a list of numbers that describe the
“address” for a place. If it helps, think about latitude and longitude for
real-world locations, or cross streets (4th Ave. and 5th
St.) as examples of how we use numbers to describe where a place is precisely.
Assume that we
have two locations, p1
and p2, each with
coordinates x,y in two-dimensions (e.g. p1
= [x1, y1]). The diagram below depicts both of these
points, along with the distance we want to know about (the dashed line).
Figure 1 - Distances between points in 2D can be calculated using their coordinates and an application of the Pythagorean Theorem.
With just a little
arithmetic to help us work out the horizontal distance between these points and
the vertical distance (in both cases, we subtract the larger coordinate from
the smaller), we can use the Pythagorean Theorem to help us work out that the
distance between p1 and p2 is as follows:
We won’t actually be doing a ton of work in just two dimensions, so
we'll need to use generalizations of this formula for 3 dimensions or more.
Dot-products
Now I need to introduce you to a computation you may not have run
into before: The dot-product. This is a way of multiplying two lists of numbers
together to get a single number in return. Why would you want such a thing? For
now, you can just take it on faith that it might be useful (and you can look in
the Appendix for some additional material about the dot-product if you care).
The definition of the dot-product for two vectors u and v is below:
If you don’t remember what to do with the capital sigma and the subscripts,
etc., here is a description of the dot-product in words:
For each number in the first
list, u, pair it up with the
corresponding number in the second list, v.
Multiply each pair together, then add up all those products.
Both definitions require that u
and v are the same length. We can’t
match items up between u and v unless every item in u has one and only one partner in v. As long as that’s true, it doesn’t
matter how many numbers we have in the two lists – we can just pair everybody
up, multiply, then add to get the dot product. The result is always just a
single number, remember, which we’ll end up using in a few different ways. Now
that you know how to calculate the dot-product, take a look at the exercises in
the problem set that involve computing them. It isn’t terribly hard, but some
practice never hurt.
Trigonometric functions and the unit circle
Finally, we will end up using a few trigonometric functions here
and there so we can be precise about angles and the relationships between
distances and angles that we care about in some situations. There is tons of
stuff to be said about these functions in a full course on trigonometry, and
we’ll need almost none of that stuff. What we do need are some definitions of
the functions sine, cosine, and tangent.
We can say what these are using a single diagram of a right triangle, like the
one below:
Figure 2 - Trigonometric functions are based on ratios between sides of an arbitrary right triangle.
The thing you need to know about all three of these functions is
that they are essentially machines for turning one number (an angle in a right
triangle) into another number. This second number is always a ratio between two
sides in the same right triangle that the angle we started with came from.
Which two sides we use to compute this ratio depends on the trigonometric
function.
We also need another piece of information: These machines can also
be run backwards using inverse
versions of each function. That is, if the thing you know is the ratio between
two sides, you can ask the inverse function to tell you what angle would have
given you that ratio for the two sides that function is concerned with.
One very important
thing to know about both sets of functions is that if you’re using a calculator
or any computer application to try and work with them, you may need to be
careful about the difference between describing an angle using degrees and using radians. You’re probably used to thinking about an angle in degrees
(a right angle has 90 degrees in it, for example), but a lot of software
prefers to think about them in radians. To convert between the two units, you
need to know the following:
360 degrees = 2*pi radians
This means that a right angle (90 degrees, remember!) can also be
described as subtending p/4 radians.
Alright – that’s it for now. Believe it or not, we’re ready to
start calculating some things about how your eye and your brain work. Remember:
We’re rarely going to stray beyond adding and multiplying, so the mathematics
won’t usually be the hard part. The hard part will be making sure you
understand why you’re doing what you’re doing and what it means.
Comments
Post a Comment