On Thu, Jul 10, 2008 at 5:07 PM, Ian Kelly <[EMAIL PROTECTED]> wrote:
> If it's obfuscation you want, here's another Python version:

Another variation on this that I was playing around with the other
day.  This one is a bit more transparent than the other one I posted,
but I wanted to share it because it demonstrates how simple the DFT is
in Python (the straight-forward quadratic approach, anyway).


import math

data = [(2488+0j), (-60+46j), (-223-75j), (-89+131j), (-130-268j), (-209+24j),
        (44-207j), (154-89j), (-187+78j), (-71+21j), (98+105j), (289+154j),
        (170-140j), (56+85j), (-98-98j), (144-38j), (144+38j), (-98+98j),
        (56-85j), (170+140j), (289-154j), (98-105j), (-71-21j), (-187-78j),
        (154+89j), (44+207j), (-209-24j), (-130+268j), (-89-131j), (-223+75j),
        (-60-46j)]

N = len(data)
q = 2j * math.pi / N
c = [chr(int(round(abs(sum(x * math.e ** (q*k*n)
                           for k,x in enumerate(data)) / N))))
     for n in xrange(N)]
print ''.join(c) * 1000,


-root

Reply via email to