But as you can see from the comment, the series converges very slowly!
Wednesday, February 15, 2017
more Π obscurantism
Friday, June 3, 2016
segment intersection search
Here's a simple method I learned from Gareth Rees for finding the intersection (or parallel / collinear status) of two line segments. Rees credits Ronald Goldman, though I'd imagine the technique goes further back.
Monday, March 28, 2016
today in oblique approaches
Wednesday, February 17, 2016
ikeda map
In these images, I've plotted the real and imaginary components along the x and y axes respectively. But the more popular way to visualize this attractor adds an extra parameter to the system and is expressed in trigonometric functions. Such adaptation of the code below yields these results.
Saturday, February 13, 2016
hénon attractor
French astronomer Michel Hénon reported on this strange, fractal attractor in 1976. Since then, it has been among the most studied examples of chaotic dynamical systems.
Tuesday, January 26, 2016
langton's ant
For a round of code golf, I wrote this spare implementation of Chris Langton's remarkably simple universal computer. If you want amenities like pause, random starting pattern or even quit, check out this more complete version.
Wednesday, December 23, 2015
connett circles
martin attractor
Clicking the window adjusts the viewport position; there is also an alternate version with color and animation.
Also, for a certain Rubyist friend, I wrote another lazily-evaluated, colored and animated implementation in Ruby.
Tuesday, December 22, 2015
lyapunov fractals
It took me some experimentation to figure out how to color this derivation of the logistic map; I'm still not quite sure how the hues should scale as you zoom. But the bi-tonal method shown below works well enough to produce the image at left - click it for more detail.
Tuesday, December 15, 2015
the mandelbrot set
What programmer hasn't at some point written an implementation of Benoit Mandelbrot's great discovery, the most famous fractal in the world? Here's my own minimal version, with the simplest possible coloring scheme. To interact with it, just click any two points: the window will zoom in on the rectangle they define.
Monday, November 2, 2015
a lava lamp
This 'lava lamp' is actually a simple cyclic cellular automaton; the CA rule is courtesy of Jason Rampe. In keeping with the spirit of Haskell, I chose to implement it with a hashmap of points rather than an array. Needless to say, that's not practical; but this is just a demonstration.
Wednesday, August 19, 2015
random undirected graphs
This little program generates random, undirected graphs without loops or isolated vertices (though the graph is not necessarily connected).
I have found it useful to generate random inputs for testing graph algorithms.
Wednesday, July 8, 2015
sqrt 2, visualized
The program makes for an interesting screensaver, but does it follow any pattern, or illustrate any special properties of √2 ? Though I'm no mathematician, from what I've read this seems unlikely. √2 is suspected (but not proved) to be a normal number. This would mean the digits of its expansion (respective to some number base) follow a uniform distribution; no digit would be more likely to appear than any other.
Nonetheless, I'd be curious to see the results of a really long run!
Sunday, June 28, 2015
triangle geometry
Here's a trivial post, mostly just to show off how nice mathematical code can look in Haskell. It illustrates the centroid, incircle, and circumcircle of a random triangle, with everything defined in terms of vertex triples. The viewport centers on the circumcenter, and the triangle's interior is filled using barycentric coordinates.
Monday, March 30, 2015
primitive totalistic automata
This code renders any of the 2187 possible 3-colored, 1-dimensional, totalistic cellular automata. I was charmed by these and many other beautiful demonstrations in Stephen Wolfram's notorious compendium, though I regret I can't say the same for its tendentious style.
The program input is an integer representing the intended CA rule in base 3.