<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>The Endeavour</title>
	
	<link>http://www.johndcook.com/blog</link>
	<description>The blog of John D. Cook</description>
	<lastBuildDate>Fri, 10 Feb 2012 23:03:26 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/TheEndeavour" /><feedburner:info uri="theendeavour" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId>TheEndeavour</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>Mixing R, Python, and Perl in 14 lines of code</title>
		<link>http://feedproxy.google.com/~r/TheEndeavour/~3/JRgvZXD_SNY/</link>
		<comments>http://www.johndcook.com/blog/2012/02/09/mixing-r-python-and-perl-in-13-lines-of-code/#comments</comments>
		<pubDate>Thu, 09 Feb 2012 16:25:39 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[Emacs]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=10703</guid>
		<description><![CDATA[This is a continuation of my previous post, Running Python and R inside Emacs. That post shows how to execute independent code blocks in Emacs org-mode. This post illustrates calling one code block from another, each written in a different language.
The example below computes sin2(x) + cos2(x) by computing the sine function in R, the [...]]]></description>
			<content:encoded><![CDATA[<p>This is a continuation of my previous post, <a href="http://www.johndcook.com/blog/2012/02/09/python-org-mode/">Running Python and R inside Emacs</a>. That post shows how to execute independent code blocks in Emacs org-mode. This post illustrates calling one code block from another, each written in a different language.<span id="more-10703"></span></p>
<p>The example below computes sin<sup>2</sup>(x) + cos<sup>2</sup>(x) by computing the sine function in R, the cosine function in Python, and summing their squares in Perl. As you&#8217;d hope, it returns 1. (Actually, it returns 0.99999999999985 on my machine.)</p>
<p>To execute the code, go to the <code>#+call</code> line and type C-c C-c.</p>
<pre>#+name: sin_r(x=1)
#+begin_src R
sin(x)
#+end_src

#+name: cos_p(x=0)
#+begin_src python
import math
return math.cos(x)
#+end_src

#+name: sum_sq(a = 0, b = 0)
#+begin_src perl
$a*$a + $b*$b;
#+end_src

#+call: sum_sq(sin_r(1), cos_p(1))</pre>
<p>Apparently each function argument has to have a default value. If that&#8217;s documented, I missed it. I gave the sine and cosine functions default values that would cause the call to <code>sum_sq</code> to return more than 1 if the defaults were used.</p>
<img src="http://feeds.feedburner.com/~r/TheEndeavour/~4/JRgvZXD_SNY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2012/02/09/mixing-r-python-and-perl-in-13-lines-of-code/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.johndcook.com/blog/2012/02/09/mixing-r-python-and-perl-in-13-lines-of-code/</feedburner:origLink></item>
		<item>
		<title>Running Python and R inside Emacs</title>
		<link>http://feedproxy.google.com/~r/TheEndeavour/~3/117i2rhIaFM/</link>
		<comments>http://www.johndcook.com/blog/2012/02/09/python-org-mode/#comments</comments>
		<pubDate>Thu, 09 Feb 2012 13:00:58 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[Emacs]]></category>
		<category><![CDATA[Literate programming]]></category>
		<category><![CDATA[Reproducibility]]></category>
		<category><![CDATA[Rstats]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=10685</guid>
		<description><![CDATA[Emacs org-mode lets you manage blocks of source code inside a text file. You can execute these blocks and have the output display in your text file. Or you could export the file, say to HTML or PDF, and show the code and/or the results of executing the code.
Here I&#8217;ll show some of the most [...]]]></description>
			<content:encoded><![CDATA[<p>Emacs org-mode lets you manage blocks of source code inside a text file. You can execute these blocks and have the output display in your text file. Or you could export the file, say to HTML or PDF, and show the code and/or the results of executing the code.</p>
<p>Here I&#8217;ll show some of the most basic possibilities. For much more information, see  <a href="http://orgmode.org/">orgmode.org</a>. And for the use of org-mode in research, see <a href="http://www.jstatsoft.org/v46/i03/paper">A Multi-Language Computing Environment for Literate Programming and Reproducible Research</a>.</p>
<p><span id="more-10685"></span>Source code blocks go between lines of the form</p>
<pre>#+begin_src
#+end_src</pre>
<p>On the <code>#+begin_src</code> line, specify the programming language. Here I&#8217;ll demonstrate Python and R, but org-mode currently supports C++, Java, Perl, etc. for a total of <a href="http://orgmode.org/manual/Languages.html#Languages">35 languages</a>.</p>
<p>Suppose we want to compute &radic;42 using R.</p>
<pre>#+begin_src R
sqrt(42)
#+end_src</pre>
<p>If we put the cursor somewhere in the code block and type C-c C-c, org-mode will add these lines:</p>
<pre>#+results:
: 6.48074069840786</pre>
<p>Now suppose we do the same with Python:</p>
<pre>#+begin_src python
from math import sqrt
sqrt(42)
#+end_src</pre>
<p>This time we get disappointing results:</p>
<pre>#+results:
: None</pre>
<p>What happened? The org-mode manual explains:</p>
<blockquote><p>… code should be written as if it were the body of such a function.  In particular, note that Python does not automatically return a value from a function unless a <code>return</code> statement is present, and so a ‘<code>return</code>’ statement will usually be required in Python.</p></blockquote>
<p>If we change <code>sqrt(42)</code> to <code>return sqrt(42)</code> then we get the same result that we got when using R.</p>
<p>By default, evaluating a block of code returns a single result. If you want to see the output as if you were interactively using Python from the REPL, you can add <code>:results output :session</code> following the language name.</p>
<pre>#+begin_src python :results output :session
print "There are %d hours in a week." % (7*24)
2**10
#+end_src</pre>
<p>This produces the lines</p>
<pre>#+results:
: There are 168 hours in a week.
: 1024</pre>
<p>Without the <code>:session</code> tag, the second line would not appear because there was no <code>print</code> statement.</p>
<p>I had to do a couple things before I could get the examples above to work. First, I had to upgrade org-mode. The version of org-mode that shipped with Emacs 23.3 was quite out of date. Second, the only language you can run by default is Emacs Lisp. You have to turn on support for other languages in your <code>.emacs</code> file. Here&#8217;s the code to turn on support for Python and R.</p>
<pre>(org-babel-do-load-languages
    'org-babel-load-languages '((python . t) (R . t)))</pre>
<p><strong>Update</strong>: My <a href="http://www.johndcook.com/blog/2012/02/09/mixing-r-python-and-perl-in-13-lines-of-code/">next post</a> shows how to call code in written in one language from code written in another language.</p>
<p><strong>Related posts</strong>:</p>
<p><a href="http://www.johndcook.com/blog/2011/04/15/personal-organization-software/">Personal organization software</a><br />
<a href="http://www.johndcook.com/blog/2008/04/29/preventing-an-unpleasant-sweave-surprise/">Preventing an unpleasant Sweave surprise</a></p>
<img src="http://feeds.feedburner.com/~r/TheEndeavour/~4/117i2rhIaFM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2012/02/09/python-org-mode/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://www.johndcook.com/blog/2012/02/09/python-org-mode/</feedburner:origLink></item>
		<item>
		<title>Programming language popularity</title>
		<link>http://feedproxy.google.com/~r/TheEndeavour/~3/oZ-0zNgMY9o/</link>
		<comments>http://www.johndcook.com/blog/2012/02/09/programming-langauge-popularity/#comments</comments>
		<pubDate>Thu, 09 Feb 2012 11:26:31 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Software development]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=10699</guid>
		<description><![CDATA[Here are two ways of measuring programming language popularity:

Rank by number of questions tagged with that language on Stack Overflow
Rank by number of project on GitHub using that language

According to this article, these two measures are well correlated.
I&#8217;d be skeptical of either metric by itself. A large number of questions on a language could indicate [...]]]></description>
			<content:encoded><![CDATA[<p>Here are two ways of measuring programming language popularity:</p>
<ol>
<li>Rank by number of questions tagged with that language on Stack Overflow</li>
<li>Rank by number of project on GitHub using that language</li>
</ol>
<p>According to <a href="http://redmonk.com/sogrady/2012/02/08/language-rankings-2-2012/">this article</a>, these two measures are well correlated.</p>
<p>I&#8217;d be skeptical of either metric by itself. A large number of questions on a language could indicate that it&#8217;s poorly documented, for example, rather than popular. And GitHub projects may not representative. But the two measures give similar pictures of the programming language landscape, so together they have more credibility. On the other hand, both measures are probably biased in favor newer languages.</p>
<p><a href="http://redmonk.com/sogrady/2012/02/08/language-rankings-2-2012/">The RedMonk Programming Language Rankings: February 2012</a></p>
<img src="http://feeds.feedburner.com/~r/TheEndeavour/~4/oZ-0zNgMY9o" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2012/02/09/programming-langauge-popularity/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		<feedburner:origLink>http://www.johndcook.com/blog/2012/02/09/programming-langauge-popularity/</feedburner:origLink></item>
		<item>
		<title>Example of not inverting a matrix: optimization</title>
		<link>http://feedproxy.google.com/~r/TheEndeavour/~3/gkegN5riIVA/</link>
		<comments>http://www.johndcook.com/blog/2012/02/08/newton-conjugate-gradient/#comments</comments>
		<pubDate>Wed, 08 Feb 2012 13:00:56 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[Optimization]]></category>
		<category><![CDATA[SciPy]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=10461</guid>
		<description><![CDATA[People are invariably surprised when they hear it&#8217;s hardly ever necessary to invert a matrix. It&#8217;s very often necessary solve linear systems of the form Ax = b, but in practice you almost never do this by inverting A. This post will give an example of avoiding matrix inversion. I will explain how the Newton-Conjugate [...]]]></description>
			<content:encoded><![CDATA[<p>People are invariably surprised when they hear it&#8217;s <a href="http://www.johndcook.com/blog/2010/01/19/dont-invert-that-matrix/">hardly ever necessary to invert a matrix</a>. It&#8217;s very often necessary solve linear systems of the form <em>Ax</em> = <em>b</em>, but in practice you almost never do this by inverting <em>A</em>. This post will give an example of avoiding matrix inversion. I will explain how the Newton-Conjugate Gradient method works, implemented in SciPy by the function <code>fmin_ncg</code>.</p>
<p><span id="more-10461"></span></p>
<p>If a matrix <em>A</em> is large and sparse, it may be possible to solve <em>Ax</em> = <em>b</em> but impossible to even store the matrix <em>A</em><sup>-1</sup> because there isn&#8217;t enough memory to hold it. Sometimes it&#8217;s sufficient to be able to form matrix-vector products <em>Ax</em>. Notice that this doesn&#8217;t mean you have to store the matrix <em>A</em>; you have to produce the product <em>Ax</em> <span style="text-decoration: underline;">as if</span> you had stored the matrix <em>A</em> and multiplied it by <em>x</em>.</p>
<p>Very often there are physical reasons why the matrix <em>A</em> is sparse, i.e. most of its entries are zero and there is an exploitable pattern to the non-zero entries. There may be plenty of memory to store the non-zero elements of <em>A</em>, even though there would not be enough memory to store the entire matrix. Also, it may be possible to compute <em>Ax</em> much faster than it would be if you were to march along the full matrix, multiplying and adding a lot of zeros.</p>
<p>Iterative methods of solving <em>Ax</em> = <em>b</em>, such as the conjugate gradient method, create a sequence of approximations that converge (in theory) to the exact solution. These methods require forming products <em>Ax</em> and updating <em>x</em> as a result. These methods might be very useful for a couple reasons.</p>
<ol>
<li>You only have to form products of a sparse matrix and a vector.</li>
<li>If don&#8217;t need a very accurate solution, you may be able to stop very early.</li>
</ol>
<p>In Newton&#8217;s optimization method, you have to solve a linear system in order to find a search direction. In practice this system is often large and sparse. The ultimate goal of Newton&#8217;s method is to minimize a function, not to find perfect search directions. So you can save time by finding only approximately solutions to the problem of finding search directions. Maybe an exact solution would in theory take 100,000 iterations, but you can stop after only 10 iterations! This is the idea behind the Newton-Conjugate Gradient optimization method.</p>
<p>The function <code>scipy.optimize.fmin_ncg</code> can take as an argument a function <code>fhess</code> that computes the Hessian matrix <em>H</em> of the objective function. But more importantly, it lets you provide instead a function <code>fhess_p</code> that computes the product of the <em>H</em> with a vector. You don&#8217;t have to supply the actual Hessian matrix because the <code>fmin_ncg</code> method doesn&#8217;t need it. It only needs a way to compute matrix-vector products <em>Hx</em> to find approximate Newton search directions.</p>
<p>For more information, see the <a href="http://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.fmin_ncg.html#scipy.optimize.fmin_ncg">SciPy documentation</a> for <code>fmin_ncg</code>.</p>
<img src="http://feeds.feedburner.com/~r/TheEndeavour/~4/gkegN5riIVA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2012/02/08/newton-conjugate-gradient/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.johndcook.com/blog/2012/02/08/newton-conjugate-gradient/</feedburner:origLink></item>
		<item>
		<title>Chrysler ad and Parody</title>
		<link>http://feedproxy.google.com/~r/TheEndeavour/~3/BzELL1Y34-Y/</link>
		<comments>http://www.johndcook.com/blog/2012/02/07/chrysler-ad-and-parody/#comments</comments>
		<pubDate>Wed, 08 Feb 2012 02:37:29 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=10676</guid>
		<description><![CDATA[Here&#8217;s Chrysler&#8217;s ad from the Super Bowl on Sunday:

And here&#8217;s a parody of it that came out today:

]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s Chrysler&#8217;s ad from the Super Bowl on Sunday:</p>
<p><iframe width="400" height="233" src="http://www.youtube.com/embed/_PE5V4Uzobc?rel=0" frameborder="0" allowfullscreen></iframe></p>
<p>And here&#8217;s a parody of it that came out today:</p>
<p><iframe width="400" height="233" src="http://www.youtube.com/embed/-j_8qCbHsUA?rel=0" frameborder="0" allowfullscreen></iframe></p>
<img src="http://feeds.feedburner.com/~r/TheEndeavour/~4/BzELL1Y34-Y" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2012/02/07/chrysler-ad-and-parody/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.johndcook.com/blog/2012/02/07/chrysler-ad-and-parody/</feedburner:origLink></item>
		<item>
		<title>All day long I’d bidi-bidi-bum</title>
		<link>http://feedproxy.google.com/~r/TheEndeavour/~3/vjhh8jaFU_A/</link>
		<comments>http://www.johndcook.com/blog/2012/02/06/if-i-were-a-rich-man/#comments</comments>
		<pubDate>Tue, 07 Feb 2012 04:48:15 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Music]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=10663</guid>
		<description><![CDATA[This evening I watched my daughter in Fiddler on the Roof. I thought I knew the play pretty well, but I learned something tonight.
Before the play started, someone told me that the phrase &#8220;bidi-bidi-bum&#8221; in &#8220;If I Were a Rich Man&#8221; is a Yiddish term for prayer. I thought &#8220;All day long I&#8217;d bidi-bidi-bum&#8221; was [...]]]></description>
			<content:encoded><![CDATA[<p>This evening I watched my daughter in Fiddler on the Roof. I thought I knew the play pretty well, but I learned something tonight.</p>
<p>Before the play started, someone told me that the phrase &#8220;bidi-bidi-bum&#8221; in &#8220;If I Were a Rich Man&#8221; is a Yiddish term for prayer. I thought &#8220;All day long I&#8217;d bidi-bidi-bum&#8221; was a way of saying &#8220;All day long I&#8217;d piddle around.&#8221; That completely changes the meaning of that part of the song.</p>
<p>When I got home I did a quick search to see whether what I&#8217;d heard was correct. According to <a href="http://en.wikipedia.org/wiki/If_I_Were_a_Rich_Man_%28song%29">Wikipedia</a>,</p>
<blockquote><p>A repeated phrase throughout the song, &#8220;all day long I&#8217;d bidi-bidi-bum,&#8221;  is often misunderstood to refer to Tevye&#8217;s desire not to have to work.  However, the phrase &#8220;bidi-bidi-bum&#8221; is a reference to the practice of  Jewish prayer, in particular davening.</p></blockquote>
<p>Unfortunately, Wikipedia adds a footnote saying &#8220;citation needed,&#8221; so I still have some doubt whether this explanation is correct. I searched a little more, but haven&#8217;t found anything more authoritative.</p>
<p>Now I wonder whether there&#8217;s any significance to other parts of the song that I thought were just a form of Klezmer scat singing, e.g. &#8220;yubba dibby dibby dibby dibby dibby dibby dum.&#8221; I assumed those were nonsense syllables, but is there some significance to them?</p>
<p><strong>Update</strong>: At Jason Fruit&#8217;s suggestion in the comments, I asked about this on judaism.stackexchange.com. Isaac Moses <a href="http://judaism.stackexchange.com/questions/13980/meaning-of-bidi-bidi-bum">replied</a> that the answer is somewhere in between. The specific syllables are not meaningful, but they are intended to be reminiscent of the kind of improvisation a cantor might do in singing a prayer. </p>
<p><iframe width="420" height="315" src="http://www.youtube.com/embed/Pl7BVr36bbs?rel=0" frameborder="0" allowfullscreen></iframe></p>
<img src="http://feeds.feedburner.com/~r/TheEndeavour/~4/vjhh8jaFU_A" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2012/02/06/if-i-were-a-rich-man/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		<feedburner:origLink>http://www.johndcook.com/blog/2012/02/06/if-i-were-a-rich-man/</feedburner:origLink></item>
		<item>
		<title>Ceiling of Complexity</title>
		<link>http://feedproxy.google.com/~r/TheEndeavour/~3/XeuMQR9GkFk/</link>
		<comments>http://www.johndcook.com/blog/2012/02/06/ceiling-of-complexity/#comments</comments>
		<pubDate>Mon, 06 Feb 2012 15:38:30 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[Productivity]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=10650</guid>
		<description><![CDATA[Dan Sullivan coined an interesting term: The Ceiling of Complexity™. (Sullivan has a habit of trademarking™ everything™ he™ says™. I dislike the gratuitous trademarking, but I like the phrase &#8220;ceiling of complexity.&#8221;)
The idea behind ceiling of complexity is that every project you complete creates residual responsibilities and expectations. This residual may be small, maybe not [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.amazon.com/gp/product/1896635296/ref=as_li_ss_tl?ie=UTF8&amp;tag=theende-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=1896635296">Dan Sullivan</a> coined an interesting term: The Ceiling of Complexity™. (Sullivan has a habit of trademarking™ everything™ he™ says™. I dislike the gratuitous trademarking, but I like the phrase &#8220;ceiling of complexity.&#8221;)</p>
<p>The idea behind ceiling of complexity is that every project you complete creates residual responsibilities and expectations. This residual may be small, maybe not even noticeable, but it&#8217;s always there. Over time, this residue builds up and adds complexity. Eventually it forms a ceiling and limits further progress until you do something to break through the ceiling and reach a new state of simplicity. The ceiling of complexity is a byproduct of success.</p>
<p>Sullivan&#8217;s picture of a ceiling of complexity is sort of existential crisis, something an individual would only face a few times over a career, but I find it useful to use the term for less dramatic situations. It gives a way to talk about the gradual accumulation of small responsibilities that become significant in aggregate.</p>
<p>The idea of a ceiling of complexity can be applied to projects as well as to careers. For example, the entropy of a software code base increases over time. Successful projects may have a faster increase in entropy. The software has to maintain backward compatibility because many people depend on its features. Sometimes even its bugs have to be preserved because people rely on them. It&#8217;s much easier to renovate software that nobody uses.</p>
<p><strong>Related posts</strong>:</p>
<p><a href="http://www.johndcook.com/blog/2011/05/10/the-dark-side-of-linchpins/">The dark side of linchpins</a><br />
<a href="http://www.johndcook.com/blog/2008/11/03/peter-drucker-and-abandoning-projects/">Abandoning projects</a><br />
<a href="http://www.johndcook.com/blog/2008/04/09/a-little-simplicity-goes-a-long-way/">A little simplicity goes a long way</a></p>
<img src="http://feeds.feedburner.com/~r/TheEndeavour/~4/XeuMQR9GkFk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2012/02/06/ceiling-of-complexity/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://www.johndcook.com/blog/2012/02/06/ceiling-of-complexity/</feedburner:origLink></item>
		<item>
		<title>Einstein on radio</title>
		<link>http://feedproxy.google.com/~r/TheEndeavour/~3/DqwjGvwCZgo/</link>
		<comments>http://www.johndcook.com/blog/2012/02/05/einstein-on-radio/#comments</comments>
		<pubDate>Sun, 05 Feb 2012 19:32:46 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Science]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=10641</guid>
		<description><![CDATA[From Albert Einstein&#8217;s address to the Seventh German Radio Exhibition at Berlin (1930):
One ought to be ashamed to make use of the wonders of science embodied in a radio set, the while appreciating them as little as a cow appreciates the botanic marvels in the plants she munches.
Source: The Science of Radio by Paul Nahin, [...]]]></description>
			<content:encoded><![CDATA[<p>From Albert Einstein&#8217;s address to the Seventh German Radio Exhibition at Berlin (1930):</p>
<p style="padding-left: 30px;">One ought to be ashamed to make use of the wonders of science embodied in a radio set, the while appreciating them as little as a cow appreciates the botanic marvels in the plants she munches.</p>
<p>Source: <a href="http://www.amazon.com/gp/product/0387951504/ref=as_li_ss_tl?ie=UTF8&amp;tag=theende-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0387951504">The Science of Radio</a> by Paul Nahin, first edition</p>
<img src="http://feeds.feedburner.com/~r/TheEndeavour/~4/DqwjGvwCZgo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2012/02/05/einstein-on-radio/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.johndcook.com/blog/2012/02/05/einstein-on-radio/</feedburner:origLink></item>
		<item>
		<title>Perl One-Liners Explained</title>
		<link>http://feedproxy.google.com/~r/TheEndeavour/~3/Rvm2wIxzlTc/</link>
		<comments>http://www.johndcook.com/blog/2012/02/04/perl-one-liners-explained/#comments</comments>
		<pubDate>Sat, 04 Feb 2012 18:27:38 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Software development]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=10638</guid>
		<description><![CDATA[Peteris Krumins has a new book, Perl One-Liners Explained. His new book is in the same style as his previous books on awk and sed, reviewed here and here.
All the books in this series are organized by task. For each task, there is a one-line solution followed by detailed commentary. The explanations frequently offer alternate [...]]]></description>
			<content:encoded><![CDATA[<p>Peteris Krumins has a new book, <a href="http://www.catonmat.net/blog/perl-book/">Perl One-Liners Explained</a>. His new book is in the same style as his previous books on <a href="http://www.catonmat.net/blog/awk-book/">awk</a> and <a href="http://www.johndcook.com/blog/2011/09/27/sed-one-liners/">sed</a>, reviewed <a href="http://www.johndcook.com/blog/2011/08/31/awk-one-liners/">here</a> and <a href="http://www.johndcook.com/blog/2011/09/27/sed-one-liners/">here</a>.</p>
<p>All the books in this series are organized by task. For each task, there is a one-line solution followed by detailed commentary. The explanations frequently offer alternate solutions with varying degrees of concision and clarity. Sections are seldom more than one page long, so the books are easy to read a little at a time.</p>
<p>Programmers who have written a lot of Perl may still learn a few things from Krumins. In particular, those who have primarily written Perl in script files may not be familiar with some of the tricks for writing succinct Perl on the command line.</p>
<p><strong>Other Perl posts</strong>:</p>
<p><a href="http://www.johndcook.com/blog/2009/05/11/all-languages-equally-complex/">All languages equally complex?</a><br />
<a href="http://www.johndcook.com/blog/2008/02/21/periodic-table-of-perl-operators/">Periodic table of Perl operators</a><br />
<a href="http://www.johndcook.com/blog/2008/01/31/three-hour-a-week-language/">Three-hour-a-week language</a></p>
<img src="http://feeds.feedburner.com/~r/TheEndeavour/~4/Rvm2wIxzlTc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2012/02/04/perl-one-liners-explained/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.johndcook.com/blog/2012/02/04/perl-one-liners-explained/</feedburner:origLink></item>
		<item>
		<title>Limiting your options leads to better options</title>
		<link>http://feedproxy.google.com/~r/TheEndeavour/~3/xYUcTgzrfsY/</link>
		<comments>http://www.johndcook.com/blog/2012/02/03/limiting-your-options-creates-better-options/#comments</comments>
		<pubDate>Fri, 03 Feb 2012 13:10:58 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Creativity]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=10591</guid>
		<description><![CDATA[Limiting your options leads to better options.
… when you study the evidence, it’s clear that you’re not likely to encounter real interesting opportunities in your life until after you’re really good at something.
If you avoid focus because you want to keep your options open, you’re likely accomplishing the opposite. Getting good is a prerequisite to [...]]]></description>
			<content:encoded><![CDATA[<p>Limiting your options leads to better options.</p>
<blockquote><p>… when you study the evidence, it’s clear that you’re not likely to encounter real interesting opportunities in your life until after you’re really good at something.</p>
<p>If you avoid focus because you want to keep your options open, you’re likely accomplishing the opposite. Getting good is a prerequisite to encountering options worth pursuing.</p></blockquote>
<p>From <a href="http://calnewport.com/blog/2012/01/29/closing-your-interests-opens-more-interesting-opportunities-the-power-of-diligence-in-creating-a-remarkable-life/">Closing your interests opens more interesting opportunities</a>.</p>
<p><strong>Related post</strong>:</p>
<p><a href="http://www.johndcook.com/blog/2011/10/05/demonstrating-persistence/">Demonstrating persistence</a></p>
<img src="http://feeds.feedburner.com/~r/TheEndeavour/~4/xYUcTgzrfsY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2012/02/03/limiting-your-options-creates-better-options/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		<feedburner:origLink>http://www.johndcook.com/blog/2012/02/03/limiting-your-options-creates-better-options/</feedburner:origLink></item>
		<item>
		<title>How to compute jinc(x)</title>
		<link>http://feedproxy.google.com/~r/TheEndeavour/~3/-ocmh6wYnrg/</link>
		<comments>http://www.johndcook.com/blog/2012/02/02/how-to-compute-jincx/#comments</comments>
		<pubDate>Thu, 02 Feb 2012 16:01:04 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[SciPy]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=10607</guid>
		<description><![CDATA[The function jinc(x) that I wrote about yesterday is almost trivial to implement, but not quite. I&#8217;ll explain why it&#8217;s not quite as easy as it looks and how one might implement it in C and Python.
The function jinc(x) is defined as J1(x) / x, so if you have code to compute J1 then it [...]]]></description>
			<content:encoded><![CDATA[<p>The function <a href="http://www.johndcook.com/blog/2012/02/01/jinc-function/">jinc(x)</a> that I wrote about yesterday is almost trivial to implement, but not quite. I&#8217;ll explain why it&#8217;s not quite as easy as it looks and how one might implement it in C and Python.<span id="more-10607"></span></p>
<p>The function jinc(x) is defined as J<sub>1</sub>(x) / x, so if you have code to compute J<sub>1</sub> then it ought to be a no-brainer. For example, why not use the following C code?</p>
<pre class="brush: plain; title: ; notranslate">
#include &lt;math.h&gt;
double jinc(double x) {
    return j1(x) / x;
}
</pre>
<p>The problem is that if you pass in 0, the code will divide by 0 and return a NaN. The function jinc(x) is defined to be 1/2 at x = 0 because that&#8217;s the limit of J<sub>1(x)</sub>(x) / x as x goes to 0. So we try again:</p>
<pre class="brush: plain; title: ; notranslate">
#include &lt;math.h&gt;
double jinc(double x) {
    return (x == 0.0) ? 0.5 : j1(x) / x;
}
</pre>
<p>Does that work? Technically, it could still fail — we&#8217;ll come back to that at the end — but we&#8217;ll assume for now that it&#8217;s OK.</p>
<p>We could write the analogous Python code, and it would be adequate as long as we&#8217;re only calling the function with scalars and not NumPy arrays.</p>
<pre class="brush: plain; title: ; notranslate">
from scipy.special import j1
def jinc(x):
    if x == 0.0:
        return 0.5
    return j1(x) / x
</pre>
<p>Now suppose you want to plot this function. You create an array of points, say</p>
<pre class="brush: plain; title: ; notranslate">x = np.linspace(-1, 1, 25)</pre>
<p>and plot <code>jinc(x)</code>. You&#8217;ll get a warning: &#8220;ValueError: The truth value of an array with one element is ambiguous. Use a.any() or a.all().&#8221; Incidentally, if we called <code>linspace</code> with an even integer in the last argument, our array of points would avoid zero and the naive implementation of <code>jinc</code> would work.</p>
<p>When Python tries to apply <code>jinc</code> to an array, it doesn&#8217;t know how to interpret the test <code>x == 0</code>. The warning suggests &#8220;Do you mean if any component of x is 0? Or if all components of x are 0?&#8221; Neither option is what we want. We want to apply <code>jinc</code> as written to each element of x. We could do this by calling the <code>vectorize</code> function.</p>
<pre class="brush: plain; title: ; notranslate">jinc = np.vectorize(jinc)</pre>
<p>This replaces our original <code>jinc</code> function with one that handles NumPy arrays correctly.</p>
<p>There is an extremely unlikely scenario in which the code above could fail. The value of J<sub>1</sub>(x) is approximately x/2 for small values of x. If the floating point value <code>x</code> is so small that <code>0.5*x</code> returns 0, our function will return 0, even though it should return 0.5. The C code above works for values of <code>x</code> as small as <code>DBL_MIN</code> and even values much smaller. (<code>DBL_MIN</code> is not the smallest value of a <code>double</code>, only the smallest <em>normalized</em> double.) But if you set</p>
<pre class="brush: plain; title: ; notranslate">x = DBL_MIN / pow(2.0, 52);</pre>
<p>then <code>jinc(x)</code> will return 0. If you want to be absolutely safe, you could change the implementation to</p>
<pre class="brush: plain; title: ; notranslate">
#include &lt;math.h&gt;
double jinc(double x) {
    return (fabs(x) &lt; 1e-8) ? 0.5 : j1(x) / x;
}
</pre>
<p>Why test for whether the absolute value is less than 10<sup>-8</sup> rather than a much smaller number? For small x, the error in approximating jinc(x) with 1/2 is on the order of x<sup>2</sup>/16. So for x as large as 10<sup>-8</sup>, the approximation error is below the resolution of a <code>double</code>. As a bonus, the function <code>jinc(x)</code> will be more efficient for |x| &lt; 10<sup>-8</sup> since it avoids a call to <code>j1</code>.</p>
<p><strong>Related posts</strong>:</p>
<p><a href="http://www.johndcook.com/blog/2012/02/01/jinc-function/">Jinc function</a><br />
<a href="http://www.johndcook.com/blog/2010/07/27/sine-approximation-for-small-x/">Sine approximation for small angles</a><br />
<a href="http://www.johndcook.com/blog/2010/06/07/math-library-functions-that-seem-unnecessary/">Functions in math.h that seem unnecessary</a></p>
<img src="http://feeds.feedburner.com/~r/TheEndeavour/~4/-ocmh6wYnrg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2012/02/02/how-to-compute-jincx/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		<feedburner:origLink>http://www.johndcook.com/blog/2012/02/02/how-to-compute-jincx/</feedburner:origLink></item>
		<item>
		<title>Jinc function</title>
		<link>http://feedproxy.google.com/~r/TheEndeavour/~3/2Xxsqp1gtUk/</link>
		<comments>http://www.johndcook.com/blog/2012/02/01/jinc-function/#comments</comments>
		<pubDate>Thu, 02 Feb 2012 03:32:03 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Math]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=10600</guid>
		<description><![CDATA[This afternoon I ran across the jinc function for the first time.
The sinc function is defined by
sinc(t) = sin(t) / t.
The jinc function is defined analogously by
jinc(t) = J1(t) / t
where J1 is a Bessel function. Bessel functions are analogous to sines, so the jinc function is analogous to the sinc function.
Here&#8217;s what the sinc [...]]]></description>
			<content:encoded><![CDATA[<p>This afternoon I ran across the <strong>jinc</strong> function for the first time.</p>
<p>The <strong>sinc</strong> function is defined by</p>
<p style="padding-left: 30px;">sinc(<em>t</em>) = sin(<em>t</em>) / <em>t</em>.</p>
<p>The<strong> jinc</strong> function is defined analogously by</p>
<p style="padding-left: 30px;">jinc(<em>t</em>) = J<sub>1</sub>(<em>t</em>) / <em>t</em></p>
<p>where J<sub>1</sub> is a Bessel function. Bessel functions are analogous to sines, so the <strong>jinc</strong> function is analogous to the <strong>sinc</strong> function.</p>
<p>Here&#8217;s what the <strong>sinc</strong> and <strong>jinc</strong> functions look like.</p>
<p><span id="more-10600"></span></p>
<p style="text-align:center"><img src="http://www.johndcook.com/sinc_jinc.png" alt="" width="400" height="271" /></p>
<p>The<strong> jinc</strong> function is not as common as the <strong>sinc</strong> function. For example, both Mathematica and SciPy have built-in functions for <strong>sinc</strong> but not for <strong>jinc</strong>. [There are actually two definitions of <strong>sinc</strong>. Mathematica uses the definition above, but SciPy uses sin(π<em>t</em>)/π<em>t</em>. The SciPy convention is more common in digital signal processing.]</p>
<p>As I write this, Wikipedia has an entry for <strong>sinc</strong> but not for <strong>jinc</strong>. Someone want to write one?</p>
<p>For small <em>t</em>, <strong>jinc</strong>(<em>t</em>) is approximately cos(<em>t</em>/2) / 2. This approximation has error O(<em>t</em><sup>4</sup>), so it&#8217;s very good for small <em>t</em>, useless for large <em>t</em>.</p>
<p style="text-align:center"><img src="http://www.johndcook.com/jinc_small_arg.png" alt="" width="400" height="271" /></p>
<p>For large values of <em>t</em>, <strong>jinc</strong>(<em>t</em>) is like a damped, shifted cosine. Specifically,</p>
<p style="text-align:center"><img src="http://www.johndcook.com/jinc_asymptotic.png" alt="\mbox{jinc}(t) \sim \cos\left( |t| - \frac{3\pi}{4}\right) \sqrt{\frac{2}{\pi |t|^3}}" width="232" height="51" /></p>
<p>with an error that decreases like O( |<em>t</em>|<sup>-2</sup> ).</p>
<p style="text-align:center"><img src="http://www.johndcook.com/jinc_large_arg.png" alt="" width="400" height="271" /></p>
<p>Like the <strong>sinc</strong> function, the <strong>jinc</strong> function has a simple Fourier transform. Both transforms are zero outside the interval [-1, 1]. Inside this interval, the transform of <strong>sinc</strong> is a constant, √(π/8). On the same interval, the transform of <strong>jinc</strong> is √(2/π) √(1 &#8211; ω<sup>2</sup>).</p>
<p><strong>Update</strong>: <a href="http://www.johndcook.com/blog/2012/02/02/how-to-compute-jincx/">How to compute jinc(x)</a></p>
<p><strong>Related posts</strong>:</p>
<p><a href="http://www.johndcook.com/blog/2010/09/15/visualize-bessel-functions/">How to visualize Bessel functions</a><br />
<a href="http://www.johndcook.com/blog/2010/09/27/diagram-of-bessel-functions/">Diagram of Bessel function relationships</a></p>
<img src="http://feeds.feedburner.com/~r/TheEndeavour/~4/2Xxsqp1gtUk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2012/02/01/jinc-function/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://www.johndcook.com/blog/2012/02/01/jinc-function/</feedburner:origLink></item>
		<item>
		<title>The universal solvent of statistics</title>
		<link>http://feedproxy.google.com/~r/TheEndeavour/~3/a2HNAU9wasA/</link>
		<comments>http://www.johndcook.com/blog/2012/02/01/the-universal-solvent-of-statistics/#comments</comments>
		<pubDate>Wed, 01 Feb 2012 16:02:21 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Statistics]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Bayesian]]></category>
		<category><![CDATA[Probability and Statistics]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=10594</guid>
		<description><![CDATA[Andrew Gelman just posted an interesting article on the philosophy of Bayesian statistics. Here&#8217;s my favorite passage.
This reminds me of a standard question that Don Rubin … asks in virtually any  situation:  “What would you do if you had all the data?”  For me, that  “what would you do” question is [...]]]></description>
			<content:encoded><![CDATA[<p>Andrew Gelman just posted an interesting article on the <a href="http://andrewgelman.com/2012/02/philosophy-of-bayesian-statistics-my-reactions-to-cox-and-mayo/">philosophy of Bayesian statistics</a>. Here&#8217;s my favorite passage.</p>
<blockquote><p>This reminds me of a standard question that Don Rubin … asks in virtually any  situation:  “<strong>What would you do if you had all the data</strong>?”  For me, that  “what would you do” question is one of <strong>the universal solvents of  statistics</strong>.</p></blockquote>
<p>Emphasis added.</p>
<p>I had not heard Don Rubin&#8217;s question before, but I think I&#8217;ll be asking it often. It reminds me of Alice&#8217;s famous dialog with the Cheshire Cat:</p>
<blockquote><p>&#8220;Would you tell me, please, which way I ought to go from here?&#8221;</p>
<p>&#8220;That depends a good deal on where you want to get to,&#8221; said the Cat.</p>
<p>&#8220;I don&#8217;t much care where&#8211;&#8221; said Alice.</p>
<p>&#8220;Then it doesn&#8217;t matter which way you go,&#8221; said the Cat.</p></blockquote>
<p><img class="alignnone" src="http://www.johndcook.com/cheshire_cat.png" alt="Cheshire Cat" width="200" height="200" /></p>
<p><strong>Related post</strong>: <a href="http://www.johndcook.com/blog/2008/01/14/irrelevant-uncertainty/">Irrelevant uncertainty</a></p>
<img src="http://feeds.feedburner.com/~r/TheEndeavour/~4/a2HNAU9wasA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2012/02/01/the-universal-solvent-of-statistics/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		<feedburner:origLink>http://www.johndcook.com/blog/2012/02/01/the-universal-solvent-of-statistics/</feedburner:origLink></item>
		<item>
		<title>Feynman on imagining electromagnetic waves</title>
		<link>http://feedproxy.google.com/~r/TheEndeavour/~3/xkWWOtfG_Bg/</link>
		<comments>http://www.johndcook.com/blog/2012/02/01/feynman-electromagnetic-waves/#comments</comments>
		<pubDate>Wed, 01 Feb 2012 10:42:03 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Science]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=10586</guid>
		<description><![CDATA[Richard Feynman on imagining electromagnetic waves:
I&#8217;ll tell you what I see. I see some kind of vague showy, wiggling lines  — here and there an E and a B written on them somehow, and perhaps some of the lines have arrows on them — an arrow here or there which disappears when I look too [...]]]></description>
			<content:encoded><![CDATA[<p>Richard Feynman on imagining electromagnetic waves:</p>
<blockquote><p>I&#8217;ll tell you what I see. I see some kind of vague showy, wiggling lines  — here and there an E and a B written on them somehow, and perhaps some of the lines have arrows on them — an arrow here or there which disappears when I look too closely at it. When I talk about the fields swishing through space, I have a terrible confusion between the symbols I use to describe the objects and the objects themselves. I cannot really make a picture that is even nearly like the true waves. So if you have difficulty making such a picture, you should not be worried that your difficulty is unusual.</p></blockquote>
<p>From <a href="http://www.amazon.com/gp/product/0465024947/ref=as_li_ss_tl?ie=UTF8&amp;tag=theende-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0465024947">The Feynman Lectures on Physics, volume II</a>.</p>
<p><strong>Other Feynman posts</strong>:</p>
<p><a href="http://www.johndcook.com/blog/2011/11/09/feynman-fermat-and-picard/">Richard Feynman and Captain Picard try to prove Fermat&#8217;s Last Theorem</a><br />
<a href="http://www.johndcook.com/blog/2011/05/30/feynman-maxwell-equations/">Most important event of the 19th century</a><br />
<a href="http://www.johndcook.com/blog/2008/03/30/god-is-in-the-details/">God is in the details</a></p>
<img src="http://feeds.feedburner.com/~r/TheEndeavour/~4/xkWWOtfG_Bg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2012/02/01/feynman-electromagnetic-waves/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		<feedburner:origLink>http://www.johndcook.com/blog/2012/02/01/feynman-electromagnetic-waves/</feedburner:origLink></item>
		<item>
		<title>Twitter milestone</title>
		<link>http://feedproxy.google.com/~r/TheEndeavour/~3/8aAzr5OgqQc/</link>
		<comments>http://www.johndcook.com/blog/2012/01/31/twitter-milestone/#comments</comments>
		<pubDate>Tue, 31 Jan 2012 20:05:34 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Twitter]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=10562</guid>
		<description><![CDATA[There are now over 100,000 followers across my various daily tip Twitter accounts. The three most popular are CompSciFact, AlgebraFact, and ProbFact. The newest account GrokEM has the least followers for now.
Thank you everyone for following and for providing feedback.
Related posts:
How to subscribe to a Twitter post via RSS
Daily tip accounts broader than their names [...]]]></description>
			<content:encoded><![CDATA[<p>There are now over 100,000 followers across my various <a href="http://www.johndcook.com/twitter/">daily tip Twitter accounts</a>. The three most popular are <a href="http://twitter.com/CompSciFact">CompSciFact</a>, <a href="http://twitter.com/AlgebraFact">AlgebraFact</a>, and <a href="http://twitter.com/probfact">ProbFact</a>. The newest account <a href="http://twitter.com/GrokEM">GrokEM</a> has the least followers for now.</p>
<p>Thank you everyone for following and for providing feedback.</p>
<p><strong>Related posts</strong>:</p>
<p><a href="http://www.johndcook.com/blog/2011/05/18/subscribe-twitter-rss/">How to subscribe to a Twitter post via RSS</a><br />
<a href="http://www.johndcook.com/blog/2011/03/18/daily-tip-accounts-broader-than-names-imply/">Daily tip accounts broader than their names imply</a></p>
<img src="http://feeds.feedburner.com/~r/TheEndeavour/~4/8aAzr5OgqQc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2012/01/31/twitter-milestone/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.johndcook.com/blog/2012/01/31/twitter-milestone/</feedburner:origLink></item>
		<item>
		<title>Wiggle paradox</title>
		<link>http://feedproxy.google.com/~r/TheEndeavour/~3/cqcUwU8pNLA/</link>
		<comments>http://www.johndcook.com/blog/2012/01/31/wiggle-paradox/#comments</comments>
		<pubDate>Tue, 31 Jan 2012 13:10:54 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Math]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=10574</guid>
		<description><![CDATA[Sometimes a graph looks wiggly because it&#8217;s actually quite flat.
This isn&#8217;t much of a paradox; the resolution is quite simple. A graph may look wiggly because the scale is wrong. If the graph is flat, graphing software may automatically choose narrow vertical range, accentuating noise in the graph. I haven&#8217;t heard a name for this, [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes a graph looks wiggly because it&#8217;s actually quite flat.</p>
<p>This isn&#8217;t much of a paradox; the resolution is quite simple. A graph may look wiggly because the scale is wrong. If the graph is flat, graphing software may automatically choose narrow vertical range, accentuating noise in the graph. I haven&#8217;t heard a name for this, though I imagine someone has given it a name.</p>
<p>Here&#8217;s an extreme example. The following graph was produced by the Mathematica command <code>Plot[Gamma[x+1] - x Gamma[x], {x, 0, 1}]</code>.</p>
<p style="text-align:center"><img src="http://www.johndcook.com/noise.png" alt="" width="400" height="224" /></p>
<p>This is unsettling the first time you run into it, until you notice the vertical scale. In theory, Γ(<em>x</em> + 1) and <em>x</em> Γ(<em>x</em>) are exactly equal. In practice, a computer returns slightly different values for the two functions for some arguments. The differences are on the order of 10<sup>-15</sup>, the limit of floating point precision. Mathematica looks at the range of the function being plotted and picks the default vertical scaling accordingly.</p>
<p>In the example above, the vertical scale is 15 orders of magnitude smaller than the horizontal scale. The line is smooth as glass. Actually, it&#8217;s <strong>much smoother than glass</strong>. An angstrom is only 10 orders of magnitude smaller than a meter, so you wouldn&#8217;t have to look at glass under nearly as much magnification before you see individual atoms. At a much grosser scale you&#8217;d see imperfections in the glass.</p>
<p>The graph above is so jagged that it demands our attention. When the horizontal axis is closer to the proper scale, say off by a factor of 5 or 10, the problem can be more subtle. Here&#8217;s an example that I ran across yesterday.</p>
<p style="text-align:center"><img src="http://www.johndcook.com/badscale.png" alt="" width="400" height="271" /></p>
<p>The curves look awfully jagged, but this is just simulation noise. The function values are probabilities, and when viewed on a scale of probabilities the curves look unremarkable.</p>
<p style="text-align:center"><img src="http://www.johndcook.com/goodscale.png" alt="" width="400" height="271" /></p>
<img src="http://feeds.feedburner.com/~r/TheEndeavour/~4/cqcUwU8pNLA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2012/01/31/wiggle-paradox/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		<feedburner:origLink>http://www.johndcook.com/blog/2012/01/31/wiggle-paradox/</feedburner:origLink></item>
		<item>
		<title>Rule of the last inch</title>
		<link>http://feedproxy.google.com/~r/TheEndeavour/~3/LcFYzB_dlvE/</link>
		<comments>http://www.johndcook.com/blog/2012/01/30/rule-of-the-last-inch/#comments</comments>
		<pubDate>Mon, 30 Jan 2012 14:55:00 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Creativity]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=10558</guid>
		<description><![CDATA[From The First Circle by Alexander Solzhenitsyn:
Now listen to the rule of the last inch. The realm of the last inch. The job is almost finished, the goal almost attained, everything possible  seems to have been achieved, every difficulty overcome — and yet the quality is just not there. The work needs more finish, [...]]]></description>
			<content:encoded><![CDATA[<p>From <a href="http://www.amazon.com/gp/product/0061479012/ref=as_li_ss_tl?ie=UTF8&amp;tag=theende-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0061479012">The First Circle</a> by Alexander Solzhenitsyn:</p>
<blockquote><p>Now listen to the rule of the last inch. The realm of the last inch. The job is almost finished, the goal almost attained, everything possible  seems to have been achieved, every difficulty overcome — and yet the quality is just not there. The work needs more finish, perhaps further research. In that moment of weariness and self-satisfaction, the temptation is greatest to give up, not to strive for the peak of quality. That&#8217;s the realm of the last inch — here, the work is very, very complex, but it&#8217;s also particularly valuable because it&#8217;s done with the most perfect means. The rule of the last inch is simply this — not to leave it undone. And not to put it off — because otherwise your mind loses touch with that realm. And not to mind how much time you spend on it, because the aim is not to finish the job quickly, but to reach perfection.</p></blockquote>
<p>Via <a href="http://sue-still-i-am-one.blogspot.com/2012/01/rule-of-last-inch.html">Still I Am One</a></p>
<p>It can be hard to know when something deserves the kind of polish Solzhenitsyn talks about. Sometimes you&#8217;re in the realm of rapidly diminishing return and it&#8217;s time to move on. Other times, the finishing touches are everything.</p>
<p><strong>Related post</strong>:</p>
<p><a href="http://www.johndcook.com/blog/2011/04/29/scripting-and-the-last-mile-problem/">Scripting and the last mile problem</a></p>
<img src="http://feeds.feedburner.com/~r/TheEndeavour/~4/LcFYzB_dlvE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2012/01/30/rule-of-the-last-inch/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.johndcook.com/blog/2012/01/30/rule-of-the-last-inch/</feedburner:origLink></item>
		<item>
		<title>Speeding up simulation with recurrence relation</title>
		<link>http://feedproxy.google.com/~r/TheEndeavour/~3/pYCTdbUOXOw/</link>
		<comments>http://www.johndcook.com/blog/2012/01/30/simulation-recurrence-relation/#comments</comments>
		<pubDate>Mon, 30 Jan 2012 14:09:18 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Computing]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=10567</guid>
		<description><![CDATA[Last week I wrote about how memoization reduced a simulation&#8217;s execution time from 300 hours down to 38 minutes. This weekend I came up with a different approach that reduces the time down to 21 minutes by taking advantage of a recurrence relation.
The most expensive function in the simulation has four integer arguments. Each time [...]]]></description>
			<content:encoded><![CDATA[<p>Last week I wrote about how <a href="http://www.johndcook.com/blog/2012/01/26/memoization/">memoization</a> reduced a simulation&#8217;s execution time from 300 hours down to 38 minutes. This weekend I came up with a different approach that reduces the time down to 21 minutes by taking advantage of a recurrence relation.</p>
<p>The most expensive function in the simulation has four integer arguments. Each time the function is called, one of the arguments is incremented by 1. A random process determines which argument is incremented each time. This function has a set of recurrence relations that make it faster to calculate a new value if you have a previously computed value for adjacent arguments.</p>
<p>The recurrence relation approach is about 100x faster than the memoization approach for small runs. However, the time per run with memoization decreases with each run. The longer it runs, the more values it caches, and so the greater the chances that a value has already been computed. In the end, the recurrence relation is about 2x faster than the memoization approach. With an even larger run, I suspect the time for the two approaches would be roughly equal.</p>
<p>The new approach is faster, but it was more work to implement, and it depends critically on the assumption that consecutive arguments differ only by one increment of one argument.</p>
<p><strong>Related post</strong>:</p>
<p><a href="http://www.johndcook.com/blog/2012/01/26/memoization/">20 weeks down to 20 minutes</a></p>
<img src="http://feeds.feedburner.com/~r/TheEndeavour/~4/pYCTdbUOXOw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2012/01/30/simulation-recurrence-relation/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.johndcook.com/blog/2012/01/30/simulation-recurrence-relation/</feedburner:origLink></item>
		<item>
		<title>Twenty weeks down to twenty minutes</title>
		<link>http://feedproxy.google.com/~r/TheEndeavour/~3/n5YA9zIBolM/</link>
		<comments>http://www.johndcook.com/blog/2012/01/26/memoization/#comments</comments>
		<pubDate>Fri, 27 Jan 2012 00:39:15 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Computing]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=10549</guid>
		<description><![CDATA[I had a simulation this week that I estimated would take 20 weeks to run. This estimate was based on too small a run. A more reliable estimate based on a longer run was 300 CPU hours, about two weeks running on a single processor. Before I split the problem up to run in parallel, [...]]]></description>
			<content:encoded><![CDATA[<p>I had a simulation this week that I estimated would take 20 weeks to run. This estimate was based on too small a run. A more reliable estimate based on a longer run was 300 CPU hours, about two weeks running on a single processor. Before I split the problem up to run in parallel, I wanted to see if I could make each thread run faster.</p>
<p>The most expensive part of the simulation is a function that takes in four integer parameters and does a numerical integration. Each parameter could be any value from 0 to 120. So in principle there are 121^4 = 214,358,881 possible parameter combinations. I knew that some of these combinations were extremely unlikely or impossible, so I thought I could reduce the execution time by caching the most commonly called parameters. Maybe a few thousand arguments would account for most of the function calls.</p>
<p>I saved the function arguments and computed values in map, a.k.a. dictionary, associative array, etc. (The buzz word for this is <em>memoization</em>.) I set a maximum size on the map because I thought it could grow very large. Even if, say, a thousand arguments accounted for most of the function calls, maybe there were many more that only appeared once.</p>
<p>It turned out that the function was only called with 408 distinct parameter combinations. That means the same integrals were being evaluated millions of times. Caching these values reduced the execution time by a factor of about 800. In other words, the software could retrieve a previously computed value 800x faster than compute it from scratch.</p>
<p>The simulation that would have taken 300 hours took only 22 minutes, and so there was no need to make it run in parallel.</p>
<p><strong>Update</strong>: I found a bug in my hashing algorithm. After fixing the bug, the time to run my simulations increased to 38 minutes. So my speed-up was a about a factor of 420 rather than 800, but still enough to run on one thread over lunch. The number of distinct arguments to the numerical integration was much more than 408 in the corrected program, but still small enough to cache.</p>
<img src="http://feeds.feedburner.com/~r/TheEndeavour/~4/n5YA9zIBolM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2012/01/26/memoization/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		<feedburner:origLink>http://www.johndcook.com/blog/2012/01/26/memoization/</feedburner:origLink></item>
		<item>
		<title>The most brutal man page</title>
		<link>http://feedproxy.google.com/~r/TheEndeavour/~3/yFfxAdDJc7k/</link>
		<comments>http://www.johndcook.com/blog/2012/01/25/most-brutal-man-page/#comments</comments>
		<pubDate>Thu, 26 Jan 2012 03:14:02 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=10538</guid>
		<description><![CDATA[In The Linux Command Line, the author describes the bash man page* as &#8220;the most brutal man page of them all.&#8221;
Many man pages are hard to read, but I think that the grand prize for difficulty has to go to the man page for bash. As I was doing my research for this book, I [...]]]></description>
			<content:encoded><![CDATA[<p>In <a href="http://www.amazon.com/gp/product/1593273894/ref=as_li_ss_tl?ie=UTF8&amp;tag=theende-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=1593273894">The Linux Command Line</a>, the author describes the <code>bash</code> man page* as &#8220;the most brutal man page of them all.&#8221;</p>
<blockquote><p>Many man pages are hard to read, but I think that the grand prize for difficulty has to go to the man page for <code>bash</code>. As I was doing my research for this book, I gave it a careful review to ensure that I was covering most of its topics. When printed, it’s over 80 pages long and extremely dense, and its structure makes absolutely no sense to a new user.</p>
<p>On the other hand, it is very accurate and concise, as well as being extremely complete. So check it out if you dare, and look forward to the day when you can read it and it all makes sense.</p></blockquote>
<p>* If you&#8217;re not familiar with Unix lingo, &#8220;man&#8221; stands for &#8220;manual&#8221;. Man pages are online documentation.</p>
<p><strong>Related post</strong>:</p>
<p><a href="http://www.johndcook.com/blog/2012/01/25/the-linux-command-line/">Review of The Linux Command Line</a></p>
<img src="http://feeds.feedburner.com/~r/TheEndeavour/~4/yFfxAdDJc7k" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2012/01/25/most-brutal-man-page/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		<feedburner:origLink>http://www.johndcook.com/blog/2012/01/25/most-brutal-man-page/</feedburner:origLink></item>
		<item>
		<title>Review: The Linux Command Line</title>
		<link>http://feedproxy.google.com/~r/TheEndeavour/~3/f6KPfjgC4ug/</link>
		<comments>http://www.johndcook.com/blog/2012/01/25/the-linux-command-line/#comments</comments>
		<pubDate>Wed, 25 Jan 2012 13:00:33 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[Books]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=10515</guid>
		<description><![CDATA[No Starch Press recently released The Linux Command Line: A Complete Introduction by William E. Shotts, Jr.
True to its name, the book is about using Linux from command line. It&#8217;s not an encyclopedia of Linux. It doesn&#8217;t explain how to install Linux, doesn&#8217;t go into system APIs, and says little about how to administer Linux. [...]]]></description>
			<content:encoded><![CDATA[<p>No Starch Press recently released <a href="http://www.amazon.com/gp/product/1593273894/ref=as_li_ss_tl?ie=UTF8&amp;tag=theende-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=1593273894">The Linux Command Line: A Complete Introduction</a> by William E. Shotts, Jr.</p>
<p>True to its name, the book is about using Linux from command line. It&#8217;s not an encyclopedia of Linux. It doesn&#8217;t explain how to install Linux, doesn&#8217;t go into system APIs, and says little about how to administer Linux. At the same time, the book is broader than just a book on <code>bash</code>. It&#8217;s about how to &#8220;live&#8221; at the command line.</p>
<p>The introduction explains the intended audience.</p>
<blockquote><p>This book is for Linux users who have migrated from other platforms. Most likely you are a &#8220;power user&#8221; of some version of Microsoft Windows.</p></blockquote>
<p>The book has a conversational style, explaining the motivation behind ways of working as well as providing technical detail. It includes small but very useful suggestions along the way, the kinds of tips you&#8217;d pick up from a friend but might not find in a book.</p>
<p>The book has four parts</p>
<ol>
<li>Learning the shell</li>
<li>Configuration and the environment</li>
<li>Common tasks and essential tools</li>
<li>Writing shell scripts</li>
</ol>
<p>The book could have just included the first three sections; the forth part is a bit more specialized than the others. If you&#8217;d prefer, think of the book has having three parts, plus a lengthy appendix on shell scripting.</p>
<p>The Linux Command Line is pleasant to read. It has a light tone, while also getting down to business.</p>
<p><a href="http://www.amazon.com/gp/product/1593273894/ref=as_li_ss_il?ie=UTF8&amp;tag=theende-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=1593273894"><img src="http://ws.assoc-amazon.com/widgets/q?_encoding=UTF8&amp;Format=_SL160_&amp;ASIN=1593273894&amp;MarketPlace=US&amp;ID=AsinImage&amp;WS=1&amp;tag=theende-20&amp;ServiceVersion=20070822" border="0" alt="" /></a><img style="border:none !important; margin:0px !important;" src="http://www.assoc-amazon.com/e/ir?t=theende-20&amp;l=as2&amp;o=1&amp;a=1593273894" border="0" alt="" width="1" height="1" /></p>
<p><strong>Related post</strong>:<br />
<a href="http://www.johndcook.com/blog/2011/08/06/perverse-hipster-desire-for-retro-computing/"><br />
Perverse hipster desire for retro-computing</a></p>
<img src="http://feeds.feedburner.com/~r/TheEndeavour/~4/f6KPfjgC4ug" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2012/01/25/the-linux-command-line/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		<feedburner:origLink>http://www.johndcook.com/blog/2012/01/25/the-linux-command-line/</feedburner:origLink></item>
		<item>
		<title>Color-coded surgery</title>
		<link>http://feedproxy.google.com/~r/TheEndeavour/~3/mgwxt4WU89w/</link>
		<comments>http://www.johndcook.com/blog/2012/01/24/color-coded-surgery/#comments</comments>
		<pubDate>Wed, 25 Jan 2012 04:08:59 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Science]]></category>
		<category><![CDATA[Cancer]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=10511</guid>
		<description><![CDATA[This is the most encouraging thing I&#8217;ve seen in cancer research in some time: a way to make tumors fluoresce. This allows surgeons to see tumor boundaries.

From TED
]]></description>
			<content:encoded><![CDATA[<p>This is the most encouraging thing I&#8217;ve seen in cancer research in some time: a way to make tumors fluoresce. This allows surgeons to see tumor boundaries.</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="400" height="284" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="wmode" value="transparent" /><param name="bgColor" value="#ffffff" /><param name="flashvars" value="vu=http://video.ted.com/talk/stream/2011P/Blank/QuyenNguyen_2011P-320k.mp4&amp;su=http://images.ted.com/images/ted/tedindex/embed-posters/QuyenNguyen_2011P-embed.jpg&amp;vw=512&amp;vh=288&amp;ap=0&amp;ti=1302&amp;lang=&amp;introDuration=15330&amp;adDuration=4000&amp;postAdDuration=830&amp;adKeys=talk=quyen_nguyen_color_coded_surgery;year=2011;theme=tales_of_invention;theme=women_reshaping_the_world;theme=medicine_without_borders;event=TEDMED+2011;tag=Science;tag=Technology;tag=cancer;tag=medicine;&amp;preAdTag=tconf.ted/embed;tile=1;sz=400x284;" /><param name="src" value="http://video.ted.com/assets/player/swf/EmbedPlayer.swf" /><param name="bgcolor" value="#ffffff" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="400" height="284" src="http://video.ted.com/assets/player/swf/EmbedPlayer.swf" flashvars="vu=http://video.ted.com/talk/stream/2011P/Blank/QuyenNguyen_2011P-320k.mp4&amp;su=http://images.ted.com/images/ted/tedindex/embed-posters/QuyenNguyen_2011P-embed.jpg&amp;vw=512&amp;vh=288&amp;ap=0&amp;ti=1302&amp;lang=&amp;introDuration=15330&amp;adDuration=4000&amp;postAdDuration=830&amp;adKeys=talk=quyen_nguyen_color_coded_surgery;year=2011;theme=tales_of_invention;theme=women_reshaping_the_world;theme=medicine_without_borders;event=TEDMED+2011;tag=Science;tag=Technology;tag=cancer;tag=medicine;&amp;preAdTag=tconf.ted/embed;tile=1;sz=400x284;" bgcolor="#ffffff" wmode="transparent" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>From <a href="http://www.ted.com/talks/lang/en/quyen_nguyen_color_coded_surgery.html">TED</a></p>
<img src="http://feeds.feedburner.com/~r/TheEndeavour/~4/mgwxt4WU89w" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2012/01/24/color-coded-surgery/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://www.johndcook.com/blog/2012/01/24/color-coded-surgery/</feedburner:origLink></item>
		<item>
		<title>Boundary conditions are the hard part</title>
		<link>http://feedproxy.google.com/~r/TheEndeavour/~3/4F5oZpzadkk/</link>
		<comments>http://www.johndcook.com/blog/2012/01/24/boundary-conditions/#comments</comments>
		<pubDate>Tue, 24 Jan 2012 15:29:30 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Math]]></category>
		<category><![CDATA[Differential equations]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=10490</guid>
		<description><![CDATA[What we call &#8220;differential equations&#8221; are usually not just differential equations. They also have associated initial conditions or boundary conditions.
With ordinary differential equations (ODEs), the initial conditions are often an afterthought. First you find a full set of solutions, then you plug in initial conditions to get a specific solution.
Partial differential equations (PDEs) have boundary [...]]]></description>
			<content:encoded><![CDATA[<p>What we call &#8220;differential equations&#8221; are usually not just differential equations. They also have associated initial conditions or boundary conditions.</p>
<p>With ordinary differential equations (ODEs), the initial conditions are often an afterthought. First you find a full set of solutions, then you plug in initial conditions to get a specific solution.</p>
<p>Partial differential equations (PDEs) have boundary conditions (and maybe initial conditions too). Since people typically learn ODEs first, they come to PDEs expecting boundary values to play a role analogous to ODEs. In a very limited sense they do, but in general boundary values are quite different.</p>
<p>The hard part about PDEs is not the PDEs themselves; the hard part is the boundary conditions. Finding solutions to differential equations in the interior of a domain is easy compared to making the equations have the specified behavior on the boundary.</p>
<p>No model can take everything into account. You have to draw some box around that part of the world that you&#8217;re going to model and specify what happens when your imaginary box meets the rest of the universe. That&#8217;s the hard part.</p>
<p><strong>Related posts</strong>:</p>
<p><a href="http://www.johndcook.com/blog/2011/01/07/three-views-of-differential-equations/">Three views of differential equations</a><br />
<a href="http://www.johndcook.com/blog/2012/01/04/nonlinear-is-not-a-hypothesis/">Nonlinear is not a hypothesis</a><br />
<a href="http://www.johndcook.com/blog/2009/08/11/approximating-a-solution-that-doesnt-exist/">Approximating a solution that does not exist</a></p>
<img src="http://feeds.feedburner.com/~r/TheEndeavour/~4/4F5oZpzadkk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2012/01/24/boundary-conditions/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://www.johndcook.com/blog/2012/01/24/boundary-conditions/</feedburner:origLink></item>
		<item>
		<title>What do colleges sell?</title>
		<link>http://feedproxy.google.com/~r/TheEndeavour/~3/LfowTw7Bk4I/</link>
		<comments>http://www.johndcook.com/blog/2012/01/24/what-do-colleges-sell/#comments</comments>
		<pubDate>Tue, 24 Jan 2012 15:01:50 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Education]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=10509</guid>
		<description><![CDATA[Universities are starting to give away their content online, while they still charge tens of thousands of dollars a year to attend. Just what are they selling? Credentials, accountability, and feedback.
Some people are asking why go to college when you can download a college education via iTunes U.
First, you would have no credentials when you&#8217;re [...]]]></description>
			<content:encoded><![CDATA[<p>Universities are starting to give away their content online, while they still charge tens of thousands of dollars a year to attend. Just what are they selling? Credentials, accountability, and feedback.</p>
<p>Some people are asking why go to college when you can download a college education via iTunes U.</p>
<p>First, you would have no credentials when you&#8217;re done.</p>
<p>Second, you almost certainly would not put in the same amount of work as a college student without someone to pace you through the material and to provide external motivation. You&#8217;d be less likely to struggle through anything you found difficult or uninteresting.</p>
<p>Third, you&#8217;d have no feedback to know whether you&#8217;re really learning what you think you&#8217;re learning.</p>
<p>The people that I hear gush about online education opportunities are well-educated, successful, and ambitious. They may be less concerned about credentials either because they are intrinsically motivated or because they already have enough credentials. And because of their ambition, they need less accountability. They may need less feedback or are resourceful enough to seek out alternative channels for feedback, such as online forums. Resources such <a href="http://www.apple.com/education/itunes-u/">iTunes U</a> and <a href="http://www.thegreatcourses.com/">The Teaching Company</a> are a godsend to such people. But that doesn&#8217;t mean that a typical teenager would make as much of the same opportunities.</p>
<img src="http://feeds.feedburner.com/~r/TheEndeavour/~4/LfowTw7Bk4I" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2012/01/24/what-do-colleges-sell/feed/</wfw:commentRss>
		<slash:comments>26</slash:comments>
		<feedburner:origLink>http://www.johndcook.com/blog/2012/01/24/what-do-colleges-sell/</feedburner:origLink></item>
		<item>
		<title>Grokking electricity</title>
		<link>http://feedproxy.google.com/~r/TheEndeavour/~3/XSJh1lqe3Ek/</link>
		<comments>http://www.johndcook.com/blog/2012/01/23/grokking-electricity/#comments</comments>
		<pubDate>Mon, 23 Jan 2012 13:22:36 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Science]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=10492</guid>
		<description><![CDATA[After I finished an electromagnetism course in college, I said that one day I&#8217;d go back and really understand the subject. Now I&#8217;m starting to do that. I want to understand theory and practical applications, from Maxwell&#8217;s equations to Radio Shack.
I&#8217;m starting by reading the Feynman lectures on E&#38;M. After that I plan to read [...]]]></description>
			<content:encoded><![CDATA[<p>After I finished an electromagnetism course in college, I said that one day I&#8217;d go back and really understand the subject. Now I&#8217;m starting to do that. I want to understand theory and practical applications, from Maxwell&#8217;s equations to Radio Shack.</p>
<p>I&#8217;m starting by reading the <a href="http://www.amazon.com/gp/product/0465024947/ref=as_li_ss_tl?ie=UTF8&amp;tag=theende-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0465024947">Feynman lectures</a> on E&amp;M. After that I plan to read something on electronics. If you have resources you recommend, please let me know.</p>
<p>I&#8217;ve started new Twitter account, <a href="https://twitter.com/#!/GrokEM">@GrokEM</a>. I figure that tweeting about E&amp;M will help me stick to my goal. <a href="http://www.johndcook.com/twitter/">My other Twitter accounts</a> post on a regular schedule (plus a few extras) and are scheduled weeks in advance. GrokEM will be more erratic, at least for now. (In case you&#8217;re not familiar with <em>grok</em>, it&#8217;s a slang for knowing something thoroughly and intuitively.)</p>
<p>Here&#8217;s what Feynman said about mathematicians learning physics, particularly E&amp;M.</p>
<blockquote><p>Mathematicians, or people who have very mathematical minds, are often led astray when &#8220;studying&#8221; physics because they loose sight of the physics. They say: &#8220;Look, these differential equations — the Maxwell equations — are all there is to electrodynamics … if I understand them mathematically inside out, I will understand the physics inside out.&#8221; Only it doesn&#8217;t work that way. … They fail because the actual physical situations in the real world are so complicated that it is necessary to have a much broader understanding of the equations. … A physical understanding is a completely unmathematical, imprecise, and inexact thing, but absolutely necessary for a physicist.</p></blockquote>
<p>Heinlein coined <em>grok</em> around the same time that Feynman made the above remarks. Otherwise, Feynman might have said that only studying differential equations is not the way to grok electrodynamics.</p>
<p><strong>Related posts</strong>:</p>
<p><a href="http://www.johndcook.com/blog/2011/06/02/understand-an-equation/">What it means to understand an equation</a><br />
<a href="http://www.johndcook.com/blog/2011/05/30/feynman-maxwell-equations/">Most important event of the 19th century</a></p>
<img src="http://feeds.feedburner.com/~r/TheEndeavour/~4/XSJh1lqe3Ek" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2012/01/23/grokking-electricity/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		<feedburner:origLink>http://www.johndcook.com/blog/2012/01/23/grokking-electricity/</feedburner:origLink></item>
		<item>
		<title>Educational monoculture</title>
		<link>http://feedproxy.google.com/~r/TheEndeavour/~3/FnCXVyKmJm4/</link>
		<comments>http://www.johndcook.com/blog/2012/01/22/educational-monoculture/#comments</comments>
		<pubDate>Mon, 23 Jan 2012 01:43:47 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Education]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=10504</guid>
		<description><![CDATA[I ran across the term &#8220;educational monoculture&#8221; this weekend. What a great phrase!
Rather than write a long post, I&#8217;ll restrain myself and simply say that I&#8217;d like to hear more people talk about &#8220;educational monoculture.&#8221;
Related post:
Don’t standardize education, personalize it
]]></description>
			<content:encoded><![CDATA[<p>I ran across the term &#8220;educational monoculture&#8221; this weekend. What a great phrase!</p>
<p>Rather than write a long post, I&#8217;ll restrain myself and simply say that I&#8217;d like to hear more people talk about &#8220;educational monoculture.&#8221;</p>
<p><strong>Related post</strong>:</p>
<p><a href="http://www.johndcook.com/blog/2009/05/17/dont-standardize-education-personalize-it/">Don’t standardize education, personalize it</a></p>
<img src="http://feeds.feedburner.com/~r/TheEndeavour/~4/FnCXVyKmJm4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2012/01/22/educational-monoculture/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		<feedburner:origLink>http://www.johndcook.com/blog/2012/01/22/educational-monoculture/</feedburner:origLink></item>
		<item>
		<title>Oscillating Fibonacci ratios</title>
		<link>http://feedproxy.google.com/~r/TheEndeavour/~3/lj7L-UPILs8/</link>
		<comments>http://www.johndcook.com/blog/2012/01/20/oscillating-fibonacci-ratios/#comments</comments>
		<pubDate>Fri, 20 Jan 2012 13:30:04 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Math]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=10480</guid>
		<description><![CDATA[You may know that ratios of consecutive Fibonacci numbers tend to the golden ratio in the limit. But do know how they tend to the limit? The ratio oscillates, one above the golden ratio, the next below, each getting closer. The plot shows F(n+1) / F(n) where F(n) is the nth Fibonacci number. The height [...]]]></description>
			<content:encoded><![CDATA[<p>You may know that ratios of consecutive Fibonacci numbers tend to the golden ratio in the limit. But do know <em>how</em> they tend to the limit? The ratio oscillates, one above the golden ratio, the next below, each getting closer. The plot shows <em>F</em>(<em>n</em>+1) / <em>F</em>(<em>n</em>) where <em>F</em>(<em>n</em>) is the <em>n</em>th Fibonacci number. The height of the horizontal line is the golden ratio.</p>
<p style="text-align:center"><img src="http://www.johndcook.com/fibonacci_ratios.png" alt="plot" width="400" height="302" /></p>
<p>We can prove that the ratio oscillates by starting with the formula</p>
<p style="text-align:center"><img src="http://www.johndcook.com/fibonacci_formula.png" alt="F(n) = \frac{ \phi^n - (-1)^n \phi^{-n} }{ \sqrt{5} }" width="168" height="42" /></p>
<p>where φ = (1 + √5)/2 is the golden ratio.</p>
<p>From there we can work out that</p>
<p style="text-align:center"><img src="http://www.johndcook.com/fibonacci_ratio_phi_diff.png" alt="\frac{F(n+1)}{F(n)} - \phi = (-1)^n \frac{ \phi + \phi^{-1}}{\phi^{2n} + (-1)^{n+1}}" width="262" height="41" /></p>
<p>This shows that when <em>n</em> is odd, <em>F</em>(<em>n</em>+1) / <em>F</em>(<em>n</em>) is below the golden ratio and when <em>n</em> is even it is above. It also shows that the absolute error in approximating the golden ratio by <em>F</em>(<em>n</em>+1) / <em>F</em>(<em>n</em>) goes down by a factor of about φ<sup>2</sup> each time <em>n</em> increases by 1.</p>
<p><strong>Related posts</strong>:</p>
<p><a href="http://www.johndcook.com/blog/2008/02/15/honeybee-geneology/">Honeybee genealogy</a><br />
<a href="http://www.johndcook.com/blog/2008/04/23/fibonacci-numbers-at-work/">Fibonacci numbers at work</a><br />
<a href="http://www.johndcook.com/blog/2009/05/19/golden-ratio-rational-approximation/">Breastfeeding and the golden ratio</a></p>
<img src="http://feeds.feedburner.com/~r/TheEndeavour/~4/lj7L-UPILs8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2012/01/20/oscillating-fibonacci-ratios/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		<feedburner:origLink>http://www.johndcook.com/blog/2012/01/20/oscillating-fibonacci-ratios/</feedburner:origLink></item>
		<item>
		<title>Rushing to see numbers</title>
		<link>http://feedproxy.google.com/~r/TheEndeavour/~3/h4ErXIZsfL0/</link>
		<comments>http://www.johndcook.com/blog/2012/01/19/rushing-to-see-numbers/#comments</comments>
		<pubDate>Thu, 19 Jan 2012 14:10:07 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[Math]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=10476</guid>
		<description><![CDATA[Scientific programmers and algebra students start out with analogous bad habits.
Beginning algebra students rush to enter numbers into a calculator. They find it comforting to reduce expressions to floating point numbers as frequently as possible. This is understandable, but it&#8217;s a habit they need to break for numerous reasons: it&#8217;s more work, harder for a [...]]]></description>
			<content:encoded><![CDATA[<p>Scientific programmers and algebra students start out with analogous bad habits.</p>
<p>Beginning algebra students rush to enter numbers into a calculator. They find it comforting to reduce expressions to floating point numbers as frequently as possible. This is understandable, but it&#8217;s a habit they need to break for numerous reasons: it&#8217;s more work, harder for a grader to follow, less accurate, etc. Better to do as much calculation as possible with symbols, then stick in numbers at the end.</p>
<p>A similar phenomena happens in scientific programming. We&#8217;re anxious to see numbers, so we print out numbers as soon as we produce them. There&#8217;s a tendency to sprinkle code with <code>printf</code> statements, then write scripts to scrape text output to gather results.</p>
<p>It&#8217;s better to keep numbers in data structures as long as possible, then dump the data to text as the last step. Why? For one thing, the output format might change: instead of a text dump, maybe you&#8217;ll want to put the data in a database or format it as an HTML table. More importantly, the &#8220;last step&#8221; will often change. What was the last step now becomes the next-to-last step because you think of something else to do. So you do more with the data in memory before producing output, rather than scraping the text output.</p>
<p>I quickly learned to delay plugging numbers into algebraic expressions. It took me longer to learn not to output numeric results until the last moment.</p>
<img src="http://feeds.feedburner.com/~r/TheEndeavour/~4/h4ErXIZsfL0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2012/01/19/rushing-to-see-numbers/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		<feedburner:origLink>http://www.johndcook.com/blog/2012/01/19/rushing-to-see-numbers/</feedburner:origLink></item>
		<item>
		<title>Funny and serious</title>
		<link>http://feedproxy.google.com/~r/TheEndeavour/~3/HWoH_TOYi9A/</link>
		<comments>http://www.johndcook.com/blog/2012/01/19/funny-and-serious/#comments</comments>
		<pubDate>Thu, 19 Jan 2012 14:08:05 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=10482</guid>
		<description><![CDATA[G. K. Chesterton on being funny and being serious:
Mr. McCabe thinks that I am not serious but only funny, because Mr. McCabe thinks that funny is the opposite of serious. Funny is the opposite of not funny, and of nothing else. … Whether a man chooses to tell the truth in long sentences or short [...]]]></description>
			<content:encoded><![CDATA[<p>G. K. Chesterton on being funny and being serious:</p>
<blockquote><p>Mr. McCabe thinks that I am not serious but only funny, because Mr. McCabe thinks that funny is the opposite of serious. <strong>Funny is the opposite of not funny, and of nothing else</strong>. … Whether a man chooses to tell the truth in long sentences or short jokes is a problem analogous to whether he chooses to tell the truth in French or German. Whether a man preaches his gospel grotesquely or gravely is merely like the question of whether he preaches it in prose or verse. … The truth is, as I have said, that in this sense the two qualities of fun and seriousness have nothing whatever to do with each other, they are no more comparable than black and triangular.</p></blockquote>
<p>Emphasis added. From <a href="http://www.amazon.com/gp/product/1463534256/ref=as_li_ss_tl?ie=UTF8&amp;tag=theende-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=1463534256">Heretics</a>. Text available online from <a href="http://www.gutenberg.org/ebooks/470">Project Gutenberg</a>.</p>
<img src="http://feeds.feedburner.com/~r/TheEndeavour/~4/HWoH_TOYi9A" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2012/01/19/funny-and-serious/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.johndcook.com/blog/2012/01/19/funny-and-serious/</feedburner:origLink></item>
		<item>
		<title>Walking away from factory work</title>
		<link>http://feedproxy.google.com/~r/TheEndeavour/~3/9sz44QDaVBE/</link>
		<comments>http://www.johndcook.com/blog/2012/01/17/rejecting-factory-work/#comments</comments>
		<pubDate>Wed, 18 Jan 2012 03:45:13 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Business]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=10471</guid>
		<description><![CDATA[From Shop Class as Soulcraft,
Given their likely acquaintance such a cognitively rich world of work, it is hardly surprising that when Henry Ford introduced the assembly line in 1913, workers simply walked out. One of Ford&#8217;s biographers wrote, &#8220;So great was labor&#8217;s distaste for the new machine system that toward the close of 1913 every [...]]]></description>
			<content:encoded><![CDATA[<p>From <a href="http://www.amazon.com/gp/product/0143117467/ref=as_li_ss_tl?ie=UTF8&amp;tag=theende-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0143117467">Shop Class as Soulcraft</a>,</p>
<blockquote><p>Given their likely acquaintance such a cognitively rich world of work, it is hardly surprising that when Henry Ford introduced the assembly line in 1913, workers simply walked out. One of Ford&#8217;s biographers wrote, &#8220;So great was labor&#8217;s distaste for the new machine system that toward the close of 1913 every time the company wanted to add 100 men to its factory personnel, it was necessary to hire 963.&#8221;</p></blockquote>
<p>A dozen years ago people would talk of building &#8220;software factories&#8221; to crank out software projects. Back then someone tried to get me excited about joining an effort to create such a factory. I told him I did not want to work in a factory. He tried to back-peddle, saying that it&#8217;s not what it sounds like. But I&#8217;m sure it was exactly what it sounded like.</p>
<p><a href="http://www.amazon.com/gp/product/0143117467/ref=as_li_ss_il?ie=UTF8&amp;tag=theende-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0143117467"><img src="http://ws.assoc-amazon.com/widgets/q?_encoding=UTF8&amp;Format=_SL160_&amp;ASIN=0143117467&amp;MarketPlace=US&amp;ID=AsinImage&amp;WS=1&amp;tag=theende-20&amp;ServiceVersion=20070822" border="0" alt="" /></a><img style="border:none !important; margin:0px !important;" src="http://www.assoc-amazon.com/e/ir?t=theende-20&amp;l=as2&amp;o=1&amp;a=0143117467" border="0" alt="" width="1" height="1" /></p>
<img src="http://feeds.feedburner.com/~r/TheEndeavour/~4/9sz44QDaVBE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2012/01/17/rejecting-factory-work/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		<feedburner:origLink>http://www.johndcook.com/blog/2012/01/17/rejecting-factory-work/</feedburner:origLink></item>
	</channel>
</rss><!-- Dynamic Page Served (once) in 1.235 seconds -->

