Sunday, July 17, 2016

Fun with numbers while walking

Walk in San Francisco, July 16, 2016


Yesterday I went for a walk in San Francisco. To pass the time and keep my mind off the Pokemon Go players making pedestrian traffic in Golden Gate Park hazardous, I decided to do a few approximate calculations about jet engines.

Let's say a jet engine used as a gas generator produces 22 000Lbs (= 10 000 kgf or 100 000 Newton, approximately) of thrust at a nozzle velocity of 720 km/h. How much air is it moving?

To generate thrust, a mass $m$ of air is accelerated from zero to 720 km/h (200 m/s) per second. The thrust is given by $F= ma$, so the flow, or mass/second, is 100 000/200 or 500kg/s. Since air density is about 1g/l at ground level, we need 500 cubic meters of air to go through the engine per second. That's the volume of a large room (20 by 10 meters surface, 2.5 meters ceiling) per second.

Just for fun, how much power is the engine generating? Considering only the kinetic energy imparted to the air (per second, since we're interested in power), we have $1/2 \times 500 \times (200)^2$, or 10  MW. Of course, since the air is very hot, some more power could be recovered using heat exchangers on the power turbine exhaust gases (making it a Brayton-Rankine combined cycle power plant).

Since a gas generator has an efficiency of around 1/3, this turbine will need about 30 megajoule of chemical energy per second entering the combustors, or about one liter of jet fuel every 1.2 seconds. (Looked up jet fuel energy density on my phone while walking --- ain’t living in the future grand? In the past I'd have to look that up in Perry's or Marks'.)

Yes, the numbers are very rough approximations; that's what you do when walking around. I also picked numbers that would be easy to divide in my head. Remember, I had to avoid Pokemon Go players who kept moving in unpredictable patterns in my path:

Walk in San Francisco, July 16, 2016



Edited (about 30 minutes after posting): During my walk I incorrectly computed the power as 1 MW instead of 10 MW, basically because keeping a lot of zeros in your head while avoiding the Pokemaniacs is difficult. The original post used that value; while rereading it after posting, I realized my order-of magnitude error and corrected it and the fuel calculation.

Sunday, July 10, 2016

Two lessons from a simple puzzle

Suppose you're given a set of fifteen integers for a puzzle:

$A = \{ 1, 3, 7, 11, 19, 23, 35, 37, 41, 43, 57, 59, 61, 67, 71\}.$

The puzzle is to add six of these numbers to make up $101$.

Take a moment to try to solve it.

Ready to proceed?

Before we get to the puzzle, one of the people along the chain that brought me this puzzle said that there were "hundreds of combinations."

True. There are indeed fifty "hundred combinations" (plus five), since $\left(15 \atop 6\right) = 5005$.

Apparently a number of children and adults had been searching for the solution and someone thought that writing a search program would be a good idea; they didn't know how to do it, though, since none of them were programmers. Personally, I'd do it in Prolog, since tree searches are so easy to program in it.

Except...

Except that all the numbers in $A$ are odd, as is $101$. And a sum of six odd numbers is necessarily an even number. The problem has no solution.
PROOF: Each number we pick, $n_i \in A$, is odd so it can be written as $n_i = 2 \times k_i +1$ for $k_i$ integer; adding six of them yields 
$2\times (k_1 + k_2 + k_3+ k_4+ k_5+ k_6) + 6$, 
which is even for any $k_i$.
Some of the adults involved were primary school teachers. Who teach basic arithmetic. And apparently not one of them abstracted from the numbers long enough to see that the problem was impossible. I'm told some of them didn't want to believe there was no solution.

So, here are two lessons from this simple puzzle:

1. Understanding beats blind search.

2. Statements of "impossible" require a proof.

Thursday, June 30, 2016

Some thoughts on exercise


(Based on a twitterhea that started after I came back from the gym today. I'm still recuperating from a long trip and a upper respiratory infection from the return flight.)

Strength training

If I could only do one strength exercise, that would be the deadlift, possibly with a trapezoid ("hex") bar. Interestingly, if I could only do two exercises, those would be squat & pulldown, so there's no nesting of the exercise sets. Actually the topology becomes ever more complex: three exercises would be squat, pulldown, incl. press; four exercises would be squat, pulldown, flat bench press, military ("shoulder") press. Past that, the topology becomes more workable, with five exercises adding back the deadlift and six adding horizontal row.

An alternative topology, recognizing the importance of deadlifts:

(Yes, military "shoulder" press ahead of [flat] bench press; much more useful for life, plus pecs get worked on pulldowns.)

In reality, I do all six exercises (and a few more strength exercises) in a standard three-split powerlifting program (Monday: squat; Wednesday: bench; Friday: deadlift).

I seldom do any biceps or triceps work, as I find the upper arm gets enough exercise from the compound movements. Once a month or so, if I'm not too tired on a bench press day I might do three sets of standing curls superset with three sets of rope press-downs; but seldom more than once a month, and my arms aren't exactly skinny.



Accessory work

(Understood as accessory beyond the accessory work for the powerlifting lifts.)

Core: a lot of people worry about having "six-pack" abs; I train the core for strength, because it's a big deal in stabilizing movement and maintaining spinal health. I do a variety of exercises for the abs, obliques, and transverses, all under load. Unlike most gym-goers I understand that what makes for pretty six-packs is lack of fat, while what makes for good spine stability is strong muscles.

Specific posterior chain exercises: yes, the deadlift works the posterior chain, no kidding. But since standing up straight is somewhat important, I do a lot of other exercises targeting parts of the posterior chain beyond the glutes, particularly the various spinal extensors.

Neck (yes, I know it's in the posterior chain, at least the extensors): hey it's no big deal; it just HOLDS THE HEAD. Maybe gymbros could cut two or three of the hundred sets of standing curls they do per workout to strengthen the muscles that HOLD THEIR HEADS. Then again, perhaps they understand that there's nothing valuable there. Extension (with load), rotation, flexion (with load), plus careful mobilization.

Wrist: bodybuilders do do some wrist work, as their forearms are visible outside of a t-shirt, but they do it for show. I do wrist work because it protects the movement of the hands, which is kind of important for life. Wrist curls, reverse wrist curls, internal and external rotation with load.

Grip: I have a gripper, I use it. Short of a Hammer Strength grip machine (few gyms have those and even fewer the MedX equivalent), best thing for developing grip strength. No point in having upper body strength if the grip can't hold the load (bodybuilding bros say "strength? it's all about size, bro"), like having a very powerful engine in a car with bad tyres.

Rotator cuff: another area that needs to be protected against damage; I do a variety of low load movements of all the rotations of the rotator cuff, then train the two main movements (rotate forward, rotate backward) with standard strength training programming.



Conditioning

I'm a big fan of sled pushing and heavy farmer's walks, but mostly I end up doing treadmill intervals, hill sprints, or stairway sprints as that's what's available. I've tried to do farmer's walks with heavy dumbbells in commercial gyms, but unless the gym is almost empty, it's futile and garners strange looks from the know-nothings that mostly populate those gyms.*

In the past I have run mid-to-long distance, but that was in an age of ignorance. Quite a lot of information has come to light about the superiority (not equivalence, superiority) of high-intensity interval training over long low-intensity "cardio" for conditioning purposes.

Thinking about functional value of this conditioning training, it really matches real-life needs more than any long low-intensity training: usually if there's any running to be done (for example), it's a short burst of high speed.

I do a number of other activities that look like exercise but aren't:

Rowing is a hobby and I prefer to do it on the water. It's a very calming activity, considering how it's basically 15 to 20 explosive movements per minute. Even on a Concept II, the movement is very calming. It's basically yoga --- at 15-20 explosive movements per minute. If I'm doing it on a machine, I might listen to audiobooks: multitasking of the kind that works, unlike multitasking attention.**

Walking is what I do to clear my mind. I like to take long walks to think; it's an habit I cultivate that most people abhor (thinking, not walking; ok, most people abhor walking as well, but mostly they avoid, abjure, and detest having to think). When I say "long" I mean 25-50km long. This has led to some complaints from friends whose idea of long is "ten minutes" rather than "fifteen hours."

Working, reading, studying, watching lectures or other educational videos on "cardio" machines, typically the elliptical, treadmill, or stationary cycle. Since I have a gym in my building, and these machines tend to be available during my work hours, I can simply translate "sitting" into "slow moving" and get some advantageous oxygenation during the intellectual work. I don't count these as exercise because they don't get anywhere near the level of intensity that would create the need for the body to adapt, i.e. to gain any new capabilities.



Mobility

A lot of strength athletes pay lip service to mobility, but not more than that. I did that too when I was young and foolish.

Now in my early middle age (ahem...), I find that the ability to reach and stretch is kind of important so I've been spending more and more time making sure that I get as much range of motion as possible, both in the gym (before and after working out) and several times a week outside of the gym.



And an inexplicable phenomenon...

Something that happens at some commercial gyms has been puzzling me: I finish my workout (warm-up, strength training, accessory work, mobility) and do a short cool-down on a treadmill or elliptical, walking slowly... and get the evil eye from the people on the machines next to me.

I can't explain it; I've surmised that these people's entire workout is 20-30 minutes of slow walking (sometimes slower than my own cool-down) on these machines, while I do my 15-20 minutes at the end of 90-120 minutes or more of moving metal (sometimes, a lot of metal), so there may be some divergence of the minds there.

Oh, on an unrelated note, I tend to switch the TV in front on my machine to FoodTV or the Travel network (if there's a food show on it) during the cool-down; I like food and food shows. I notice that no one else seems to be watching that channel, although they all appear to like food a whole lot.

Strange.


-- -- -- --

* Also, farmer's walks with dumbbells are dangerous: while it's difficult to get your feet under a standard farmer's walk rig without doing it on purpose, it's a law of Physics that a dropped dumbbell will always hit your foot edge on. Check it.

** I end up doing a lot of rowing on machines because going to the Berkeley Lagoon is a schlep and then I have to pay a rental fee for a shell (I'm not a member of the rowing club). Since I have my own Concept IIc at home, I tend to use that.

The 15-20 strokes/minute rhythm is because I'm short but with a heavy torso (long torso to begin with, and powerlifting muscles weigh a lot), so I need a very slow return not to lose speed on the water due to my own inertia.

(I could row much faster on a machine, of course, but that would create bad habits for the water. On a related note, the way most gym goers – especially those who do something that rhymes with Fosscrit – row on the machines is hilarious: on the water they wouldn't move at all.)

Friday, June 17, 2016

More fun with people who "love" science

"How many Joule in a kilowatt-hour?"

This is not a trick question. It's a trivially simple question, that requires a middle-school undestanding of science. Yet, someone whom I'll call Igor (for Ignorant Grandstanding Oblivious Rabble-rouser):

a) Had no idea what I was talking about;

b) Didn't think there was any relation between my question and Igor's topic of "energy";

c) Didn't realize that Igor's ignorance of basic units of energy undermined Igor's credibility as a source of information on "energy"; and

d) Wasn't deterred from continuing a long Jeremiad about the "good" types of "energy" and the "bad" types of energy.

(One Watt equals one Joule per second, so one kWh is 3.6 million Joule. I knew this before I was 10, since I was a science geek even then, but it's taught in middle school where I come from.)

Having worked in education for a while (on and off), I've seen many cases where people don't learn, forget what they learned, and forget that there's something to be learned. But Igor is different.

Igor thinks that learning is unnecessary, because Igor already knows. Igor knows because... well, because all Igor's life, Igor was never contradicted as long as Igor's words fit the prevailing narrative. Igor's self-esteem ballooned like a spinaker in strong wind, and never deflated. Igor's education avoided science, where Igor might occasionally be wrong, so Igor never learned the most important lesson:

Reality always wins in the end.

Wednesday, March 30, 2016

Three cardinal sins of presenting

Observations from yet another terrible talk.

(To protect the guilty, the presenter will be called "Epic," short for "Epic Fail II," and without loss of generality will be referred to with masculine pronouns.)

Epic committed three cardinal sins of presentations (there are more than three and some of the others were present in the terrible talk), in increasing order of badness:


The sin of humming: 

"Hum... like... basically..." were Epic's most common words. Or sounds, more precisely, because that's what they are. Sounds that Epic made as his brain composed the sentence that was to come.

This is the main problem of using slides-as-presenter-notes, though it also happens to presenters who have separate "talk skeleton" notes and don't rehearse a few times: bullet points aren't feasible out-loud sentences, so, to unprepared presenters, they act as stumbling blocks rather than helpful hints.

Some people are very articulate; some can be articulate from notes; most of the others need to do at least one run-through of the notes, preferably to camera so they can review it. The camera is essential, as without feedback there's little improvement.

Humming is a sign the presenter didn't care enough for the audience to rehearse his presentation.


The sin of non-preparedness:

Like most presenters, Epic seems to have created his presentation in a small fraction of the presentation time. That's usually a recipe for disaster. While some people can make good presentations impromptu or quasi-impromptu, most presenters should prepare carefully.

Epic's presentation had no clear objectives, no clear structure, and above all, no clear arguments. For comparison, there was another presenter at the conference who, in order to explain a programming philosophy created a motivating example based on refactoring a cookbook.

The procedure for preparing isn't complicated: decide what the presentation objectives are; decide how they sequence into each other; devise ways to explain these objectives; assemble the presentation; rehearse.

Epic skipped all these stages, except the assembling of the presentation as a sequence of presenter-notes-on-slides, but without actually thinking much about what each point. Epic didn't think about the phrasing of the points (see previous sin), let alone consider how to best explain them to the audience.

Good presentations begin in the preparation; bad presentations in the lack of it.


The sin of self-absorption:

The audience was promised, and therefore expected, a technical talk about a technical tool. Epic delivered a presentation about Epic: Epic's education (really, a CV slide and multiple name-drops to Epic's school, Epic's degree, Epic's degree advisor); Epic's actions ("I did this," "I found that" not "data show" or "tool does this"); Epic's performance on Epic's job (via repeated references to a sort of limited field contests/competitions, to which the audience groan was the only appropriate answer).

Two other presenters in the same session described highly technical tools, barely ever using the first person, talking about the tools, offering interesting if technically challenging knowledge. That's because, unlike Epic, they understood that the audience wasn't there to learn about the presenters' lives, but rather about the tools.

Epic, like many terrible presenters, bought into the idea that every presentation has to be a story (more or less right, even for a technical audience) about the presenter (absolutely wrong, unless you're presenting an autobiography).

Audiences don't like bait-and-switch: deliver what was promised, not what you like.


Many talks are bad, and that's a choice made by the presenter.

Saturday, March 12, 2016

Read before writing


A quick refresher this morning before tackling a writing task in the afternoon.

A quick read of my notes on these two books always helps focus my attention for any writing task.

I make a point of re-reading Zinsser's book in its entirety at least once a year. It takes but a couple of hours, best 'writing skills preventative maintenance' I can think of. It's also worth re-reading my notes prior to any major writing task, which is why I'm doing it today. I think of it as 'pre-flighting my writing skills'.

Before any major writing task, I go over Strunk & White's rules so that they're fresh in my mind as I write. That helps cut down on editing time later.

-- -- -- --

For the terminally lazy: Amazon links to On Writing Well and The Elements Of Style. (I would make them affiliate links, but I too am lazy.)

Saturday, March 5, 2016

Powerlifters vs Gym Rats - A tale of two means

In my last post I wrote:

For example, some time ago I had a discussion with a friend about strength training. The gist of it was that powerlifters are typically much stronger than the average athlete, but they are also much fewer; because of that, in a typical gym the strongest athlete might not be a powerlifter, but as we get into regional competitions and national competitions, the winner is going to be a powerlifter.

And the explanation, which the friend didn't understand, was "because on the upper tail the difference between means is going to dominate the difference in sizes of the population."

So here's an illustration of what I meant, with pictures and numbers and bad jokes.

First let's make the setup explicit. That's the great power of math and numerical examples, making things explicit. "Powerlifters are typically much stronger than the average athlete" will be operationalized with four assumptions:
A1: There's some composite metric of strength, call it $S$ that we care about and we'll normalize it so that the average gym rat has a mean $\mu(S_{\mathrm{GR}})$ of zero and a variance of $1$. 
A2: The distribution of strength within the population of gym rats is Normally distributed. 
A3: The distribution of strength in the sub-population of powerlifters is also Normally distributed. 
A4: For illustration purposes only, we will assume that powerlifters have a mean $\mu(S_{\mathrm{PL}})$ of 2 and the same variance as the rest of the gym rats.
We operationalize "they are also much fewer" with
A5: For illustration, the number of powerlifters is $1\%$ of gym rats.
(Powerlifters are gym rats, so the distribution for $S_{\mathrm{GR}}$ includes these $1\%$, balanced by CrossFit people, who bring down the mean strength and IQ in the gym while raising the insurance premiums. Watch Elgintensity to understand.)

The following figure shows the distributions:




When we look at the people in a gym with above-average strength, that is people with $S_{\mathrm{GR}}>0$, we find that one-half of all gym rats have that, and $98
\%$ of all powerlifters have that: $\Pr(S_{\mathrm{GR}}>0) = 0.5$ and $\Pr(S_{\mathrm{PL}}>0) = 0.98$. This is illustrated in the next figure:



Powerlifters are over-represented in the above-average strength, approximately twice as much as in the general population, but they are only about $2\%$ of the total, as their over-representation is multiplied by $1\%$.

As we become more selective, the over-representation goes up. For athletes that are at least one standard deviation above the mean, we have:



with $\Pr(S_{\mathrm{GR}}>1) = 0.16$ and $\Pr(S_{\mathrm{PL}}>1) = 0.84$. Powerlifters are over-represented 5-fold, so about $5\%$ of the total athletes in this category.

When we become more and more selective, for example when we compute the number of gym rats that have at least as much strength as the average powerlifter, $\Pr(S_{\mathrm{GR}}>2)$, we get



with $\Pr(S_{\mathrm{GR}}>2) = 0.023$ and $\Pr(S_{\mathrm{PL}}>2) = 0.5$, a 22-fold over-representation, meaning that of every six athletes in this category, one is a powerlifter. (Yes, one out of six, not one out of five. See if you can figure out why; if not, look at the solution for $S>6$ below and you'll understand. Or not, but that's a different problem.)

And as we look at subsets of stronger and stronger athletes, the over-representation of powerlifters becomes higher and higher: $\Pr(S_{\mathrm{GR}}>3) = 0.00135$ and $\Pr(S_{\mathrm{PL}}>3) = 0.159$, $118$-fold ratio. There will be a few more powerlifters in this group that other gym rats; another way to say that is that powerlifters will be a little bit more than one-half of all gym rats that are at least one standard deviation stronger than the average powerlifter.

The ratios grow exponentially with increasing values for strength (the rare correct use of "exponentially" as they are ratios of Normal distribution tail probabilities; see below).

For $S>4$ the ratio is $718$, for $S>5$ the ratio is $4700$, for $S>6$ the ratio is $32 100$, in other words, there will be one non-powerlifter per group of $322$ gym rats with strength greater than 6 standard deviations above the mean of all gym rats.

This is what the effect of the differences in the tails of Normals always implies: eventually the small size of the better population (powerlifters) will be irrelevant as the higher mean will dominate.

See? That wasn't complicated at all.

-- -- -- --

For the mathematically inclined (strangely themselves over-represented in the set of powerlifters...)

Note that the ratio of probability density functions for the two Normal distributions in the post, for realizations of strength $S = x$ is
\[
\frac{f_{S}(x|\mu_{S}=2)}{f_{S}(x|\mu_{S}=0)}= \frac{e^{-(x-2)^2/2}}{e^{-x^2/2}}= e^{2x-2}
\]
which grows unbounded with $x$; no matter how small the fraction of powerlifters, say $\epsilon$, there's always a minimal $\bar S$ beyond which that ratio becomes greater than $1/\epsilon$ Which means that at some point above $\bar S$ the ratio of the remaining tail itself becomes greater than $1/\epsilon$. (It's very easy to calculate $\bar S$ and I have done so; I'll leave it as an exercise for the dedicated reader...)

Oh, that's the rare occurrence of the correct use of "exponentially," which is usually incorrectly treated as a synonym for "convex."