Showing posts with label vectors. Show all posts
Showing posts with label vectors. Show all posts

Tuesday, March 27, 2018

The Genesis of Light

There's an old (at least, I assume it's fairly old) physics meme that goes:
“And God said…
\[\nabla\cdot\mathbf{E}=\frac{\rho}{\epsilon_\circ}\\
\nabla\cdot\mathbf{B}=0\\
\nabla\times\mathbf{E}=-\frac{\partial \mathbf{B}}{\partial t}\\
\nabla\times\mathbf{B}=\mu_\circ\mathbf{J}+\mu_\circ\epsilon_\circ\frac{\partial\mathbf{E}}{\partial t}\]
…and there was light.”
Here E is the electric field, \(\rho\) is the electric charge density, B is the magnetic field, J is the electric current density, and \(\mu_\circ\) and \(\epsilon_\circ\) are the permittivity and permeability of free space, respectively. Bold-face quantities are vector quantities. These four equations are Maxwell's equations which describe electricity and magnetism in terms of classical field theory, but more on that a little later.

Back in 2016 my parents took a trip to Israel and brought me back a shirt with this on it for Christmas, except in the original Hebrew. Pretty cool! Except, they weren't Maxwell's equations, and on a closer look they weren't actually equations at all, just collections of symbols that looked kinda like some equations from special relativity, and to top it off the shirt was just barely big enough for me so I never actually wore it.

But I loved the idea, and now (a little over a year later) I've created my own variation on the design and had a shirt printed with it:

This was a surprisingly difficult photo to take on my own.

Although known as Maxwell's equations (after the Scottish physicist James Clerk Maxwell, widely considered the third greatest physicist of all time after Newton and Einstein), these four equations are actually a reformulation of Maxwell's original twenty equations in twenty variables by Oliver Heaviside, who cast them into vector calculus form and condensed them down into four by use of the divergence (\(\nabla\cdot\) ) and curl (\(\nabla\times\) ) operators.

Being a classical description of electromagnetism Maxwell's equations have been superseded by quantum electrodynamics, but they are still very useful in a wide variety of situations that do not involve strong electromagnetic fields or individual photons, just as Newtonian gravitation is still a useful approximation to general relativity in areas of weak gravitational field.

These four equations, and what they represent, are a monumental achievement—second, at the time, only to Newton's work—and have a sublime beauty to the physicist. The seemingly-disparate forces of electricity and magnetism are revealed to be both aspects of a singular electromagnetic force. This is seen in the third and fourth equations, where curl (or rotation) of an electric field is seen to rely on a magnetic field, and vice versa. All four equations can be combined (in a vacuum, where J and \(\rho\) are both zero) to derive the electromagnetic wave equation which describes light as a series of correlated ripples in the electric and magnetic fields, or electromagnetic radiation. (In fact, it turns out that \(\frac{1}{\sqrt{\mu_\circ\epsilon_\circ}}=c\), the speed of light!)

The asymmetries between the electric and magnetic fields that at first glance might seem to mar the beauty of the whole only enhance it upon further inspection, as the minus sign in the third equation is crucial to forming the feedback loop in the electromagnetic wave equation that allows light to travel forever as self-contained photons. They helped motivate Einstein to develop special relativity (which Maxwell's equations are compatible with) to explain why the same phenomenon could be seen as an electric or a magnetic effect depending on the frame of reference chosen. And the second equation explains why you can't break a magnet in half and end up with two monopoles.

I used EqualX (which I wrote about last month) to typeset the equations in \(\LaTeX\), then exported them as SVG which I imported into Inkscape where I added the text (and did a lot of manual tweaking of the layout of the various elements to make it look nice). Switching my keyboard to Hebrew and figuring out the letters took quite a while, which is why there are no vowel pointings; Inkscape's support for right-to-left fonts is a bit fiddly (though I saw just the other day an update that supposedly improved it) and trying to figure out all the various pointings and getting them around the right letters was a nightmare, so I gave up after tortuously figuring out the first three. At least it's more authentic ancient Hebrew now…

While working on the design for this shirt (I uploaded five different versions to the printing site before I was satisfied) I thought sardonically to myself that I was making this shirt for my own enjoyment, and that of the perhaps five other people on the planet who understood both Biblical Hebrew and electromagnetism. Then lo and behold, the first day I wore it, while walking around Bunnings (basically Australian Home Depot) a gentleman stopped me, said he thought it was great, and asked where I'd gotten it. When I said I'd designed it and had it printed myself he then asked if I was selling it anywhere!

I ended up sending him the image file to use, but it got me thinking. I've gone ahead and uploaded the design to Spreadshirt.com, where I got the original shirt printed. You can find it (and a version in white for dark backgrounds) for sale on shirts here. It defaults to showing the men's styles, but there are women's styles as well and you can pick from a range of colors. (If any of you out there actually order one I'd love to hear about it!)

Tuesday, August 30, 2016

Watching Wild Winds with Windyty.com

Today the rather awesome website Windyty was brought to my attention, which shows these amazing animated maps of various weather conditions over the entire planet, vector maps of wind speed being the default. As I was excitedly ranging to and fro about the whole Earth, I took a look at the Pacific and discovered the rather ominous scene below (you can click and drag to move in, and scroll to change the zoom level):



Those two spiraling vortices are hurricanes Madeline (left) and Lester (right), both Category 3 hurricanes as of the time of this writing, and both bearing down on the location of my abode. Some models have Madeline narrowly missing the Big Island, other have it making direct landfall, but they generally agree that it'll happen sometime Wednesday evening or early Thursday morning. Thankfully, they're also projecting it to drop in strength to a Category 1, or even a mere tropical storm. There are predictions for between 6–15 inches of rain, though we had a little over 6 inches last Tuesday and that wasn't even a tropical storm.

Lester is further out and thus more poorly constrained, but it's possible it could hit as well sometime around the end of the week, though again, it could miss and will likely drop in strength before that happens.

As I've occasionally said before, life's never boring when you live on a volcano in the middle of the Pacific! Looks like the wind's picking up a bit as I write this, and it just started raining as well. While the map above is constrained to show the weather around the time I'm writing this (August 30, ~2:00 PM), the one below is set to the most recent actual forecast, so you can watch it over the rest of the week if you want to watch what the hurricanes do. A hui hou!




Update, August 31, 12:00 PM: The wind pattern picture from this point in time is just so cool I had to share it. Hurricane Madeline is starting to head down south of the island, and it's interesting how the wind speed is high in the ʻAlenuihāhā channel between Hawaiʻi and Maui (famed for its wind-funneling effect) but mostly pretty low over Hawaiʻi itself.

Tuesday, September 25, 2012

Solving The Raindrop Problem

Have you ever noticed that when you're driving during a rainstorm, the number of raindrops hitting your windshield seems to increase along with your speed? I first noticed it soon after I started driving, and ever since then I've intended to sit down and work out a formula to explain it. (Living in Hilo and having it rain frequently while driving up and down from Mauna Kea has tended to keep “the Raindrop Problem” as I've come to call it fresh in my mind.)

I've toyed with it on occasion, but never definitively solved it, so I finally decided to sit down and work it out rigorously. So, without further ado I shall put my years of mathematical training to the test and attempt to figure out just how the amount of rain hitting your windshield changes as a function of your speed, while simultaneously trying to explain it in terms you can follow. Ideally, I'd like to get a graph out of it.

We start out in the grand tradition of physicist everywhere by considering a very simple, idealized case. Let us assume that for our purposes, the density of raindrops is uniform everywhere that we are considering. On a small enough spatio-temporal scale this is not a bad assumption. Furthermore, assume that the raindrops are falling straight down, with no gusts of wind or other forces acting on them other than gravity and air resistance. Again, a fairly plausible scenario, especially for a lot of the rain we get in Hilo, which often comes without any accompanying wind. A steady or gusty wind such that the raindrops had a set non-zero horizontal velocity or acceleration could also be taken into account, but is more complicated than I'd like to get into right now.

Let's begin by assuming the simplest possible case. Imagine a sheet of glass of width w and height h laying horizontally under a steady, uniform rain with evenly distributed raindrops falling at uniform velocity r (for “raindrop”. I'm saving v for later). Now, we want to know how many raindrops will hit the glass in a time interval \(\Delta t\) (pronounced "delta-t", if you don't know).

If we know that the raindrops are falling at speed r, then we can multiply by the time interval \(\Delta t\) to figure out how far they fall during that interval. Thus, any raindrop within a distance  \(d=||r||\cdot\Delta t\) above the glass will hit it within time interval \(\Delta t\). (The double vertical bars around the ‘r’ serve to remind us that it is technically a vector quantity and indicate that we want the length [or magnitude] of the vector in this equation.)

Intuitively, this gives us a rectangular box of volume \(V=d\times h\times w\) over the sheet of glass within which raindrops will be able to hit the glass in time interval \(\Delta t\). Less intuitively but more rigorously this can be achieved by a double integration of the raindrop fall distance   \(d=||r||\cdot\Delta t\) over the sheet of glass:
\[V=\int_{0}^{h}\int_{0}^{w}||\overrightarrow{r}||\cdot\Delta t\ dx\,dy\]
You may refer to the image below to help keep all these symbols and concepts straight:


At this point we've nearly solved the problem of how many raindrops will hit the sheet of glass in time interval \(\Delta t\), which for our purposes will be 1 second. We just need to know the numerical density N of raindrops per unit volume times the volume where raindrops will be able to hit the glass. Putting everything we have so far into a formula, we have
\[\begin{align}n&=N\cdot V\\
&=N\cdot h\cdot w\cdot ||r||\cdot\Delta t\end{align}\]
This is all well and good, but there are two additional factors we must take into account to better approximate a car's windshield. Those factors are the angle of the windshield, and the fact that we are interested in a moving windshield.

We will now consider each effect independently, before adding them together to get a full picture of the situation.

Let's start by introducing a non-zero angle of repose to the glass sheet. Refer to the picture below to see what I mean (I've added a coordinate system for future reference):


Now, the basic problem remains the same: figuring out the volume marked by the blue parallelograms and the glass sheet. This figure is known in geometry as a parallelepiped (PARR-uh-lel-EH-pi-ped), and has the following formula for its volume (from vector calculus)
\[V=|\overrightarrow{a}\cdot(\overrightarrow{b}\times \overrightarrow{c})|\]
where a, b, and c are the vectors that make up three of the sides that meet at a vertex and the \(\times\) sign and dot have special meanings because these are vectors. (I'm not being super consistent about notating all my vectors all the time due to the constraints of working in a blog post, but I'll try to keep it clear when the distinction is important.)

“But wait a minute,” you may be thinking to yourself at this point. “Wouldn't it be easier in this case, in order to find the volume, to simply multiply the height h by a factor of \(\cos(\theta)\) to account for the diminished surface area as seen from above (where \(\theta\) runs between \(0^\circ\) for a flat sheet and \(90^\circ\) for a vertical one), and then multiply by d and w?”

Indeed it would, astute reader. In this case, such a formula would be simpler. In fact, the formula for the volume would be simply \(V=w\cdot\cos(\theta)\cdot h\cdot||r||\cdot\Delta t\).

However, the second effect we will be considering is the velocity of a moving car and attached windshield, and since I foresee vector addition on the horizon I think it would be prudent to begin incorporating vectors into the picture now.

That brings us to considering the velocity of the car (and by extension windshield) intself. Let's assume that the car is moving with a constant horizontal velocity in the positive x-direction at velocity v, as per the picture below.


The nice thing about using vectors to find the volume of the parallelepiped is that it's very easy to find the length of one of the blue lines (what we were calling d before) in the above picture: it's simply the sum of the vectors r and v. Let's call it g (for no particular reason), and we can define it as
\[\overrightarrow{g}=\overrightarrow{v}+\overrightarrow{r}\]
We can break vectors into their component parts along each axis, and in this case we have \(g_x=||\overrightarrow{v}||\) (since the x-component of g is coming from the velocity of the car), \(g_z=||\overrightarrow{r}||\) (since the z-component is coming from the velocity of the rain), and \(g_y=0\) (since we are assuming the rain is falling straight down and the car is traveling only in the x-direction).

Using the volume formula for a parallelepiped from before, the volume can be found by
\[V=|\overrightarrow{g}\cdot(\overrightarrow{h}\times\overrightarrow{w})|\]
as long as we can find a vector for g, h, and w. Once we have, the volume is given by the absolute value of the determinant of a \(3\times3\) matrix like so:
\[\begin{align}V&=\begin{Vmatrix}g_x &g_y &g_z\\ h_x &h_y &h_z\\ w_x &w_y &w_z\end{Vmatrix}\\
 &=|g_x\begin{vmatrix}h_y &h_z\\w_y &w_z\end{vmatrix}-g_y\begin{vmatrix}h_x &h_z\\w_x &w_z\end{vmatrix}+g_z\begin{vmatrix}h_x &h_y\\w_x &w_y\end{vmatrix}|\\
&=|g_x(h_yw_z-h_zw_y)-g_y(h_xw_z-h_zw_x)+g_z(h_xw_y-h_yw_x)|\end{align}\]
At this point it's an easy matter of plugging in the appropriate numbers to get the volume, after which we can use \(n=N\cdot V\) to get the number of raindrops. And to make it even better, a little reflection shows that we can simplify this symbolic equation even further.

We already know that \(g_y=0\) from above, and we can remove several other quantities upon analysis. Remember, the vector w runs only in the y-direction, so \(w_x=w_z=0\). Similarly, g and h run only the x- and z-directions, so \(g_y=h_y=0\). Upon dropping all the zero terms, the equation simplifies nicely into
\[V=|g_zh_xw_y-g_xh_zw_y|\]
We can now replace the vector components with the original quantities they stand for to remind ourselves what everything is.
\[\begin{align}g_z&=||\overrightarrow{r}||\\
h_x&=-\cos(\theta)||\overrightarrow{h}||\\
w_y&=||\overrightarrow{w}||\\
g_x&=||\overrightarrow{v}||\\
h_z&=\sin(\theta)||\overrightarrow{h}||\end{align}\]
(\(h_x\) is equal to negative \(\cos(\theta)\) because I'm taking all vectors to start at the origin, and the windshield extends slightly backwards into the negative x-axis.)

Thus, for the final volume equation we have
\[V=|\big(||\overrightarrow{r}||\cdot -\cos(\theta)||\overrightarrow{h}||\cdot ||\overrightarrow{w}||\big)-\big(||\overrightarrow{v}||\cdot \sin(\theta)||\overrightarrow{h}||\cdot ||\overrightarrow{w}||\big)|\]
At this point we are nearly ready to begin making graphs. Since we are assuming that h, w, \(\theta\), and r are all constant, we are left with an equation in v, which lends itself well to plotting.

We just need to put numbers to all our variables. Let's assume that our hypothetical windshield has a width of \(w=2\) meters and a height of \(h=0.5\) meters, giving it a surface area of \(0.5\times2=1\) m\(^2\). A little searching on the Internet finds that a “typical” raindrop has a terminal velocity of \(r=9\) meters per second. One source I found suggested a value of about \(780\) cubic millimeters of water per cubic meter of atmosphere for the density of rain. Raindrops may have diameters anywhere between 0.5 and 5 millimeters (any larger and it breaks up on the way down, any smaller and it's technically not rain, but drizzle) so the volume of an “average” raindrop of diameter 3 millimeters is
\[V=\frac{2}{3}\cdot\tau\cdot(1.5\,\text{mm})^3=14.14\,\text{mm}^3\]
Thus, on average, a cubic meter of atmosphere contains \(780\,\text{mm}^3\div14.14\,\text{mm}^3\approx55\) raindrops. So \(N=55\) for our example here.

Plugging all of this into a Python script I wrote, I was able to use the matplotlib graphing package to generate the graph below with multiple plots for different windshield angles.

The results are, perhaps, not too surprising, but still interesting (and make a rather pretty graph). The number of raindrops appears to increase linearly with speed, with steeper windshield angles (like those found in trucks or large vans) having a higher rate of increase than lower angles (like those found more in cars). The limiting cases of \(0^\circ\) and \(90^\circ\) are illustrative; a flat surface (like on the roof of vehicles) would have no change whatsoever with changing speed, while a vertical surface would start out with no raindrops hitting it (as expected), but would eventually have the most raindrops hitting it if you could go fast enough (45 meters per second is about 100 mph, so it would have to be pretty fast, but you can see that even by about 75 mph it has surpassed nearly all other angle inclinations but the \(75^\circ\) one.) I'd estimate that most cars have windshield angles around \(45^\circ\pm15^\circ\), which is best represented by the cyan line on the graph.

So, now you know (or at least have a good idea) why you need to run the windshield wipers at faster speeds when going faster. And it only took three semesters of calculus to do! (Granted, I could have done it algebraically for this simple case, but why pass up the chance to do some exciting vector calculus?) It might be interesting for a follow-up post to consider time of travel, and how many raindrops you would actually encounter at different speeds for a given trip length. Anyway, a hui hou!

Wednesday, February 3, 2010

In which earth-shaking things are revealed.

Yesterday...

How to begin? "Yesterday I learned a new mathematical operation"? "Yesterday I was taught something that rocked my knowledge of vector calculus to its core"? Or maybe "Yesterday I learned of mathematical quarks".

I'm sorry, it's a bit hard for me to explain, but yesterday I did have a very profound revelation in math as it relates to the commutativity of the dot product when one of the "vectors" is the del operator.

Oh dear, this is just getting worse, isn't it? Let me start by explaining that we have homework due in Electromagnetism. Most of the problems were fairly straightforward, if a little long and time-consuming. But there were two product identities that simply rebuffed all efforts to prove. This was the more downright bewildering because usually such proofs are very simple: just write out every single term explicitly, and cancel until you're left with zero on both sides of the equals sign. But these two repeatedly withstood every attempt, by me and several other people as well. My only thought was that I must be doing something wrong, but what? As far as I could tell, all the terms were correct, but in each proof I'd end up with 20 or more terms that wouldn't cancel.

But yesterday...

I and a classmate were working on the homework, and having finished the rest of the problems, were getting increasingly frustrated with our lack of progress, or indeed the lack of any conceivable way to make progress. I should mention that we were working in the main hallway in Wentworth Hall, the main Astronomy/Physics/Chemistry building on campus. We were venting our frustration by reviewing everything we knew about vectors and their operations from the beginning, our conversation going something like

"But that's a vector!"
"Right!"
"And if you dot a vector and the del operator, you get..."
"A scalar!"
"Right!"
"And if you multiply a vector by a scalar, you get-"
"-a vector." 

At which point Dr. Heacox, one of our professors from a different class happened to walk by and overhear us. With the desperation of two drowning sailors, we turned to him and poured out our troubles, about how the identities wouldn't work, and we must be doing something wrong, but what was it, and did he have any idea what was the problem was? To his everlasting credit, he stopped and came over to look, and in about 30 seconds had identified the problem: dotting the del operator with a vector is not commutative.

That's a rather complex statement, so I will explain. To be commutative in math means that you can do things in any order and it won't affect the results. For instance, addition is commutative: \(2+3=3+2\). So is multiplication: \(5*7=7*5\). But subtraction and division are not. \(3-4\ne 4-3\), and \(8/2\ne2/8\). Knowing whether an operation is commutative or not is very important.

You can think of vectors as essentially numbers with direction.  For instance, velocity is a vector. You can say things like "50 mph to the east", or "2 feet per minute straight up". Speed, in contrast, is a scalar, a number with no direction. Saying "50 mph" gives me no information about what direction this speed is directed towards. Many of the numbers we deal with in everyday life are scalars (like temperature, price, and speed). Others are vectors, like forces and accelerations (I almost said weight was a scalar, until I remembered that it does have a direction: towards the center of the Earth).

Anyway, the point of this is that the dot product (one of the two ways to multiply vectors) is commutative: \(A\cdot B=B\cdot A\). However, it is not commutative when one of the two "vectors" is the del operator. I put vectors is quotes, because the del operator is just that: an operator, not a vector (some operators you may be more familiar with are \(+, -, \times,\) and /  or \(\div\)). You are allowed to treat it like a vector for purposes of notational simplification, and so I (naively) assumed that it did indeed behave like a vector at all times. But what I learned, and what really rocked me to my core, is that \(\nabla\cdot A\) does not equal \(A\cdot\nabla\) (the del operator is the upside-down equilateral triangle. The actual symbol is called a “nabla”.). The quantity \(\nabla\cdot A\) is a very common mathematical and physical quantity, called the divergence of A, since it measures how much A is spreading out or contracting in. But \(A\cdot\nabla\) is another beast entirely. In fact, it is without physical meaning until multiplied by another vector. That's why I whimsically began this long rant by saying I had discovered a mathematical quark.

Quarks, in the Standard Model of physics (the most successful theory of matter that we have to date), are what make up certain sub-atomic particles like protons and neutrons. Both protons and neutrons are made up of three quarks, and when one of those quarks changes its type (from being, say, a 'down' quark to an 'up' quark) you can have a neutron change into a proton, or vice versa (extremely rare).

The catch is, quarks have never been observed by themselves in any experiment, so the best we can say, since they seem to fit all the data, is that quarks can never exist freely in nature. Much like the little mathematical beastie \(A\cdot\nabla\) which has no meaning until multiplied by a vector.

"Why is this such a big deal?" , you may well ask. I think the answer, for me, is a combination of the fact that I had never heard of this before -- had seen nary a mention of it in all the math classes I've taken so far. I had no inkling of its existence, yet there it was just waiting to be the solution to my problem. Also, the fact that I was rather...worked up when I learned it. I'd already spent over 4 hours over several days trying to get the one identity to work, and it was driving me crazy when all of a sudden...the answer just fell into my lap, as it were.

After dispensing this astonishing piece of knowledge, Dr. Heacox amiably bid us good day and went off to wherever he was going, while my classmate and I sat and tried to decide whether to laugh long and loud at our stupidity or go over and kick a wall, repeatedly. Unable to make up our minds, we settled for finishing the homework, which went over completely without incident after that (although it still took us an additional 2 hours).

So, that was that. Not especially life-changing to most of you I'm sure, but it was a very moving experience for me, as you can see by the length of this post. You can now go about your life with some interesting information about vectors (perhaps tomorrow I'll tell you more about the other way to multiply vectors, the cross product), while I ... will be taking Dr. Heacox cookies tomorrow.