All posts by kdavenport


So, it’s this kind of day today…

IMG_3701…which always makes me introspective.  Consider the following…

About 13.8 billion years ago, the Universe came into existence, for whatever reason you choose to believe.  During that event, all of the energy that was, is, and ever will be spewed forth.  Some of it, after some time, coalesced into matter, mostly hydrogen mixed with helium in a 3-to-1 ratio, with a pinch of all the heavier elements for flavor.

In addition to creating matter, the primordial energy of creation also imparted all of these particles with kinetic energy, the energy of motion, transferred to them in the form of thermal energy radiated from space itself.

Nothing particularly interesting happened for about half a billion years, particles just kind of flew around the ever increasing expanse of space.  However, due to the fact that they had mass, the universe actually gave another type of energy to all matter…gravitational potential energy.  The particles attracted each other into great clumps of inert matter and, as they did so, converted this potential energy into kinetic energy, causing them to fall towards one another, increasing in speed.  As they got closer and closer, collisions became more and more common and this kinetic energy was rapidly transferred between them, something that we perceive as temperature.

At some point, the temperature became so great that the kinetic energy was enough to overcome the electrostatic repulsion between the like-charged particles, allowing in the strong nuclear force to “stick” them together and the process of nuclear fusion began.

Through potential energy, these nuclear furnaces converted the small amount of mass lost in the fusion process back into energy, which was radiated out into space.  After a while, the star would die, projecting it’s remaining matter back into the universe to seed the creation of the next generation of stars.

After (probably) three rounds of this, the Sun came into existence about 5 billion years ago.  What matter wasn’t consumed by its creation gravitationally collapsed to create the multitude of rocky bodies that orbited it, propelled by that same potential and kinetic energy.

On Earth, like on the other bodies, larger leftover chunks of rock and ice pummeled the surface.  Unlike the others, however, the distance was such that the energy emitted from the Sun was enough to keep the kinetic energy of the water molecules high enough to avoid forming crystals and freezing.  It was low enough, however, to keep them from flying apart completely and vaporizing.

Like the early Universe, nothing particularly interesting happened for another billion years.  However, the energy pouring onto Earth from the Sun allowed order to arise, fending off the ever-present influence of entropy.  Self-replication, powered by the Sun, gave rise to more and more complex structures.

About 350 million years ago, plants really began to take over, covering the Earth, powered by the Sun via photosynthesis.  They used it’s energy to create carbohydrates, made up of atoms of carbon and hydrogen provided by the destruction of the Sun’s progenitor.  This chemical potential energy could then be broken apart at a later time to fuel the process of life, fending off chaos…at least until the energy ran out and death occurred.

As the plants and their unused energy were buried, pressure and heat, yet again manifestations of gravitational potential energy, converted them into coal and natural gas.  Deep in the Earth they remained…until the surface order empowered by the Sun gave rise to us.

About 200 years ago, we figured out how to extract these materials. By burning them, we can release that chemical potential energy and do work.  Coal is burned to heat water, inciting a phase change to steam, imparting kinetic energy to a turbine blade, which rotates a magnet in a coil of wire, transferring that kinetic energy to the electrons, generating electricity.

These electrons are propelled to my home by electric potential energy, created by a difference of charge which acts like a form a pressure.  They travel through thousands of miles of copper, agitating the atoms along the way, generating heat and being radiated into space.

What energy survives this process is sent to its destination, guided by the electric potential created by the piezoelectric switch at the base of my water heater.  This potential is so great that the electrons are forced out of the conductor and into the air, jumping across the gap of the ignitor.  The kinetic energy of the electrons is high enough to raise the temperature above the flash point of the natural gas being passed through the same gap.  The energy is enough to break apart the 350 million year old methane molecules, which then mix with the oxygen, only present because life started releasing it into the atmosphere all those years ago.  The same life, amusingly enough, that created the methane in death.

This oxidization releases heat, which is transferred to the water through vigorous atomic collisions.  This hot water is then pumped through the house, driven by a pressure potential, to my shower, where it falls onto my skin.

The kinetic energy of the molecules is transferred to thermoreceptors in my skin, made possible by a 3-billion year battle between the Sun and entropy.  The energy is once again converted, this time used to create an electric potential on the thermoreceptor cell’s surface.  This induces an electrical potential cascade in my peripheral nerves, sending charge up my spinal cord, and into my thalamus, the switchboard of my brain.

My thalamus uses the energy conveyed from the electron flow to free proteins which bind with receptors in specific neurons, using the chemical potential energy to release acetylcholine into my bloodstream.  This activates the neurons of my cerebral cortex, again through a conversion from chemical potential energy to electrical potential energy.  This increase boosts my attention and that, combined with the increased blood flow caused by the vasodilatation induced by increased body temperature, gives me the idea to write this blog.


And then I had a cup of coffee…




Today, for some reason, the topic of magnets has come up several times.  I decided to take it as a sign (from the magnet aliens, perhaps) and write a bit about them.

Magnets are, indeed, magical.  The lodestone has been known for millennia, though how they actually work has only been able to be explained since the invention of quantum mechanics in the early 20th century.  The lodestone is an example of a ferromagnet, the prefix “ferro” stemming from the Latin word for iron, ferrum, since iron is abundant and the first natural magnets found, like this…

IMG_1788…are made of iron.   And when they were found, I’m sure minds were blown.  But how do they work?  By that, I mean, what is the origin of magnetism?  The answer…ATOMS!!!

A really simplistic view of an atom is the good old “solar system” model we all learned back in grade school.


You’ve got your nucleus chilling in the center and an electron cruising around along some path.  Electrons have charge and moving charge is what we call current.  Turns out that the flow of electrical current generates a magnetic field, a fact that my boy Hans Christian Ørstead accidentally found out in 1820.

Thanks, Wikipedia!
Thanks, Wikipedia!

He was running a lot of current through some wires, doing a completely unrelated thing.  Purely by coincidence, a magnetic compass happened to be sitting on the work bench near the wires.  He noticed that when the switch was flipped to let current run, the compass needle deflected.  That really started something because, until then, no one had ever thought that electricity and magnetism were related.  Guess what?!

Back to the atoms.  The electron cruising around can be thought of  kind of like a current running through a loop.  This creates a magnetic field that comes out of the loop, twists around, and goes back into the loop from the other side.



So, what we get is, basically, a little bar magnet, with a north and south pole.  The arrow represents something called the magnetic moment which is intimately related to a quantum mechanical concept called spin.  The magnetic moment points in the direction of the north pole of the magnet.  Now, in most materials, these little magnets are randomly aligned, like this…


But, in a ferromagnet, certain regions, called domains, have a collection of atoms that are all lined up.


When they’re randomized, the material on the macroscopic scale doesn’t appear magnetic, like copper or aluminum.  However, with ferromagnetic domains, the net magnetic moment of the atoms don’t cancel out and you get permanent magnet; on the macroscopic scale, the whole piece of material has a magnetic moment.

This isn’t the only way that magnetism manifests in material, though it is the most easily observable, so it’s the one we’re most familiar with.  Another common type is called antiferromagnetism.  An example of an antiferromagnetic material is common hematite.

IMG_6346In an antiferromagnet, there is no net magnetic moment because each atom is aligned such that it is opposite to its 4 nearest neighbors, like this…

IMG_5657Before you think, “well, who gives a crap about these” (if you’ve read this far, you do LOL), realize that the reading head in every hard drive…

Hard_disk_head…is an antiferromagnet.  Their structure is key to the process of reading information off of the magnetic platter, something called giant magnetoresistance , for which the Nobel Prize in physics was given out in 2007.  Go team!

The thing that makes both of these materials “do their thing”, as it were, is the idea of spin interaction.  We’ve all had the experience of setting two bar magnets next to each other.  We know that the opposite poles repel and the like poles attract.  Well, what happens if we put a bunch of them on a fixed lattice, like what you would have in a crystal of material?  What happens if you flip one of the magnets?  What do its neighbors do?  If you just assemble some atoms of, say, iron and let them sit for a while, what structure to they take?

It turns out, in physics we can write something called the Hamiltonian.  It represents the total energy of a system.  Nature, you see, is a miser and doesn’t want to use more energy than it needs to do anything.  So, things structure themselves over time to minimize this total amount of energy.  In the case of systems like ferromagnets and antiferromagnets, we can write the Hamiltonian like this (sorry for the math LOL)…

heisenbergWhat this means isn’t really important, other than the idea that you are adding up the energy for every single spin-spin interaction in the whole material…which is nuts!  The value of J is very important; this is called the interaction coupling constant.  It’s the only difference between a ferromagnet (J > 0) and an antiferromagnet (J < 0).  What the value of that is in a real material is dictated by the electronic structure of the atoms involved and various other things.  If you take some stuff, put it together and let if evolve over time, the spins will interact according to this rule until each atom is in the most energetically favorable configuration, a configuration called equilibrium.

One of the things that made me decide to write this post in the first place was the fact that I was tasked with writing a program that would simulate this interaction.  As you can imagine, simulating every single interaction of every atom in a material just isn’t possible.  So, the program I created makes a few concessions.

First off, I only deal with a lattice of atoms that is 50×50 (so 2500 atoms).  To put that in perspective, there are on the order of 10^23 atoms of iron in one gram (that piece of lodestone above is about 2.5 kilograms).  But, this small system’s behavior is indicative of a much larger system.  I’ll test that when I get a supercomputer…

Secondly, the program only considers interaction with the four nearest atoms, since they dominate the process.  In reality, the other atoms contribute as well, but the further away they are, the less influence they have, so we are safe to ignore them.  In physics, we call this first approximation.

Finally, the system is only two-dimensional.  Matter of fact, whoever figures out how to solve the three-dimensional system is totally winning a Nobel Prize.  That’s how it goes down in physics…turns out the universe is SUPER complicated LOL.

Here’s how it works.  First, it generates a random array of spins, like this.


Here, the red squares are spins pointing “up” and the black squares are spins pointing “down”.  The program then runs in a series of steps.  On each step, one of the 2500 atoms is randomly selected.  Then, the program makes the decision to flip it or not based on what is more energetically favorable given its neighbors configuration and it’s coupling constant.  The more energy it would take to flip a spin, the less likely it is to occur.

So, you give the program a value for that interaction constant J, let it go for a few hundred thousand step, and see how the system evolves.  If you let J be positive, then you have a ferromagnet.  After a buttload of steps (buttload = 100,000), that lattice of atoms turns into this…

FM_end They arrange themselves to the most stable state.  As you can see, those domains that I was talking about before readily form because that’s what the interaction constant dictates should happen.  This is the natural state for a ferromagnet!  Sweet!!

What about an anitferromagnet?  Well, we start with a random array again…

AFM_start…and let it arrange itself, this time letting that constant be negative.  That’s the ONLY difference between these two systems.  Do that, and you get this after a bunch of steps…

AFM_endOh SNAP!  Even this simple model (known as the 2D Ising model, btw) gives rise to the structures of both ferromagnets AND antiferromagnets as a natural progression that arises simply when you put these atoms together and let them do their thing.

For your amusement, I created two videos of these processes happening; they are linked below (as Quicktime files).  Not real great quality, but you get the idea.  They ping-pong back and forth, going from order to disorder.

Ferromagnet Ordering

Antiferromagnet Ordering

Indeed, if you started with an ordered system, like a magnetized piece of iron, and heated it up, it would break down like the video shows in reverse.  At low temperatures, the system orders itself, but at high temperatures, the energy being put into the system flips the spins and creates disorder.  If you put a bar magnet in the freezer, it will strengthen it.  Conversely, if you put it in boiling water, you will weaken it.

Different materials have different characteristic temperatures where the material changes from ordered to disordered; it turns our that iron’s is pretty high, which is why iron magnets are literally just lying around the surface of the Earth.

A completely trippy thing that you can try for yourself to in force this idea is listening to a bar magnet with a stethoscope.  The flipping of spins releases energy, which manifests as sound waves; if you listen to a bar magnet with a stethoscope, you will hear a kind of tinkling sound as the spins reorder themselves like the video show.

If you put these things IN a magnetic field, you influence the process.  Some of you may have wrapped a wire around a piece on metal, ran current through it, and magnetized the bar.  In that case, you are causing the magnetic moments of the atoms to align with the external field inside the coil of wire.  In a ferromagnet, the coupling constant says “that’s cool” and stays that after you remove the wire; that state has less energy.  If it’s a weakly magnetic material, the heat of the atmosphere will gradually cause chaos in the spin structure and cause the material to become demagnetized.

In a material like copper, the coupling constant is 0.  So, if you order them, they pretty much immediately become randomized again.  That’s why those materials can’t be permanent magnets.

That, in a nutshell, is how magnets work…well, the most common kinds, anyway.  Science rules.


Life of π

Seems that three months have passed since I last wrote anything about anything here.  Turns out that actually participating in science is a time consuming endeavor.  Actually, it’s been a little over 3 months…3.19 months, actually…which is pretty close to…

pi-300x300 copy

Today is also Pi Day in the United states, as well as Albert Einstein’s b-day, so the power of math compelled me to post something.

The question is, why do we even care about π?  Why are people across America eating a slice of banana cream pie right now to celebrate a number?  Do Americans really need ANOTHER reason to eat pie?  Consequently, Pi Day will fall on Wednesday in 2018, the day on which Village Inn offers free pie…imagine the anarchy that will ensue!

What is it about π that has interested people for millennia and given it almost mythical powers?

First off, where did the symbol π come from in the first place?  Previous to the year 1706, one had to be content to use the Latin phrase quantitas, in quam cum multiplicetur diameter, provenient circumferentia”, meaning “the quantity which, when the diameter is multiplied by it, gives the circumference”.  Clearly the essence of convenience.  Also, guess where all of our mathematical terms come from.

In 1706, my bro William Jones busted out the symbol for the first time in print, thereby relieving the hand cramping of his colleagues, choosing the symbol π (presumably) because it was the first letter of the Greek word περιφερεια, meaning “periphery”.

William Jones, Welch mathematician: Thanks Bro!
William Jones.  Thanks bro!

But what’s with the fascination over this particular ratio, the ratio of a circle’s circumference to its diameter?  Humans have long been enamored by numbers, giving symbolism to the digits 1 through 10 and various combinations thereof.  7 is lucky, 13 is unlucky, 1 represents the self, 2 represents unity with another, and so on.  Combine that mysticism with that which already existed with geometry for thousands of years and that gives some sense of the power π held over the ancients.

The Pythagoreans, pretty much the progenitors of the movement that lead to the Golden Age of Greek mathematics and cause of most middle-school student’s nightmares, believed that everything in the universe could be explained with number, specifically ratios of whole numbers.  They created a musical tuning such that all notes were related to each other by whole ratios, 2:1, 3:2, 4:3, and so on.  Everything divine in the universe could be expressed in this way.

The circle is, by most accounts, the simplest geometric figure you can create: a set of points all equidistant from some center point.  Pretty much the only things going on in a circle are the diameter and the circumference.  Needless to say, the ancients really wanted to find the magical ratio between the two.  They appear everywhere in Nature: all of the celestial bodies, bubbles, droplets of liquid.  What secrets could be unlocked finding this divine ratio?

The Greeks were like, well, ok, we can just  find the correct geometric construction and find it.  My bro Eudoxus came up with a pretty cool plan around 360 B.C. or so called the method of exhaustion.

Eudoxus.  Thanks bro!
Eudoxus. Thanks bro!

His plan was pretty simple, but ingenious.  Time to bust out my tools:


Now, back in the day, the Greeks didn’t have a ruler per se, merely an unmarked straight edge.  Deal with it.  First up, draw a circle:



Then, go about bisecting, drawing arcs and such…

IMG_1762 IMG_7329


…until you can inscribe a polygon inside your circle.  In my case, I inscribed a regular pentagon.


Then, using your inscribed polygon, bisect some more…



…and then create a circumscribed polygon around the circle.



Now, the perimeter of the inscribed shape is clearly less than that of the circle, while the perimeter of the outside shape is clearly greater than that of the circle.  If you find the perimeters of the two pentagons (30cm and 37.5cm, respectively) and then average them (yielding 33.75cm), you have a pretty good approximation of the perimeter of the circle.  Then you take the ratio of this average perimeter and the diameter of the circle (which is 10.6cm) and you get that π is about 3.1839 or so, not bad.  Give the polygons more sides and you get a better approximation.  Here, I’ve inscribed a hexagon and used it to construct a 24-sided polygon.


Turns out that the ratio of its perimeter to its radius is 3.1385.  Better…

One hundred years later, my bro Archimedes came up with a pretty crazy idea in his work The Method, was was lost until recently.

Archimedes.  Thanks bro!
Archimedes. Thanks bro!

He made the bold observation that if you give the polygon an infinite number of sides, it becomes the circle!  He drew some 96-gons (we run out of cool names pretty quick, not unlike with elements) , came up with some formulae to find their perimeter and nailed down π  to between 3 10/71 and 3 10/70, or between 3.1408 and 3.1428.  Nice work, Archimedes.  If you continued this infinitely, you would get the true value of π.

And then Greece declined, Rome showed up, and Europe in general just stared out the window into the rain catatonically for a millennium and a half.

Then, in 1761, my bro Johann Lambert showed up and proved that π was irrational, screwing up the party for everyone…sorry.

Johann Heinrich Lambert...thanks, bro...
Johann Heinrich Lambert…thanks, bro…

The fact that π is an irrational number means that it cannot be expressed as the ratio in any form.  It is a never-ending, never-repeating decimal number: 3.1415926…  The issue was that the ancients didn’t know this (well, a Pythagorean “discovered” the irrationality of the square root of 2, but he was promptly killed for heresy) and the search went on for centuries to find the pattern.

By the 16th century, algebraic geometry had taken over and people were looking for an equation that could yield the value of π.  That didn’t last long, because my bro Charles Hermite came up with a method, later used by Ferdinand von Lindemann, to prove that π is not just irrational, it’s transcendental, that is, there is no polynomial of which π is a root.

Charles Hermite.  He has clearly had enough of your π bullshit, Europe.
Charles Hermite.  He has clearly had enough of your π bullshit, Europe.

At this point, all we can do is approximate π with infinite series and such, which we do to further and further numbers of decimal places, secretly hoping that math is wrong and we’ll find a pattern.  Actually, it’s mainly to prove processing power, but whatever.  At this point, the world record is held by Shigeru Kondo, who calculated π to 5 trillion digits.


Shigeru Kondo.  Infinite digits?  Come at me, bro.
Shigeru Kondo. Infinite digits? Come at me, bro.

So, π is basically the white whale of mathematics, tying together a linage of mathematicians over almost three millennia trying to answer a simple question:  what do I get if I divide this by this?  Indeed, things in the world are not a simple as they seem…except for the carbohydrates in this yummy pie.