Blog Archives

Basics of Sweave and Pweave

Sweave is a tool for embedding R code in a LaTeX file. Pweave is an analogous tool for Python. By putting your code in your document rather than the results of running your code somewhere else, results are automatically recomputed

Tagged with: , , ,
Posted in Python

Running Python and R inside Emacs

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

Tagged with: , , , ,
Posted in Python


The Readability bookmarklet lets you reformat any web to make it easier to read. It strips out flashing ads and other distractions. It uses black text on a white background, wide margins, a moderate-sized font, etc. I use Readability fairly

Tagged with: ,
Posted in Software development, Typography

Computing the inverse of the normal CDF

Someone asked me this week for C++ code to compute the inverse of the normal (Gaussian) distribution function. The code I usually use isn’t convenient to give away because it’s part of a large library, so I wrote a stand-alone

Tagged with: , ,
Posted in Math

Tricky code

I found the following comment inside the source code for TeX in the preface to a function creating Roman numeral representations: Readers who like puzzles might enjoy trying to figure out how this tricky code works; therefore no explanation will be

Tagged with: ,
Posted in Software development

Literate programming and statistics

Sweave, mentioned in my previous post, is a tool for literate programming. Donald Knuth invented literate programming and gives this description of the technique in his book by the same name: I believe that the time is ripe for significantly

Tagged with: , , , ,
Posted in Software development, Statistics

Complementary validation

Edsgar Dijkstra quipped that software testing can only prove the existence of bugs, not the absense of bugs. His research focused on formal techniques for proving the correctness of software, with the implicit assumption that proofs are infallible. But proofs are

Tagged with: , , , ,
Posted in Math, Software development