Category Archives: Math

10 Awesome Theorems & Results

When I look back at various mathematical courses I took, most have at least one theorem that I really liked. Usually I like it because the proof has a surprising trick, sometimes it’s because of the unexpected conclusion, or maybe … Continue reading

Posted in Cryptography, Math | Tagged , | 12 Comments

Visualizing Data Using the Hilbert Curve

Some time ago, a coworker asked me to help him visualize some data. He had a very long series (many millions) of data points, and he thought that plotting a pixel for each one would visualize it well, so he … Continue reading

Posted in Fractals, Graphics, Math, Programming, Python | Tagged , , , | 2 Comments

Fast Peak Autocorrelation

So, I was at geekcon. It was a blast. There were many interesting projects, and I didn’t get to play with them all. I did get to work a bit on the Lunar Lander from last year, and this year … Continue reading

Posted in Algorithms, Math, Programming, Projects, Python, Utility Functions | Tagged , , , , , | Leave a comment

Checking the ulam spiral

In the following post, the Ulam spiral is described. It’s a very simple object – write down consecutive natural numbers starting from 41 in a square spiral. Curiously, the numbers on the diagonal are primes: Reading this post, I immediately … Continue reading

Posted in Math, Programming, Python | Tagged , , , , | 4 Comments

Computing Large Determinants in Python

Story: For my seminar work, I had to calculate the determinant of a large integer matrix. In this case, large meant n>=500. You might say that this isn’t very large and I would agree. However, it is large enough to … Continue reading

Posted in Algorithms, computer science, Math, Programming, Python, Research | Tagged , , , , , | 2 Comments

Fractal Memory Usage and a Big Number

In a previous post I said I’d talk about 4**(4**(4**4)). First, about the number. I first saw it mentioned in a math lesson back in high-school, when the teacher wanted to demonstrate estimation abilities. He wrote it on the board, … Continue reading

Posted in Algorithms, computer science, Fractals, Math, Programming, Python | Tagged , , , | 1 Comment

PyKoan – The Logic Game

As you can probably tell, I’m back from my undeclared hiatus. I’ve got lots of stuff to talk about, and I’ll be starting with PyKoan, one small project I’ve been working on lately in my spare time. A few weeks … Continue reading

Posted in Game Development, Math, Programming, Projects, Python | Tagged , , , , , , , | Leave a comment

Two Mathematical Bugs

A few days ago, I discovered I had at least one, maybe two mathematical bugs. The first bug is in the line clipping algorithm. Here’s a quick reminder of what’s going on there: There are six points of interest: the … Continue reading

Posted in Algorithms, Geometry, Math, Programming, Python | Tagged , , , , | 2 Comments

Solution for the Random Selection Challenge

A few days ago, I wrote up two small Python Challenges. Several people have presented solutions for the first challenge, and I also posted my solution in the comments there. However, the second challenge remained unsolved, and I will present … Continue reading

Posted in computer science, Math, Programming, Python, Statistics, Utility Functions | Tagged , , , , , , , , | Leave a comment

Fun with Matrices

I’ll let the code speak for itself: In [81]: m = Matrix(array([[1.0,1.0],[0.0,1.0]]))   In [82]: def my_sqrt(x, num_iters): ….: r = 0.5*x ….: for i in xrange(num_iters): ….: r = 0.5*(r+x/r) ….: return r ….:   In [83]: m*m Out[83]: … Continue reading

Posted in Math, Programming, Python | Tagged , , | Leave a comment