Category Archives: math

Introducing Math.Combinatorics.Species!

I have just uploaded to Hackage version 0.1 of the species package, a Haskell library for computing with combinatorial species. Much like David Amos’s great series of posts introducing his Haskell for Maths library, I plan to write a series … Continue reading

Posted in combinatorics, haskell, math, projects | Tagged , | 14 Comments

Abstraction, intuition, and the “monad tutorial fallacy”

While working on an article for the Monad.Reader, I’ve had the opportunity to think about how people learn and gain intuition for abstraction, and the implications for pedagogy. The heart of the matter is that people begin with the concrete, … Continue reading

Posted in haskell, learning, math, teaching | Tagged , , , , , | 84 Comments

The Poisson distribution and Stirling numbers

While working on an assignment for my machine learning class, I rediscovered the fact that if X is a random variable from a Poisson distribution with parameter , then where denotes a Stirling number of the second kind. (I actually … Continue reading

Posted in combinatorics, grad school, learning, math | Tagged , , , | 2 Comments

Collecting unstructured information with the monoid of partial knowledge

In my last post, I described what I’m calling the “monoid of partial knowledge”, a way of creating a monoid over sets of elements from a preorder, which is a generalization of the familiar monoid over a set with a … Continue reading

Posted in haskell, math | Tagged , , | 4 Comments

An interesting monoid

The other day I was just sort of letting my mind wander, and I came up with an interesting monoid, which I’m calling the “monoid of partial knowledge”. So I thought I’d write about it here, partly just because it’s … Continue reading

Posted in math | Tagged , , | 3 Comments

Monad.Reader article (Multiset partitions)

I imagine that most who read this blog have already seen it, but for those who haven’t, my article Generating Multiset Partitions has been published in Issue #8 of The Monad.Reader.  In it, I discuss the problem of generating multiset … Continue reading

Posted in haskell, math, writing | Tagged , , , , | 2 Comments

Squarefree numbers in Haskell

A squarefree number is one which is not divisible by any perfect squares. Put another way, the prime factorization of a squarefree number includes at most one copy of any given prime. So, the first few squarefree numbers are 1,2,3,5,6,7,10,11,13,14,15,… … Continue reading

Posted in haskell, math | 17 Comments


Inspired by this totally sweet paper by Calkin & Wilf (read it for more details, it’s very short and quite elegantly written) (no really, you should read it): import Data.Ratio buildHB (x1:x2:xs) = (x1 + x2) : x1 : buildHB … Continue reading

Posted in haskell, math | Leave a comment

Solving an arithmetic puzzle with Haskell

[EDIT: since this post still seems to get a good deal of traffic, I should note that (as you can see if you read the comments) the code I gave here is not quite correct. Still, it's interesting enough that … Continue reading

Posted in haskell, math, puzzle | 7 Comments