## Tuesday, August 30, 2016

### Some thoughts on quant interviews

Being a curmudgeonly quant, I started reacting to people who "love" science and math with simple Post-It questions like this:

(This is not a gotcha question, all you need is to apply Pythagorean theorem twice. I even picked numbers that work out well. Yes, $9 \sqrt{2}$ is a number that works out well.)

Which reminds me of quant interviews and their shortcomings.

I already wrote about what I think is the most important problem in quantitative thinking for the general public, in Innumeracy, Acalculia, or Numerophobia, which was inspired by this Sprezzaturian's post (Sprezzaturian was writing about quant interviews).

In search of quants

That was for the general public. This post is specifically about interviewing to determine quality of quantitative thinking. Which is more than just mathematical and statistical knowledge.

One way to test mathematical knowledge is to ask the same type of questions one gets in an exam, such as:

$\qquad$ Compute $\frac{\partial }{\partial x} \frac{\partial }{\partial y} \frac{2 \sin(x) - 3 \sin(y)}{\sin(x)\sin(y)}$.

Having interacted with self-appointed "analytics experts" who had trouble with basic calculus (sometimes even basic algebra), this kind of test sounds very appealing at first. But its focus in on the wrong side of the skill set.

Physicist Eric Mazur has the best example of the disconnect between being able to answer a technical question and understanding the material:

TL; DR: students can't apply Newton's third law of motion (for every action there's an equal and opposite reaction) to a simple problem (car collision), though they can all recite that selfsame third law. I wrote a post about this before.

Testing what matters

Knowledge tests should at the very least be complemented with (if not superseded by) "facility with quantitative thinking"-type questions. For example, let's say Bob is interviewing for a job and is given the following graph (and formula):

Nina, the interviewer, asks Bob to explain what the formula means and to grok the parameters.

Bob Who Recites Knowledge will say something like "it's a sine with argument $2 \pi \rho x$ multiplied by an exponential of $- \kappa x$; if you give me the data points I can use Excel Solver to fit a model to get estimates of $\rho$ and $\kappa$."

Bob Who Understands will start by calling the graph what it is: a dampened oscillation over $x$. Treating $x$ as time for exposition purposes, that makes $\rho$ a frequency in Hertz and $\kappa$ the dampening factor.

Next, Bob Who Understands says that there appear to be 5 1/4 cycles between 0 and 1, so $\hat \rho = 5.25$. Estimating $\kappa$ is a little harder, but since the first 3/4 cycle maps to an amplitude of $-0.75$, all we need is to solve two equations, first translating 3/4 cycle to the $x$ scale,

$\qquad$ $10.5 \, \pi x = 1.5 \, \pi$ or  $x= 0.14$

and then computing a dampening of $0.75$ at that point, since $\sin(3/2 \, \pi) = - 1$,

$\qquad$  $\exp(-\hat\kappa \times 0.14) = 0.75$, or $\hat \kappa = - \log(0.75)/0.14 = 2.3$

Bob Who Understands then says, "of course, these are only approximations; given the data points I can quickly fit a model in #rstats that gets better estimates, plus quality measures of those estimates."

(Nerd note: If instead of $e^{-\kappa x}$ the dampening had been $2^{-\kappa x}$, then $1/\kappa$ would be the half-life of the process; but the numbers aren't as clean with base $e$.)

This facility with approximate reasoning (and use of #rstats :-) signal something important about Bob Who Understands: he understands what the numbers mean in terms of their effects on the function; he groks the function.

Nina hires Bob Who Understands. Bonuses galore follow.

Bob Who Recites Knowledge joins a government agency, funding research based on "objective, quantitative" metrics, where he excels at memorizing the 264,482 pages of regulation defining rules for awarding grants.

## Thursday, August 25, 2016

### Thoughts about "The Irrational Atheist" by Vox Day

I'm an agnostic. I don't believe in the God of any human religion, but I don't know what's outside the universe, so I can't assert that there's no "creator of the Universe," or God, as it's commonly called, there.

But your God? It might just be Steve. Because Steve is a powerful, yet mischievous alien.

The Book Of Hours [of reading]

"Here's a book I think you might like, but don't tell anyone I was the one who gave it to you; I don't want people to know I read Vox Day" --- how I came across The Irrational Atheist. Via he/she/xe/it who shall remain anonymous. But why?

Vox Day. Supreme Dark Lord. Leader of the Evil Legion of Evil. He who shall not be named.

Ok, I can see how his politics may be abhorrent to some. I don't care about politics. I know that politics cares about me, but I understand the commons problem, so I don't do politics.

I had promised myself that I wouldn't do any more commentary on "atheists" (especially e-atheists) and "skeptics" (especially e-skeptics). I had said all I had to say. This blog was going to be all positive all the time about science, engineering, math, business, and management.

Still, a book with a title of The Irrational Atheist, about Dawkins, Harris, and Hitchens... That's worth a look.

This is that look; 3000-words worth.

I. The Three Horse's-Asses Of The Atheist Apocalypse

That's what they call themselves, I believe, though it's four, not three. It's something like that, my memory may be failing me, lexically but not semantically (if we exclude Daniel Dennett).

VD prefaces the discussion with two important observations:
"This trio of New Atheists, this Unholy Trinity, is a collection of faux-intellectual frauds utilizing pseudo-scientific sleight of hand in order to falsely claim that religious faith is inherently dangerous and has no place in the modern world." This is one side of the error, that made by the Unholy Trinity; but as I show below, there a mirror-image version of this error, made by VD and coreligionists. (Corrected, Sep 11, 2016: Not VD, but some of his coreligionists.)
"Agnostics so often regard theists with puzzled bemusement while viewing their godless cousins, with whom they superficially appear to have far more in common, with a mix of embarrassment and unadulterated horror." Yes, this is me.
I'll present my views on the Unholy Trinity, noting where they deviate from VD's.

I.1. Richard Dawkins

Dawkins's The Selfish Gene was one of the first books I read that explained evolution in detail.* (I was a teenager then, more interested in electronics, chemistry, space exploration, and teenage girls, not necessarily in that order.) It was a good book for its time.

Sadly, that seems to have been the high point in Dawkins's opus, and also the time when his model of evolution was frozen. Time didn't improve Dawkins's material: his books have made up for the increasingly outdated model of evolution by pumping up the anti-religion sentiment.

(Anyone wishing to argue Dawkins's model of evolution will first have to pass a short test: three or four questions picked at random from Molecular Biology of the Gene --- a book I've read for leisure; several times, to make up for its price. I've had it with people who "love" science but only if they don't have to learn any. It's embarrassing!)

Interestingly, the most one can say from understanding evolution is that there's no need for a God to guide the process of creation of different species. VD and I disagree here, but that has more to do with the difference between algorithmic complexity and computational complexity than with any argument Dawkins has ever made --- another drawback of having a 1970s-vintage model of evolution.

In retrospect, Carl Sagan (the late great Carl Sagan, I should say) made a much better job explaining evolution in The Dragons of Eden than the entire Dawkins opus.

I.2. Sam "reincarnation might be possible" Harris

I remember Sam Harris saying something along the lines of that quoted phrase at a conference. He really seems to believe a lot of mysticism and superstition. But his audiences forgive him those small trespasses, as long as he continues to attack the religious, under the guise of attacking religion.

I did read one of Harris's books; it made me want to relapse into the Catholic faith of my upbringing. (I didn't.) That's how biased, poorly thought-out, poorly researched, supercilious, and absurd it was. I thought that was the worst possible case for atheism one could make.

Then I watched Harris in a conference and realized that a worse case was possible. If I had any doubts regarding my agnosticism, I would have become a young-Earth creationist speaking in tongues and handling snakes right then and there.

If anything, VD's takedown of Harris is too kind.

Paraphrasing an earlier essayist, Harris's books aren't to be tossed aside lightly; they should be thrown with great force.

I.3. Christopher Hitchens

Great wordsmith, and that's why I've read every one of his books. But terrible thinker, more interested in scoring debating points than actually constructing an argument. On these two points, VD and I are in agreement.

Possibly Hitchens's most quoted line (and a derivative of a similar Carl Sagan epigraph), "that which can be asserted without evidence, can be dismissed without evidence" reflects a self-absorption and blindness to other points of view that is shared by many other atheists and skeptics.

As shown in this numerical example, what counts as "asserted without evidence" depends critically on the beliefs of the person who's supposed to do the "dismissing without evidence."  Namely, their a-priori beliefs and how they interpret evidence (what one thinks of as dispositive evidence is non-evidence to another).

The aggressive attitude that Hitchens brought to the atheist community --- a community which includes many whose only reason to participate is the desire to belong to a group that looks down upon others --- was one of the biggest steps back for atheism since Carl Sagan died and his guerrilla warfare on behalf of reason was superseded by direct confrontation.

Direct confrontation may play well with the echo chamber, but it's an ineffectual way to change other people's minds.

I.4. Analysis

VD calls Dawkins "The Ironic Atheist," Harris "The Incompetent Atheist," and Hitchens "The Irrelevant Atheist." No contest on Dawkins or Harris. But Hitchens, with his contagious pugnaciousness isn't irrelevant; he's relevant, like a contaminant in a chemical reactor.

That contamination contributed to increasing polarization of atheists, leading to their various schisms and fights, and the rise of the strident "atheists" whose Patreon feed requires the production of video after video substituting snark for thought or knowledge. (Look past the high-quality writing of Hitchens and what you find is mostly snark. Good quality, quasi-Waughian snark, but snark nonetheless.)

One (me) wonders whether the whole atheist "project" since the late 1990s hasn't simply been an attempt by opportunists to monetize their echo chamber by feeding the prejudices of those who want to feel superior to others without actually having to do anything that would test that superiority.

My opinion of Dawkins, Harris, and Hitchens is captured, by revealed preference, in how difficult it was to dispose of their books during the great decluttering of 2013: while I agonized over old scifi paperbacks for which I already had kindle versions, God is Not Great, The God Delusion, and The End Of Faith went into the 'donate' bin without a thought.

II. The Fundamentally Flawed Equivalence: God's Existence And Goodness Of Religion

When VD positions the book with "this trio of New Atheists, this Unholy Trinity, is a collection of faux-intellectual frauds utilizing pseudo-scientific sleight of hand in order to falsely claim that religious faith is inherently dangerous and has no place in the modern world," he describes one type of error,

[Science $\Rightarrow$] Non-existence of God $\Rightarrow$ Badness of religion

while not noticing that in parts of his argument in the book, and in some of his writings that I perused on his blog, he makes a mirror-image of that error:

Goodness of religion $\Rightarrow$ Existence of God [of that religion].

Correction (Sep 11, 2016): the Supreme Dark Lord doesn't argue for this. My mistake, caused by over-exposure to this type of error by well-meaning religious people. (Unlike some science popularizers and skeptic/atheists I could mention, I own up to and  correct my mistakes.)

Neither implication is axiomatic; religion, taken as part of a culture, can be evaluated separately from its divine origins. If Chicagoans' belief that the Cubs are a real baseball team keeps them happy, is the patent falseness of that belief a justification for creating unhappiness and social unrest? And does that happiness of the believers/fans, in itself, make the Cubs a real baseball team, despite their performance? (Memo to self: avoid Illinois in the future.)

(I already said all I have to say about religion, but I'll tl;dr it here: religion can be evaluated as every other facet of culture, by its values and the actions of the members.)

Unfortunately there's a lot of ignorant caterwauling about this religion and that religion and this religious leader and those religious followers; as if it all amounted to anything other than "It's God's fault," an abdication of responsibility by the responsible humans, thinly covered.

I swear to Feynman, the next time someone starts saying that religion is a force for evil tout-court, I'll tie them down, Clockwork Orange-style, and make them watch this episode of Kenneth Clark's Civilisation:

Note that a decoupling of religion from the existence of God (which I believe is the theological foundation of the Church of England, at least according to Yes Prime Minister's "The Bishop's Gambit" episode) solves the morality question: morality comes from religion (as culture); people who want to think more deeply about morality can debate the finer points of mechanism design (in the game-theoretic sense), the rest can treat morality as any other component of the culture: a screening device for the group, a signaling tool for the individual.

(While making arguments for morality, VD uses the outdated version of the golden rule: treat others as you'd want them to treat you. He's apparently unaware of the modern version: those who have the gold make the rules.)

And a final note, inspired by Sir Kenneth's video: the second stupidest thing I've ever heard Richard Dawkins say was, paraphrasing, that "we'd still have all the art without religion," something that would be a surprise to Johann Sebastian Bach, who used to write "Glory To God Alone" at the end of his compositions, including many of the secular ones.**

III. A Not-Quite-Missed Opportunity: the Kardashian of Science, spared

I didn't come up with the Kardashian index; it was in Genome Biology, "The Kardashian index: a measure of discrepant social media profile for scientists" by Neil Hall (2014); Science (yes, that Science) wrote about it and computed the Kardashian index for 50 popular Twitter science popularizers and scientists. The index is simply the number of Twitter followers divided by the citation count (a rough measure of influence in the field).

Surprising no one, the highest Kardashian index goes to Neil DeGrasse Tyson, who, with 150 citations and 2.4 million followers has a K-index of 11,129. For scale, Brian Cox at 1188 and Richard Dawkins at 740 are second and third, respectively.

(Did I read that right? 150 citations? Career total? One hundred and fifty?)

Neil is certainly worthy of the Kardashian umbrella brand, with insightful tweets like

String theorist Lubos Motl has some kind and warm words for Neil Kardashian on the occasion of his debate with [real scientist] Brian Greene, where Neil Kardashian used that wonderful new modern scientific technique of switching off Greene's remote and then summarizing the arguments giving himself the victory.

(150 citations? Career total? Seriously?)

Given his prominence in the {skeptic, atheist,  I "love" science} talk circuit and his invasion of PBS airtime (plus an attempt at riding on Carl Sagan's coattails), I was surprised Neil Kardashian wasn't in VD's book.

The Supreme Dark Lord took some time from directing the flaying of his enemies by the Evil Legion of Evil to respond:

Apparently, neither have the other scientists, at least not in a scientific capacity. 150 citations. One-hundred and fifty citations, career total. The go-to "scientist" in the media. One hundred and fifty freaking citations, career total.

IV. Where Vox Day And Vox Mea Part Company

Obviously an agnostic (atheist with respect to all earthly religions) and an evangelic christian are going to have a fundamental disagreement about the nature of the universe and the meaning of life.

Putting that aside, there are some other points of discord:

1. "Many, if not most, of the great scientists in history were religious men" [and a well thought-out argument for science evolving faster then]

Granting ad arguendum the premise that science was moving faster in the early days of religious scientists, one possible explanation (one quite likely explanation, considering the history of the places where this science happened) is that there's a mediating factor: call it civilization. (Yes, I'm cribbing from Sir Kenneth.)

Religion contributed to the creation of a set of values that we can call, for short,  civilization. That set of values formed an  intellectual ecosystem that allowed science to flourish --- in certain locations. (That suggests that there were other, also important, parts of the ecosystem.)

The question then becomes, once there's the ecosystem, do the scientists themselves benefit from being religious? That's an empirical question, and given the large number of endogenous covariates, a very difficult one.

Simplistic analysis of the beliefs of scientists and the evolution of a number of metrics would suggest that modern scientists do well without religion. But it would take more than simplistic analysis to make a strong case. (I guesstimate that the effect would be negligible, simply because most modern people, even most religious people, live lives more or less orthogonal from their religion. Now, if we treat unfounded beliefs from funding agencies, secular as they may be, as a religion, that's clearly impactful on scientific production.)

Also, as the number of scientists and their influence in society increases (at least relative to what it was), the ecosystem itself mutates to accommodate and mold the progress of science. Which brings us to VD's discussion of some confounding factors:

2. [Confounding factors for why fewer 'great scientists' today, including:] "Religious scientists of the past had it easy, working with a relatively blank slate, and have left only the most difficult tasks for their secular successors."

The change from open peer review (where the peers reviewed by writing signed public rejoinders) to pre-publication anonymous veto was probably the biggest change to science quality. This institutional change creates incentives to comply and begets a winner-take-all system, particularly when combined with up-or-out career ladders that preclude deviations from orthodoxy in early career, when most researchers have more energy.

This confounding factor is orthogonal to religion in itself, being born of a desire to manage scientists (especially academics) like other human resources, with "objective" metrics and structured incentive systems. But it coincided with a decrease in the religiosity of scientists, so it would be very difficult to separate the effects empirically without having some instrumental variables.

3. "But the ultimate atheist irrationality is the idea that Man himself is rational."

Perhaps some atheists do believe that, but there are those like me, whose agnosticism is precisely an acknowledgment of the limitations of human reason: I know that I have in the past believed things that eventually I learned to be false, hence I don't trust a belief without a failure criterion (that is, a test).

4. "While the atheist may be Godless, he isn't without faith [JCS summary: in science and technology]"

First, let's concede the obvious point that most people, including most atheists in my experience, know very little of the science and technology that modern life depends on. There's an orthogonal issue of many people using science as an identity product, something that bothers a few of us others quite a lot. These are distractions from the main point.

There's a fundamental difference between science and faith:

It's possible to dig deep into most scientific results and engineering techniques to get to a point where pragmatically we can say "this is where it comes from, and as you can see, it passes an independent test." When one digs down religious belief, there's a point where the foundation is authority or self-experience ("revealed truth"); neither is a good foundation for building a technological society.

For example, practical limitations to computing power (measured in frames per second on Call Of Duty: Infinite Warfare) are a lot more important and visible than the abstract fundamental limitation of computation found by Turing/Church/Post. So, saying that a computer is an incomplete logical system because of incomputable functions is a true limitation, but one that doesn't apply to what people care about in their daily use of computers.

People "believe" in computers because computers take them to Facebook. But they can learn how transistors work, then logic gates, then microprocessors, then operating systems, then network protocols, then distributed systems programming. At that point, they don't "believe" in the computer taking them to Facebook, they know how the computer takes them to Facebook.

People's trust in science is earned by the availability of explanations that rely on observation; the farther science gets from those observations, the less trust people put into it. (Conditional on their interest in understanding the science; as noted above, most people don't care or care only about the identity, not the knowledge.)

(This is one of the reasons why "trust us we're experts" is precisely the wrong attitude for scientists and science popularizers to have.)

Science is the substance of things to be delivered by technology, the evidence of things seen everywhere. To crib from a famous letter.

5. "The Earth is a disc mounted on the back of a very large turtle"

This point is obviously wrong. It’s a disk supported by four elephants standing on the back of the Great A’Tuin. Requiescat In Pace, Sir Terry Pratchett, satirist extraordinaire.

V. Final thoughts

In the words of Al Pacino, just when I thought I was out, they pull me back in. Ok, ok, in the words of Michael Corleone. The book was well worth the time to read it, which given my very limited time (between work and the pile of other books to read), is a glowing endorsement.

I disagree with Vox Day on many things, like the nature of reality and the meaning of life, but his book was a good way to stress-test my own thoughts. They came out stronger for the task.

Pity that most "atheists" will never read it; they never read anything that might make them think. They would much rather be sure of their intellectual superiority over those that they deem inferior, the majority of the world.

That always ends well.

-- -- -- --

* Yes, it's Dawkins's, Hitchens's, and Harris's. The possessive "'s" is appended to singular nouns ending in "s"; it's replaced by a single apostrophe only for plural nouns ending in "s". If you don't believe me, check Strunk and White or The Chicago Manual of Style.

** This is the stupidest thing I've ever heard Dawkins say: That someone would "guide him through an LSD trip by taking half a dose." That's not how the brain works, professor Dawkins. Each brain would hallucinate independently.

Thanks to Timothy Michael Devinney on Facebook for telling me about the Kardashian Index. 150 freaking citations, career total. Unbelievable.

## Friday, August 19, 2016

### The strange case of the oscillating black hole at the gym

There's a micro-black hole at my gym, and it oscillates between a position under the squat cages and the deadlift platform, in synchrony with my powerlifting program.

It's the only possible explanation.

The data: following my not-very-demanding powerlifting program (which is very low volume, even for powerlifting), I should have gained $5\%$ in both the squat and the deadlift in the last six weeks. This is feasible because I'm recovering strength from the beginning of the year, not creating new strength. (Who said powerlifters have crazy superstitions?)

Clearly, what is happening is that the same mass (bar + weights) is exerting a larger force on my body, which means that there's a micro-black hole under the gym. Since I estimate that there's a 3-meter foundation, this being earthquake territory and all, I postulate that the black hole is below that:

Furthermore, it has to move, since it doesn't affect bench press (where, despite a damaged right rotator cuff, I'm recovering strength well above the program envelope) but it affects the other two lifts. Since it affects both lifts the same percentage, that black hole has to move diagonally, as seen above. It also oscillates back and forth between the squat and deadlift stations.

Two black holes, you say? Don't be ridiculous. Two back holes, indeed! Pah!

So, a little back-of-the-drawing calculation, the kind that drives OCD quants crazy...

(with three or four corrections along the way, including a slight ahem when I used $c = 3\times 10^{9}$ instead of the correct $c = 3\times 10^{8}$ m/s)

... and I have my micro-black hole. As small as the total gains of an entire continent's worth of CrossFitters, at a Schwarzchild radius of $3\times 10^{-16}$ meter and as heavy as a Planet Fitness personal trainer, at a mass of $2\times 10^{11}$ kilogram. That mass means that the black hole won't evaporate anytime soon, so my stalled gains will continue.

(The time to evaporate a black hole with a mass of $10^{11}$kg  is in the billions of years, about the time it would take for a CrossFitter to do one good chin-up or a Planet Fitness client to lose five ounces of fat.)

Clearly this is an important discovery. Hello, Nobel Committee? Got a pick for 2017 Physics yet?

Alternative explanation 1: weight gain on my part

First off, to cancel a $5\%$ increase in squat and deadlift, I'd have to have gained close to $15\%$ of my bodyweight over six weeks. That's not impossible (or even unheard of), but in reality I've been losing weight at about 1kg per week, mostly fat, hopefully more than 1.5kg of fat per week (muscle mass increasing at 0.5kg/week during a recovery is reasonable).

Also, weight gain wouldn't affect squat and deadlift in the same way, unless I gained all the weight above my sternum. (I continue to improve my mental skills, but that doesn't significantly increase the mass of the brain...)

In an ass-to-grass squat (my type of squat), the femur goes over a 110-120 degree arc, hence getting to the weakest part of the quads force curve. So, some more weight in the torso may affect the ability to squat heavy. But for the deadlift, the drive with the legs is only an arc of 60-70 degrees, well away from the weak part of the force curve for the quads, therefore the loss of deadlifting power given additional bodyweight should be much lower than the loss for the squat, not the same. But the same it is.

(In the squat my weakness is the quads, in the deadlift, the spinal erectors; never my glutes. Hip thrusts, baby, hip thrusts FTW! I do leg-extensions with the full stack for reps, but only an ass-to-grass squat hits the quads at their full extension...)

This explanation is therefore dismissed.

Alternative explanation 2: poor supplementation

A picture is worth a thousand words (and about two hundred dollars):

Of course, I eschew that marvelous "supplement" family, anabolic steroids, or if one wants to be a little more discreet, TRT, testosterone replacement therapy. I like my reproductive system to stay at manufacturer's specification. It's kind of a big deal for me, to have the theoretical capability for reproduction (Theoretical because the 3.75 billion women in the world took a vote and unanimously –minus my mother– decided that for the good of the universe I should not reproduce; who am I to question democracy?)

This explanation is therefore dismissed.

Alternative explanation 3: I'm no longer an 18-year-old kid.

Poppycock and balderdash! Balderdash, I say!

Age is but a number and you're as young as you feel. Besides I'm barely in my early middle age -- just a few months past 30.*

This explanation is dismissed with extreme prejudice and a SEAL Team 6 visit.

Conclusion

The only possible logical conclusion is that, like in the 1990 David Brin scifi novel Earth, there's a naughty micro-black hole oscillating between the space under the squat cages and the lifting platforms, and by enormous coincidence its period matches my powerlifting program.

Obviously the solution is to combine the Westside Barbell approach of growing a big belly with the Testosterone Nation recommendation of synergistic beard growing and head shaving so that, even with increasing gravity, gains will come:

It's Science!

-- -- -- --
* 236 months, to be precise.

## Sunday, August 14, 2016

### Working the solution versus solving the problem

Some time ago I tweeted that I was going to row a number of nautical miles on my trusty old Concept IIc machine. As an engineer, I use SI units for everything --- except on the water, where I use traditional units: nautical miles and knots.

A couple of rowers I know asked me how I had hacked the controller on the Concept IIc to change the units. This was my answer:

Many people miss the point, that the others were making a common mistake in problem-solving, a mistake that forecloses most creative solutions:

The mistake is working the solution instead of solving the problem.

Hidden in the question about the hack is an assumption: that the solution has to come from my programming skills (they know what I do, so it's not an unreasonable assumption). That assumption sets a path to a solution, which would include reprogramming the firmware inside the Concept IIc controller.

Having the ability to backtrack from that path into the beginning and to choose another path is the key process in the thinking process here. Too many people start on one path and can't get off it to pursue other possible paths to the solution.

By focussing on the problem, i.e. the question "what is to be achieved?", rather than the solution under consideration, changing the software, the mistake was avoided.

Yes, this is a trivial and obvious (after the fact) example, but often the difference between a non-working "solution" and a working solution is a matter of focus on the problem to be solved.

Alas, changing their focus is too hard for some would-be problem solvers.

## Wednesday, August 10, 2016

### Numerical fun: tracking my blood caffeine level in one day

A few days ago, I decided to see what my blood caffeine profile looks like on a typical day. Since I didn't want to draw blood at regular intervals for analysis, I did the next best thing and tracked consumption and computed the blood level using a model of its dynamics.

Tracking consumption was simple: I have two french presses, both used for tea; the smaller one (1 liter) brews the caffeine equivalent of two espressos (80mg each, or 160 total) and the larger one (1.5 liter) brews the equivalent of three espressos (240mg). I just made a note of when I finished with one of the french presses and which it was.

To convert consumption into blood level, we need a state equation. We make the following assumptions:
1. Caffeine level on wakeup is zero (an approximation).
2. Time $t$ is discrete and measured in half-hours.
3. Caffeine half-life in the body is two hours.*
The last assumption gives the equation

$\qquad L(t) = c(t) + 0.8409 \times L(t-1)$

where $L(t)$ is the level and $c(t)$ is the consumption at time $t$. This equation is an exponential decay process with a half-life of two hours: for a given $t=T$, assuming no consumption,

$\qquad L(T+4) = (0.8409)^4 \times L(T) = 0.5000 \times L(T)$.

(Two hours is 4 half-hours, since we're using the half-hour as the time unit.)

Putting the consumption and the initial condition into the equation and graphing it on a scale for the day in question we get

My average level was a bit high, but I'm used to it.

-- -- -- --
* I got this number from a doctor, but several sources have told me it's too low. Online sources point to a half-life of 3-6 hours. This changes the coefficient for $L(t-1)$ in the equation above to somewhere between 0.8909 (for three hours) to  0.9439 (for six hours). Possibly there's an update to this post in the future to deal with that.

Update in the future: I did the computations (click to embiggen):