## Archives for math

### Machine Learning: a review

This is my review of Coursera’s Machine Learning course, as taught by Andrew Ng of Stanford University. Machine Learning (hereafter, ML) was my first exposure to the world of massive open online courses. I had heard good things about the ML course, so I decided to take the plunge. I was very curious about one […]

### A note on fractions

I ran across a blog post called Why 0.1 Does Not Exist In Floating-Point. The author uses long division in binary to demonstrate his point. This is understandable, given that the host blog is called Exploring Binary, but there is a an easier way to determine whether the fraction p/q has a terminating floating point […]

### Equational Reasoning

Alan Dipert tweeted an interesting puzzle: pop quiz: solve http://www.4clojure.com/problem/107 point-free. answer must be a function value! #clojure The 4clojure version of the problem is simple enough, but the added requirement of a point-free solution makes Alan’s version of the problem harder. And harder to resist. So I took a shot at it. My plan […]

### Monty Hall problem

There is currently an active discussion of the Monty Hall problem on the Clojure discussion group. The discussion centers on the simulation of the problem; here I want to look at it from first principles. The problem is actually an easy one to reason about when looked at from the right perspective. Here is how […]

### Lazy coins

Here’s a problem I ran across on the CompSci Stack Exchange. Suppose you have a biased coin that comes up heads with probability p. You don’t know what p is, but assume it is neither 0 nor 1. How can you use the coin to simulate a fair coin, i.e. one that produces heads with […]

### bind, unit, and all that

I’ve given in to the unholy urge to write a monad tutorial. Here are some remarks that might help you decide whether it’s worth your time to read on. My intended readers are programmers interested in functional programming, not mathematicians. No category theory is required. All the code will be in Clojure. The level of […]

### The expressiveness of functional programming

I’d like to revisit the discrete convolution problem described in my previous post, to consider the expressiveness of functional programming. Here I am interested in the power of code to communicate intent; the bare metal speed of the code is secondary. The various comments and proposed implementations in this Google Groups thread are what got […]

### Discrete convolution of finite vectors

Isaac Hodes posted a request to both StackOverflow and the Clojure mailing list, asking for some help implementing a discrete convolution function in Clojure. I am trying to create a lazy/functional/efficient/Clojuresque function to carry out convolution on two lists/vectors of (ideally BigDecimals but that may be inefficient) doubles. … Right now, it seems as though […]

### British Lottery Puzzle

Have I mentioned that I’m a sucker for probability puzzles? I found this one at ibbly.com: Two teams from opposite ends of the country have been drawn to play each other in a competition. They need to determine which team plays at home and do so fairly at a distance. They decide to try to […]

### The Matchbook Problem

I have been reading a lovely book by Paul Nahin, Digital Dice. The book is subtitled Computational Solutions to Practical Probability Problems. I don’t know how practical the problems are, but they are a lot of fun. Probability theory is rife with seemingly simple problems which turn out to be less simple than first appears. […]