Wednesday, October 23, 2013

Tip o' the Lance

My weekend activities have provided me with ample blogging fodder of late. This past weekend I went to a local Renaissance Festival and, among other things, watched some real life jousting. That is, actual people got on actual horses and actually rammed lances into each other, sometimes with spectacular results.

I didn't take this picture. It's from the Renn Fest website. I just think my blog needs more visuals.
At one point a lance tip broke off on someone’s armor and went flying about 50 feet into the air. A friend wondered aloud what kind of force it would take to achieve that result, and here I am to do the math. This involves some physics from last year as well as much more complicated physics that I can’t do. You see, if a horse glided along the ground without intrinsic motive power, and were spherical, and of uniform density… but alas, horses are not cows.

Anywho, as to the flying lance tip, the physics is pretty easy. Now, I can’t say what force was acting on the lance. The difficulty is that, from a physics standpoint, the impact between the lance and the armor imparted momentum into the lance tip. Newton’s second law (in differential form) tells us that force is equal to the change in momentum over time. Thus, in order to calculate the force of the impact, I have to know how long the impact took. I could say it was a split second or an instant, but I’m looking for a little more precision than that.

Instead, however, I can tell you how much energy the lance tip had. It takes a certain amount of kinetic energy to fly 50 feet into the air. We’re gonna say the lance tip weighs 1 kg (probably an overestimate) and that it climbed 15 meters before falling down. In that case, our formula is e = mgh, where g is 9.8 m/s2 of gravitational acceleration, and we’re at about 150 joules of energy. This is roughly as much energy as a rifle bullet just exiting the muzzle. It also means the lance tip had an initial speed of about 17 m/s. I’m ignoring here, because I don’t have enough data, that the lance tip spun through the air—adding rotational energy to the mix—and that there was a sharp crack from the lance breaking—adding energy from sound.

But this doesn’t conclude our analysis. For starters, where did the 150 joules of energy come from? And is that all the energy of the impact? Let’s answer the second question first. Another pretty spectacular result of the jousting we witnessed was that one rider was unhorsed. We can model being unhorsed as moving at a certain speed and then having your speed brought to 0. Some googling tells me that a good estimate for the galloping speed of a horse is 10 m/s.

So the question is, how much work does it take to unhorse a knight? With armor, a knight probably weighs 100 kg. Traveling at 10 m/s, our kinetic energy formula tells us this knight possesses 5000 joules of energy, which means the impact must deliver 5000 joules of energy to stop the knight. This means there’s certainly enough energy to send a lance tip flying, and it also means that not all of the energy goes into the lance tip.

We can apply the same kinetic energy formula to our two horses, which each weigh about 1000 kg, and see that there’s something like 100 kj of energy between the two. Not all of that goes into the impact, however, because both horses keep going. This is where the horses not being idealized points hurts the analysis. Were that so, we might be able to tell how much energy is “absorbed” by the armor and lance.

There is one final piece of data we can look at. I estimate the list was 50 meters long. The knights met at the middle and, if they timed things properly, reached their maximum speeds at that point. Let’s also say that horses are mathematically simple and accelerate at a constant rate. One of the 4 basic kinematic equations tells us that vf2 = vi2 + 2ad. So this is 100 = 0 + 2*a*25, and solving for a gets us an acceleration of 2 m/s2. Newton’s second law, f=ma, means each horse was applying 2000 newtons of force to accelerate at that rate. 2000 N across 25 meters is 50,000 joules of work. It takes 5 seconds to accelerate to 10 m/s at 2 m/s2, so 50,000 joules / 5 seconds = 10,000 watts of power. What’s 10,000 watts? Well, let’s convert that to a more recognizable unit of measure. 10 kW comes out to about 13 horsepower, which is about 13 times as much power as a horse is supposed to have. Methinks James Watt has some explaining to do.

One other thought occurred to me during this analysis. Some googling tells me there are roughly 60 million horses in the world. If a horse can pump out 10 kW of energy, then we have roughly 600 GW of energy available from horses alone. Wikipedia says our average power consumption is 15 TW, which means the world’s horses running on treadmills could provide 4% of the energy requirements of the modern world. This isn’t strictly speaking true, because there will be losses due to entropy (and you can’t run a horse nonstop), but it’s in the right ballpark. Moral of the story? Don’t let anyone tell you that energy is scarce. The problem isn’t that there isn’t enough energy in the world; it’s that we don’t have the industry and infrastructure necessary to use all the energy at our disposal.

Friday, October 18, 2013

Salute Your Solution Space

Last weekend I went to an SF writing convention at which the esteemed George R. R. Martin himself was guest of honor. I had a good time, managed to snag an autograph, and even got conclusive proof that he is, in fact, working on The Winds of Winter. (He read 2 chapters.) So my blog post for today is inspired by the convention visit, but has nothing to do with science fiction, writing, or ASOIAF.

The most interesting panel at the convention, personally, wasn’t even a panel at all. It was a talk given by computer scientist Dr. Alice Armstrong on artificial intelligence and how to incorporate AI into stories without pissing off people like Dr. Alice Armstrong. It was an amusing and informative talk, although not as many people laughed at her jokes as should have. A couple points she made resonated particularly well with me, not because of my fiction, but because of my math courses the past two semesters.

Specifically, about a quarter of her talk was given over to the concept of genetic algorithms, in which a whole bunch of possible solutions to a problem are tested, mutated, combined, and tested again until a suitable solution is found. This is supposed to mirror the concept of biological evolution, however Dr. Armstrong pointed out numerous times that the similarities are, at this point, rather superficial.

But one thing she said is that genetic algorithms are essentially search engines. They go through an infinite landscape of possible solutions—the solution space—and come out with one that will work. This reminded me of a topic covered in linear algebra, and one we’re covering again from a different perspective in differential equations. The solution space in differential equations is a set of solutions arrived at by finding the eigenvectors of a system of linear differential equations.

Bluh, what? First, let’s talk about differential equations. Physics is rife with differential equations—equations that describe how systems change—because physics is all about motion. What kind of motion? Motion like, for example, a cat falling from up high. As we all know, cats tend to land on their feet. They start up high and maybe upside down, they twist around in the air, and by the time they reach the ground they’re feet down (unless buttered toast is involved).

If you could describe this mathematically, you’d need an equation that deals with lots of change, like, say, a differential equation. In fact, you might even need a system of differential equations, because you have to keep track of the cat’s shape, position, speed, and probably a few other variables.

Going back to linear algebra for a moment, you can perform some matrix operations on this system of differential equations to produce what are called eigenvectors. It’s not really important what eigenvectors are, except to know that they form the basis for the solution space.

To explain what a basis is, I’m going to steal from Dr. Armstrong for a moment. The example she gave of a genetic algorithm at work was one in which a “population” of cookie recipes are baked, and the more successful recipes pass on their “genes” to the next generation. A gene, in this sense, is the individual components of the recipe: sugar, flour, chocolate chips, etc.

You have some number of cups of sugar, add that onto some number of cups of flour, add that onto some number of cups of chocolate chips, and so on, and you have a cookie recipe. These linear combinations of ingredients—different numbers of cups—can be used to form a vast set of cookie recipes, a solution space of cookie recipes, if you will. So a basis is the core ingredients with which you can build an infinite variety of a particular item.

Let’s get back to our cat example. If you take a system of linear differential equations about falling cats and find their eigenvectors, then you will have a basis for the solution space of cat falling. That is, you will know an infinite number of ways that a cat can fall, given some initial conditions. But what ways of falling are better than others? That’s where genetic algorithms come in.

In our case, a genetic algorithm is what produced the cat righting reflex. You see, as we discovered, there are an infinite number of ways for a cat to fall. (While there are an infinite number of solutions, infinity is not everything. For example, there are an infinite number of numbers between 0 and 1, but the numbers between 0 and 1 are not all the numbers. Similarly, there are ways in which you can arrange the equations of cat falling that don’t produce meaningful results, like a cat falling up, so these aren’t a part of the infinite solution space.)

It would take a very long time to search through an infinite number of cat falling techniques to find the best one. Genetic algorithms, then, take a population of cats, have a lot of them fall, and see which ones fall better than others. This is, of course, natural selection. Now, you may think of evolution as a slow process, but it’s important to remember that this genetic algorithm is not just testing the fitness of cat falling, but of every other way in which a cat could possibly die. From that standpoint, evolution has done an absolutely remarkable job of creating an organism that can survive in a great many situations.

If you don’t believe me, consider that there is a Wikipedia page dedicated to the “falling cat problem” which, among other things, compares the mathematics of falling cats to the mathematics of quantum chromodynamics (which I don’t understand a lick of, btw).

Some of you may be wondering how what is essentially a search algorithm can be considered a form of “artificial intelligence.” Well, to answer that question, you have to give a good definition of what intelligence really is. But this blog post is probably long enough already, so I’m not going down that road. Consider for a moment, however, that there is a certain segment of the population that is absolutely convinced life originated via intelligent design. While their opinion on this matter is almost always bound up in belief, it’s not hard to look at nature and see something intelligent. If nothing else, nature produced humans, and it’s difficult to imagine any definition of intelligence that doesn’t include us (despite our occasional idiocy).

One final note: I lied in the beginning. I think Solution Space would make an excellent title for an SF story, so there’s your connection to science fiction and writing. And don’t steal my title, Mr. Martin.

Tuesday, October 8, 2013

The Wait

Due to fortuitous timing, my life is in somewhat of a holding pattern at the moment. There are three upcoming events that I can do nothing more than wait for. I will list them now in order of my increasing impotence to influence.

A week ago, I submitted a short story to a magazine. They say their average response time is five weeks, which means I have to wait another four weeks until they send me my rejection notice. With any luck, it will be a personal rejection.

This is the first story I’ve submitted for publication in several years. I think it’s probably the best thing I’ve ever written, and I know it’s decent enough to be published, but I shouldn’t fool myself into thinking that the first (or fifth, or tenth) publication I send it to will agree with me.

I was spurred into finally submitting a short story because a very good friend of mine just made her first sale. Unlike me, she’s been submitting non-stop for most of this year. Also unlike me, she’s been sending her stories to the myriad online magazines that have sprung up in recent years. I’ve sent my story, an 8,000-word behemoth, to the magazine for science fiction, because I have delusions of grandeur, apparently.

Moving on to the second item on my list, October is when I am supposed to hear back from the 4-year school I’m hoping to attend this coming spring. Their answer, unlike the magazine I’m submitting to, should be a positive one. Theoretically, I’m enrolled in a transfer program between my community college and the university that guarantees my admission so long as I keep my grades up and yada yada.

I’ve done all that, but I was still required to submit an application along with everyone else that wants to attend the school. And I’ve still been required to wait until now to receive word on my admission. All this waiting has me doubting how guaranteed my admission really is, but I’m still optimistic that the wait amounts to nothing more than a slow-moving bureaucracy. We’ll see.

Additionally, assuming I am admitted to the university, I then have to figure out how I’m paying for my schooling (community college is much cheaper) and how well my community college transcript transfers to my 4-year school. The hassle over figuring out what classes count as what could make for a whole other post. I haven’t decided yet whether I want to bore my three readers with the details.

And finally, as I hinted at in my last post, I’m a government contractor currently experiencing the joys of a government shutdown. So I’m waiting for our duly elected leaders to do their jobs and let me do my job. This is decidedly not a political blog, and I don’t want to get mired in partisan debates, but I have to say that I would much rather a system that doesn’t grind to a halt whenever opposing sides fail to reach an agreement.

There are a lot of theoretical alternatives to the system of representative democracy that we have, but I honestly don’t know enough about the subject to know which one would be better. Each system has pros and cons, and it is my limited understanding that no form of democracy is capable of perfectly representing the will of the people. If that’s the case, what hope is there for the future of civilization? Well, we can hope for an increasingly less imperfect future, I suppose. Or, to return to the SF side of things, we could just ask Hari Seldon to plan out the future for us.

The one political statement I’ll make here is that I never got over the wonder of Asimov’s psychohistory. I am a firm proponent of technocracy and the idea that, sometimes, it’s better to let experts make decisions about complex topics. Where I think democracy has its place is in ensuring that people are allowed to choose the type of society they want to live in. But if they really do want to live in society X, then they should let capable experts create society X first.

Okay, I think that’s enough pontificating for now. Is there some deeper connection between the three things I’m waiting for? Some thread that ties it all together? A concept from physics or mathematics that I can clumsily wield as an analogy? Nope. Sorry. Not this time.