Tuesday, July 21, 2015

The Engineer's trap

I'm smart, see? If I just sit down and think really hard, I'll derive the right answer.

This works, sometimes. For some people better than others. But, not always for anyone. In engineering (and many other disciplines), we can't predict the future. Sure, we can have very high confidence that a particular thing will work, functionally. However, we can't inherently predict human reaction. Will people like this interface? Will people enjoy this car design? Will people like having the cup holders in the doors? And so on.

There are an amazing number of smart people being held back by wasting time arguing over the unpredictable. At the core of this must be the desire to be right, to say "I called it!". But, getting things right is more likely through trial and iteration and being able to recognize failed attempts quickly (this is at the heart of the agile fail-fast engineering methodology).

Use your smarts. Apply them in areas where they are more reliable. Instead of foreseeing the future, spend your time thinking about how you know that you're right, or at least on the right track.

Sunday, July 12, 2015

2030: A mini ice age climate reprieve

Articles have been going around touting a possible "mini ice age" coming in 2030. The premise is that scientists have predicted a significant drop in "sun activity" (which I think means the number of spots, which are essentially tides of fire), leading to a condition known as the Maunder Minimum, which will therefore lead to significant drops of temperature on Earth, as evidenced by the rare freezing of the Thames river in the late 1600s which coincided with the last Maunder Minimum.

It doesn't help that news outlets are titling their articles with hyperbolae like "the sun will 'go to sleep' in 2030" or "the sun will become inactive" and so on. Climate skeptics have already rallied around this, pointing out things like "the Sun is also part of the climate" and "no wonder they renamed it from warming to change", and so on. Are they right? As usual, they are not.

For one, the freezing of the Thames river was a local condition. While it's true that didn't happen often and didn't happen again after, the flow of the river was altered (sped up) by the replacement of structures in the water about a century later. In other words, we removed the conditions under which the river could freeze. Summers were not any cooler (which we'd expect if the sun is emitting significantly less energy), nor were overall temperatures affected elsewhere in the world. Furthermore, the Maunder Minimum purportedly at fault started 50 years before the Thames froze. So, either it was unrelated, or it took 50 years for the effects to catch up. Either way, we're not gonna see an ice age in 2030 as a result of this.

Suppose for a second that global temperatures will drop significantly as a result of reduced sun activity. What then? if we continue to blanket the Earth in greenhouse gases, we'll roast that much more when the sun becomes "active" again. If we truly believe temperatures will drop, it's even more incentive to get our clean air acts together and use that as a boost towards mitigating climate change damage.

Whose baby is it?


Scenario:
Girl "G" has a brother "Br" who is married to a pregnant girl "PG". G's boyfriend "BF" hypothesizes that G's baby "Ba" was not produced by communion with Br, but rather with an unknown 3rd party, "P". To prove Ba's origin, BF would like to compare Ba's DNA with G's. What can we deduce?

 
Assumptions  **:
1. PG is not related to G, meaning they are no nearer than 6th cousins and can therefore be expected to share less DNA than, say, 4th cousins (chosen because there's a range of sharing published). Thus, PG and G have at most 0.5% common DNA
2. Br is related to G as full sibling and is therefore expected to share 50% DNA. The exact amount may vary significantly, but he should certainly be no further in sharing than a 1st cousin, whose low end of sharing is 7%.
** - reference: 23andme.com's table. Also pasted at the end of the entry.

 
So, what's in the baby?
If the baby is a product of Br and PG, we'd expect to see half each of 50% and less than 0.5%, which should yield something around 25% (also called out in the niece/nephew section). A lower bound can be established by using the 1st cousin range, from that we should see half each of 7% and 0.5%, for a total of ~4% shared DNA. Using the 1st cousin as a crosscheck (because they also have half a family tree that is totally unrelated) we should see no lower than 7% aggregate. The latter is the more correct number, really, because it's already tested for realistic distributions of gene passing.
 
If the baby is a product of P and PG, we'd expect to see half each of less than 0.5% each, for a total of less than 0.5% DNA sharing.

Interpreting the results:
If the sharing is:
1. Greater than 7%, it is highly probable that Br is the father. I think in practice this number would be quite a bit higher (we'd expect it to be around 25%, typically). The edge-case is if P is significantly related to Br, such as Br's parent, uncle, or even grandparent.
2. Less than 0.5%, it is highly probably that Br is not the father.
3. Between 0.5% and 7%, we have a curious case on our hands. Either P or PG are more related to Br than expected. Choice of options depends highly on state of residence.
 
 
 
 
 

Friday, July 3, 2015

Solar-powered flight

I just found out about the Solar Impulse project. It's a solar-powered plane, essentially the Tesla's brethren for the sky. Pretty cool stuff! The goal of the project is to demonstrate the viability of solar.

The last leg of the flight traveled from Japan to Hawaii, a distance of about 5000 miles. No stops, no fuel. Just sun. The plane has batteries to store energy for night flights. This is quite practical because the Japan-Hawaii leg took 5 days. Non-stop.

I think there are two major sets of reactions to this:
1. Holy shit, the future is here, and yeah it's slow now but tech gets better!!!
2. 5 days? Fuck that. Is Honey Boo Boo back on?

There's not much sense in talking to set 2 because they won't care about any of this until it's a real product they can buy. Group 1, however, is interesting to me because we can actually quantify what the concrete technical challenges are and assess the viability of overcoming them.

For viability purposes, let's say that a solar-powered craft would need to reach the same customer scenario as a current fuel-powered plane. That is, a cruising speed in the 530-580mph range and the ability to carry hundreds of passengers. How much energy does that take? I'll use the Boeing 787 as my example since it's the most modern fuel-efficient passenger plane. Looking at the 787-9 specifications, we see that it can transport 408 passengers a distance of 9550 miles using 33384 gallons of fuel at a speed of 567mph. We also should know how much energy is stored in a gallon of fuel. Using the two listed options for "jet fuel", I've opted to just call it 120kBTU per gallon.

Time of travel = 9550 miles / 567 mph = 16.8 hours = ~6E4 seconds.
Energy used = 33384 gallons * 120kBTU per gallon * 1055 J per BTU = ~4.2E12 J
Power = 4.2E12 J / 6E4 s = 7E7 J/s = 70 MW.

How much surface area is needed to collect 70MW? In a sunny place like Tucson, AZ, peak solar energy (mid-day) reaches 1000-1100 watts per square meter. A more realistic average over the Earth, over 24 hours, is 164 watts. We can adjust this for daytime averages by doubling it since the night portion contributes practically zero to this aggregate. So, let's say a typical daytime produces 325 watts, with shorter term highs around 1000W. This gives us a factor of 3 bounding, which should be adequate for this study. It's also important to point out that, per the same source, only 8% of solar energy is reflected back to space by the atmosphere, meaning that going higher up doesn't appreciably increase the available solar power.

Based on the range of incoming solar rates and the power requirements, it would take about 70,000 - 200,000 square meters of cells, operating at perfect efficiency. To put this in perspective, a football field is just shy of 5000 square meters. In other words, even on a bright bright day, it would take wings the size of 7 football fields. And for the average day we're looking at about 20 fields each. This seems intractable, even with "improving tech". The biggest improvement is probably the efficiency of the solar cells, and we've already allowed for that.

The other way to slice this is to look at the per-pound requirements and see how much we win by reducing airplane weight.

Power per pound = 70MW / 557k lbs ~= 125 W per pound.

In other words, I could, in an ideal world, attach a newborn to a square meter cell and send them flying around Arizona. Scaling this up to a typical adult requires some assumptions about their size and luggage and stuff, but let's call it 200 pounds. I'm being optimistic about human sizes by the time this hypothetical solar future arrives. The incremental solar area to carry a human is therefore 25-70 square meters. That's about the size of a one-bedroom apartment. The real lesson here is that we can potentially gain a lot by reducing airplane weight. First, we no longer need to carry 25000 lbs of fuel. However, we do need to carry batteries. Let's say, for the sake of the optimistic argument, that we can make the batteries arbitrarily small. We may also be able to make the wings lighter since they no longer need to support all that fuel. Not sure what kinds of savings that gets us. I'm also not sure if we can significantly reduce the weight of the fuselage. So, not much savings there on a 500,000 pound plane.

For the sake of the absolutely optimistic argument, suppose we can make the weight of the airplane zero. To transport 400 typical adults and bags, we'd need around 10-30,000 square meters of wing. That's 1-3 football fields each. And remember, they have to be perfectly efficient. And weigh nothing. And the passengers are sitting inside an ideal, weightless bubble.

Overall, the idea of solar for mass air travel seems far-fetched, simply because the energy density of solar is not high enough.






 

Monday, June 29, 2015

Hypocrisy, right?

The law gives me the right to deny the right given to them by law.

In the wake of the marriage equality ruling, a number of cases are popping up where Christians are insisting they can continue denying this right. For example, the Attorney General of Texas is stating that licenses can be denied if the state worker disagrees with gay marriage. First off, this is bullshit. You are an employee of the state and you shall give access to state benefits/rights equally. Second, the freedom you claim to be exercising is coming from the exact same set of laws. Therefore, your stance is not more justified. Third, the religious freedom you are using the justify your dissent has no place in official business, because that same law said so.

That is all. There's nothing more to say here.

Saturday, June 20, 2015

Focus on the edge-case

I find at work that people often get really worried about the super uncommon scenarios and how we'll address those. While it's fine to think about those things, they should not supplant addressing the common scenarios. Let's apply this same approach to a topic at the top of mind for many: gun violence.

For the purposes of this discussion, I'll look just at gun deaths (somewhat arbitrary: easier to get stats, and let's assume it's a reasonable proxy for injuries as well). In a given year, roughly 30-35,000 people are killed by a gun in the USA. This breaks down in some perhaps unexpected ways:

More than 20,000 are suicides.
Around 9-11,000 of those are murders.
There are about 500 accidental deaths.
And of the murders, between 100 and 200 are the result of mass shooting.

While it's understandable that mass shootings get all the press (especially when the gun debate is so prominent in popular culture and mass shootings will generate media clicks), they make up the absolute edge-case of the gun scenarios. However, it seems to be used as the basis for the "good guys with guns" and "more guns" narrative. We should first solve the bigger buckets before we worry about the mass shootings. While no one wants to be a statistic, at a population level we must focus on statistics to drive broader policy.

The biggest bucket, by a factor of two, is suicides. It's also a hard one to address. Guns account for right about half of all suicides. Would removing guns actually eliminate those suicides, or would people just find other ways? The two next most common methods are suffocation (~25%) and poisoning (~15%). I don't know the mentality of someone who is considering taking their life, but I suspect that a meaningful subset of suicide by gun are people making rash decisions in desperate situations. In other words, I'd expect that eliminating guns would cut down on this number, but certainly would not eliminate all the suicides that are currently committed using guns. Anecdotally, we should not expect to see a major difference by simply eliminating guns since other comparable countries (ex: European) with heavily restricted guns have similar suicide rates per population. However, even a moderate drop of, say, 1-2 per 100,000 (out of ~13 now) would eliminate 3-6000 deaths. I use this number as an example because a number of "similar" countries are about that much lower. It appears that mental health support and cultural changes would be the best candidates here, though again, I'm not an expert other than to say access to guns is likely not the biggest way to address this.

The next largest bucket, of course, is murders. I've speculated at the effect of the presence of lots of guns (that it leads to lots of murders), and absolutely believe that removing them from the equation will have a profound downward effect in murder rate. The short of it is that, using Australia and UK as controls, removing guns from the population does not lead to murders being replaced with other implements, it simply leads to those murders not happening. Since roughly 3 out of every 4 murders in the USA are committed with a firearm, that's roughly 3 out of 4 murders that could be eliminated.

Eliminating guns from the general population would also lead to a sharp decline (realistically not complete, but pretty close) in accidental gun deaths. Pretty simple.

And last, come the mass shootings. We're now down to a cause of death whose frequency is within a factor of two of lightning strike deaths. We're having a national policy debate centered around a scenario that's, as far as people conceive, an absolute rarity. This does not make sense. The argument tends to go something like "The bad people will get guns. They know to go to places where guns aren't allowed. Easy targets. Let's take away those targets by adding more guns!". Again, let's add guns EVERYWHERE because lightning strikes.

I would also suggest that eliminating general access to guns would serve to reduce the number of guns in clearly unstable people's hands, simply because not all of them will be capable of navigating a black market for a weapon (they're usually mentally off, remember). But sure, some (maybe most) will still get a weapon. In a world where a citizen can't openly own a gun, they also can't effectively train with that gun. Their proficiency in killing people can only go down for when they do snap and attack a school. Making guns illegal gives law enforcement more time to catch up to illegal weapons because simply owning one is now illegal. It could be discovered in some other way before it's put to bad use, and removed from the system. While guns are so broadly legal, the only place where law enforcement can interject is in the last stage when the mass shooter starts actually shooting. In other words, it is currently totally legal to perform all the preparations for a mass shooting. In my opinion, there's absolutely no way more damage could be done by mass shooters if guns were broadly illegal. I'd even suggest that the simple act of holding the gun and firing it at the range could fuel the mass shooting fantasy for someone who'd be prone to actually going through with it. If we remove some of those factors, a shooter may never even develop the clear desire to go on a shooting rampage.

In other words, the main scenarios clearly point to reducing guns. And as icing, even the edge-case justifies no other choice than reducing access to guns.



 

Guns are bad, mmkay?

After Sandy Hook I started reading up on gun and murder stats and one very interesting thing jumped out at me while looking at 3 countries that I'd otherwise consider culturally similar. The murder rate in the USA is far higher than in the UK or Australia. The latter two have heavily regulated (minimal) gun ownership, have significantly fewer murders, and the number of murders with guns is almost exactly the difference. In other words, remove the guns, remove the murders. Furthermore, Australia was once very loose with guns (similar to the USA) and then moved to heavy regulation.

Let's start with the intentional homicide rate by country per 100,000 population:
United States: 4.7
Australia: 1.1
United Kingdom: 1.0

Now, let's look at the intentional homicide rate by gun in each country:
United States: 3.6
Australia: 0.1
United Kingdom: 0.04

If we combine these and make a little table, we get:
CountryOverall murder rateGun murder rateNon-gun murder rate
United States4.73.61.1
Australia1.10.11.0
United Kingdom1.00.041.0

The difference disappears, like magic!

A quick search on the effect of Australia's tightening and gun buyback in 1996-7 seem debated (though even basic facts are "debated" on the internet), but per official records, the percent of murders committed by guns is dropping at a decent rate. Granted, it had started dropping well before 1996 (from a peak around 1980). Probably need to do more careful analysis here, but the bottom line is that introducing gun legislation did not lead to a collapse of society or out-of-control murders against the unprotected populace.