Open source dissertation

Three cheers for Brent Yorgey! He’s finishing up his dissertation, and he’s posting drafts online, including a GitHub repo of the source.

Cheer 1: He’s not being secretive, fearing that someone will scoop his results. There have been a few instances of one academic scooping another’s research, but these are rare and probably not worth worrying about. Besides, a public GitHub repo is a pretty good way to prove your priority.

Cheer 2: Rather than being afraid someone will find an error, he’s inviting a world-wide audience to look for errors.

Cheer 3: He’s writing a dissertation that someone might actually want to read! That’s not the fastest route to a degree. It’s even actively discouraged in some circles. But it’s generous and great experience.

 

 

 

Read More

Twitter news

Starting next week, @MedVocab will post two tweets a day, once in the morning and once in the afternoon (CDT).

I’ve stopped posting to @DailySymbol. It was a fun experiment, but it was time to wrap it up.

My most popular account, @CompSciFact, now has over 100,000 followers. It’s interesting how some Twitter accounts take off and some don’t. CompSciFact has done quite well but I’ve shut down several other accounts that never gained much of a following.

You can find a list of my accounts here with a very brief description of each. Some of the accounts are a little broader than the name implies.

 

Read More

Engineering a waterpark

This weekend my family went to Schlitterbahn, a waterpark in New Braunfels, Texas. (The German-sounding name of the park and the city are evidence of the large number of Germans that settled in this part of Texas.) I thought about several engineering questions while we were there.

Most of the rides involve sitting in an inner tube and floating down a course with rapids, waterfalls, swells, etc. At many points there are back currents. You could be headed toward a fall but then find yourself reversing direction. It’s surprising to have to work to make yourself go downhill. At most if not all these points there are employees standing in the water to grab hold of rafts and pull people in the right direction who need a little help.

One question I had is what causes the back currents. Ultimately you could solve Navier-Stokes equations, but it would be nice to understand at a more rule-of-thumb level how these currents work. It would also be interesting to see whether a park could reduce the number of guides while keeping the rides as fun. The guides also serve as lifeguards, so the park may need to position people in all the same spots even if they didn’t need as many guides.

The slowest person in the family was consistently yours truly. I’d start out in front and inevitably end up bringing up the rear. I was curious how I could be so inept at a mostly passive activity.

I was also curious how they designed the rapids to be so safe. You’re repeatedly tossed straight toward rocks — perfectly smooth artificial rocks, but still not not things you want to hit your head on — at a fairly high speed, and yet you never hit one. It has something to do with how they position jets to push you away from the rocks, but that would be interesting to understand in more detail.

Another thing I was curious about is what the park does with its water in the off-season. Schlitterbahn in New Braunfels is actually two parks, an older park that uses untreated water from the Comal river, and a newer park that uses treated water. When the parks close for the season, the older park must just let its water return to the river. (At least one of the rides ends in the river, so they’re already returning water to the river.)

The question of what to do with the treated water in the new park is more interesting. I assume they cannot just dump a huge volume of chlorinated water into the river. Aside from ecological consequences, I wonder whether they’d even want to dump the water. Is it economical to store the water somewhere when the park closes for the year? If not, do they store it anyway because they have no way to dispose of it, or do they treat it so that they can dispose it? I suppose they could circulate the water occasionally while the park is closed, though that seems expensive. I wonder whether different waterparks solve this problem different ways.

If I could propose a new ride for Schiltterbahn, it would be a video presentation about how the park was designed followed by Q&A with a couple engineers. This would be a terrible business decision, but a few visitors would love it.

Read More

Software development becoming less mature?

Michael Fogus posted on Twitter this morning

Computing: the only industry that becomes less mature as more time passes.

The immaturity of computing is used to excuse every ignorance. There’s an enormous body of existing wisdom but we don’t care.

I don’t know whether computing is becoming less mature, though it may very well be on average, even if individual developers become more mature.

One reason is that computing is a growing profession, so people are entering the field faster than they are leaving. That lowers average maturity.

Another reason is chronological snobbery, alluded to in Fogus’s second tweet. Chronological snobbery is pervasive in contemporary culture, but especially in computing. Tremendous hardware advances give the illusion that software development has advanced more than it has. What could I possibly learn from someone who programmed back when computers were 100x slower? Maybe a lot.

Related posts:

A brief note on Moore’s law
Moore’s law and software bloat

Read More

Haskell analog of Sweave and Pweave

Sweave and Pweave are programs that let you embed R and Python code respectively into LaTeX files. You can display the source code, the result of running the code, or both.

lhs2TeX is roughly the Haskell analog of Sweave and Pweave.  This post takes the sample code I wrote for Sweave and Pweave before and gives a lhs2TeX counterpart.

\documentclass{article}
%include polycode.fmt
%options ghci
\long\def\ignore#1{}
\begin{document}

Invisible code that sets the value of the variable $a$.

\ignore{
\begin{code}
a = 3.14
\end{code}
}

Visible code that sets $b$ and squares it. 

(There doesn't seem to be a way to display the result of a block of code directly. 
Seems you have to save the result and display it explicitly in an eval statement.)

\begin{code}
b = 3.15
c = b*b
\end{code}

$b^2$ = \eval{c}

Calling Haskell inline: $\sqrt{2} = \eval{sqrt 2}$

Recalling the variable $a$ set above: $a$ = \eval{a}.

\end{document}

If you save this code to a file foo.lhs, you can run

lhs2TeX -o foo.tex foo.lhs

to create a LaTeX file foo.tex which you could then compile with pdflatex.

One gotcha that I ran into is that your .lhs file must contain at least one code block, though the code block may be empty. You cannot just have code in \eval statements.

Unlike R and Python, the Haskell language itself has a notion of literate programming. Haskell specifies a format for literate comments. lhs2TeX is a popular tool for processing literate Haskell files but not the only one.

Read More

A subway topologist

One of my favorite books when I was growing up was the Mathematics volume in the LIFE Science Library. I didn’t own the book, but my uncle did, and I’d browse through the book whenever I visited him. I was too young at the time to understand much of what I was reading.

One of the pages that stuck in my mind was a photo of Samuel Eilenberg. His name meant nothing to me at the time, but the caption titled “A subway topologist” caught my imagination.

… Polish-born Professor Samuel Eilenberg sprawls contemplatively in his Greenwich Village apartment in New York City. “Sometimes I like to think lying down,” he says, “but mostly I like to think riding on the subway.” Mainly he thinks about algebraic topology — a field so abstruse that even among mathematicians few understand it. …

I loved the image of Eilenberg staring intensely at the ceiling or riding around on a subway thinking about math. Since then I’ve often thought about math while moving around, though usually not on a subway. I’ve only lived for a few months in an area with a subway system.

The idea that a field of math would be unknown to many mathematicians sounded odd. I had no idea at the time that mathematicians specialized.

Algebraic topology doesn’t seem so abstruse now. It’s a routine graduate course and you might get an introduction to it in an undergraduate course. The book was published in 1963, and I suppose algebraic topology would have been more esoteric at the time.

 

Read More

Bringing bash and PowerShell a little closer together

I recently ran across PSReadLine, a project that makes the PowerShell console act more like a bash shell. I’ve just started using it, but it seems promising. I’m switching between Linux and Windows frequently these days and it’s nice to have a little more in common between the two.

I’d rather write a PowerShell script than a bash script, but I’d rather use the bash console interactively. The PowerShell console is essentially the old cmd.exe console. (I haven’t kept up with PowerShell in a while, so maybe there have been some improvements, but it’s my impression that the scripting language has moved forward and the console has not.) PSReadLine adds some bash-like console conveniences such as Emacs-like editing at the command prompt.

Update: Thanks to Will for pointing out Clink in the comments. Clink sounds like it may be even better than PSReadLine.

PowerShell logo

Read More

Making change

How many ways can you make change for a dollar? This post points to two approaches to the problem, one computational and one analytic.

SICP gives a Scheme program to solve the problem:

(define (count-change amount) (cc amount 5))

(define (cc amount kinds-of-coins)
    (cond ((= amount 0) 1)
    ((or (< amount 0) (= kinds-of-coins 0)) 0)
    (else (+ (cc amount
                 (- kinds-of-coins 1))
             (cc (- amount
                    (first-denomination
                     kinds-of-coins))
                     kinds-of-coins)))))

(define (first-denomination kinds-of-coins)
    (cond ((= kinds-of-coins 1) 1)
          ((= kinds-of-coins 2) 5)
          ((= kinds-of-coins 3) 10)
          ((= kinds-of-coins 4) 25)
          ((= kinds-of-coins 5) 50)))

Concrete Mathematics explains that the number of ways to make change for an amount of n cents is the coefficient of z^n in the power series for the following:

\frac{1}{(1 - z)(1 - z^5)(1 - z^{10})(1 - z^{25})(1 - z^{50})}

Later on the book gives a more explicit but complicated formula for the coefficients.

Both show that there are 292 ways to make change for a dollar.

Read More