“In times of change, learners will inherit the earth while the learned will find themselves beautifully equipped to deal with a world that no longer exists.” — Eric Hoffer
The blog of John D. Cook
From the monthly archives:
“In times of change, learners will inherit the earth while the learned will find themselves beautifully equipped to deal with a world that no longer exists.” — Eric Hoffer
{ 5 comments }
Last night I produced the plot below and was very surprised at the jagged spike. I knew the curve should be smooth and strictly increasing.

My first thought was that there must be a numerical accuracy problem in my code, but it turns out there’s a bug in SciPy version 0.8.0b1. I started to report it, but I saw there were similar bug reports and one such report was marked as closed, so presumably the fix will appear in the next release.
The problem is that SciPy’s erf function is inaccurate for arguments with imaginary part near 5.8. For example, Mathematica computes erf(1.0 + 5.7i) as -4.5717×1012 + 1.04767×1012 i. SciPy computes the same value as -4.4370×1012 + 1.3652×1012 i. The imaginary component is off by about 30%.
Here is the code that produced the plot.
from scipy.special import erf
from numpy import linspace, exp
import matplotlib.pyplot as plt
def g(y):
z = (1 + 1j*y) / sqrt(2)
temp = exp(z*z)*(1 - erf(z))
u, v = temp.real, temp.imag
return -v / u
x = linspace(0, 10, 101)
plt.plot(x, g(x))
{ 4 comments }
On Monday I wrote a post giving an illustration of robust priors. I’ve written a technical report that gives the proofs behind the statements in that post.
Asymptotic results for Normal-Cauchy model
{ 0 comments }
People don’t task switch like computers do.
The earliest versions of Windows and Mac OS used cooperative multitasking. A Windows program would do some small unit of work in response to a message and then relinquish the CPU to the operating system until the program got another message. That worked well, as long as all programs were written with consideration for other programs and had no bugs. An inconsiderate (or inexperienced) programmer might do too much work in a message handling routine and monopolize the CPU. A bug resulting in an infinite loop would keep the program from ever letting other programs run.
Now desktop operating systems use preemptive multitasking. Unix used this form of multitasking from the beginning. Windows starting using preemptive multitasking with Windows NT and Windows 95. Macintosh gained preemptive multitasking with OS X. The operating system preempts programs to tell them it’s time to give another program a turn with the CPU. Programmers don’t have to think about handing over control of the CPU and so programs are easier to write. And if a program runs into an infinite loop, it only hurts itself.
Computers work better with preemptive multitasking, but people work better with cooperative multitasking.
If you want to micro-manage people, if you don’t trust them and want to protect yourself against their errors, treat them like machines. Interrupt them whenever you want. Preemptive task switching works great for machines.
But people take more than a millisecond to regain context. (See Mary Czerwinski’s comments on context re-acquisition.) People do much better if they have some control over when they stop one thing and start another.
Related posts:
Inside the multitasking and marijuana study
{ 3 comments }