Hazard

Mental Math with Stack-Based Programming February 16, 2017

I’ve dabbled in mental math algorithms since I was a kid but never really got an intuitive feel for it. As I’ve done more programming, I’ve had a couple of insights that have helped me understand how to create and express mental math algorithms.... Read More

Signal Processing with Stateful Transducers January 17, 2017

I finally sat down a couple months ago to wrap my mind about transducers. Reading about transducers never gave me an intuitive feel for them, so this summer when I had a signal processing problem, it gave me a great opportunity to play with and really understand how to use and compose transducers.... Read More

Drawing the Solar System January 2, 2017

Several years ago I wanted to calculate the distance between Earth and Mars given an arbitrary future date. I wasn’t satisfied by the free solar system simulators I found, so I looked into calculating it myself. The write-ups I found usually offered long, non-intuitive expressions of four or five trig functions. I eventually discovered PyEphem would do what I wanted, but I never quite let go of being able to do the calculations myself; there had to be a more intuitive way to express the math. Turns out, there is.... Read More

Lindenmayer Fractals December 26, 2016

Season’s greetings! Today I’m playing with turtle graphics, Lindenmayer systems, and fractals.... Read More

Simulated Annealing December 15, 2016

After gradient descent was unsatisfactory for fitting a trend line, I turned to simulated annealing. Simulated annealing is a more sophisticated algorithm, but still relatively straight-forward. Compared to gradient descent, it’s much less intuitive. I’m indebted to Katrina Geltman for her excellent writeup and code examples.... Read More

Gradient Descent December 11, 2016

For a long time I’ve wanted to be able to calculate trend lines for data sets, so I was consistently disappointed in school when professors avoided the actual computations of good parameters and turned the work out to a software package. Recently I had some data needing a trend line, so I took a stab at fitting it myself.... Read More

Organizing Colors December 1, 2016

I worked as a software consultant for several years, and I implemented a variety of website designs. One of the more challenging ones was a very skeumorphic design that used lots of gradients and shadows to create visual depth. Between dozens of mockups and a couple different CSS coders (and possibly a bug in the Sketch eyedrop tool), the color palette eventually comprised about 60 different colors. Some were visually indistinguishable from others, so I went on a hunt for colors I could replace with equivalent shades. Needing a way to organize colors, I created Swatch.... Read More

Minimax November 21, 2016

Several months ago I skimmed through a borrowed copy of Paradigms of Artificial Intelligence Programming by Peter Norvig. It’s nearly 1,000 pages and far too useful to borrow, so I bought a copy of my own. I’ve been thinking about minimax on and off for a few weeks, and with Norvig’s help I finally sat down to implement it.... Read More

Island Generator November 9, 2016

I love maps, so when I saw a procedurally generated island on Job’s screen, I naturally rolled up next to him to find out more. He showed me a couple example islands, and I grilled him on his algorithm so I could draw my own. Job’s technique doesn’t create any topography, only coastal outlines. Let’s start with a regular polygon.... Read More

To Hazard a Guess November 2, 2016

Several years ago I read the book Little Bets. In it, Peter Sims illustrated the value of low-risk, informative experiments in place of big, chancy gambles. I naturally gravitate toward massive, unfinishable projects, but Little Bets turned my attention to the virtue of small endeavors. Small projects are not only finishable, but often more interesting; they elide the mundane details of more ambitious projects.... Read More