Code

Consecutive Primes

January 1, 2011   ·   By   ·   2 Comments   ·   Posted in Code

This morning I woke up to see this tweet:

Twitter / @math prof: 2011 is also the sum of 11 ...

Read more…

Turtle Graphics with Dexy

December 31, 2010   ·   By   ·   Comments Off   ·   Posted in Code

Here’s a fun Python demo for Dexy involving turtle graphics. Python has a built-in turtle graphics library, letting you play with the turtle commands you might remember from Logo (although wihout the lisp).

After LOTS of digging in my stubborn determination to figure out a way to render or save the graphics, I found that Tkinter canvases have the option to render their contents in postscript format, so after writing two new Dexy filters we can automate the entire process as follows:

{
  "turtle-*.py|py|ps2pdf|pdf2png" : {}
}

Read more…