Russell's Blog

New. Improved. Stays crunchy in milk.

Python numerical stuff

Posted by Russell on March 30, 2007 at 6:16 p.m.
A few years ago Eric Hagemann wrote some nice articles for the ONLamp Python Devcenter about numerical programming in Python. Is there any way to encourage him to write more, with more up-to-date modules?

PDQ Julia Set

Posted by Russell on March 29, 2007 at 9:01 p.m.
I was up late last night while waiting for the laundry to finish drying, and was annoyed at myself for wasting time fooling around on the internet. So, I decided to try to remember how to plot the Julia set. I vaguely remember doing this in high school, so I turned off my wireless card (so I couldn't cheat) and timed myself to see how long it would take me to figure it out.

After 11 minutes I got this. Not bad. It's not the most efficient way of plotting it, and I didn't bother to use modular arithmetic to handle big numbers (that's why I only go to six iterations). Here is my (very stupid) Julia set calculator.

#!/usr/bin/env python
# vim: set ts=4 sw=4 et:
from numpy import *
from scipy import *
from pylab import *

def julia( l, I, M ) :
    a = zeros( (I,I), Float64 )
    for i in range(I) :
        for j in range(I) :
            N = complex(-2.0+i/(0.25*I),-2.0+j/(0.25*I))
            for m in range(M) :
                try :
                    N = (N)**2+l
                except OverflowError :
                    N = 10000000000.0
            a[i,j] = abs(N)
    return a

l = complex( 0.4, 0.3 )
a = julia( l, 200, 6)
contourf( log(a), 32 )
#contour( a, [1], colors='black' )

The Train Nazi

Posted by Russell on March 24, 2007 at 8:48 p.m.
[From Yesterday]

Mimi and I are on the Acela Express to New York, and we made the mistake of sitting in the Quiet Car. The quiet car features a conductor that yells at you every time you whisper to the person next to you. If you take out your cell phone, even to turn it off, he yells that there are no cell phones on the Quiet Car. Then when you put it away, he yells at you again. If you are listening to headphones, he yells at you about the tiny, nearly inaudible twitters that escape into the aisle. And I do mean inaudible -- I had no idea the person sitting three feet behind me was listening to music until the conductor brought this to the attention of everyone on the car. He even glared at us and hovered over our seats because he caught us passing notes to each other.

The net effect is that this easily is the loudest car on the train. The sign says, "Please refrain from loud talking or using cell phones in this car." Evidently, the conductor interprets this as "No communicating whatsoever."

If he simply gestured, or shushed people, that would be fine. If he asked politely, that would be fine. This is insulting.

We would have moved to another car, but this is where the last seats were. Evidently, no one wants to sit in the Quit Car, and no wonder.

Free at last!

Posted by Russell on March 21, 2007 at 8:25 p.m.
I just turned in my final. The exam period isn't over yet, so I'll wait until afterward to talk about it more.

Meanwhile, I'm off to Boston and New York for a much needed break.

Quantum Final: Update

Posted by Russell on March 19, 2007 at 9:43 p.m.
Did I mention that scattering theory sucks? Allow me to reiterate. Scattering theory sucks.

Quantum Final

Posted by Russell on March 18, 2007 at 12:37 a.m.
Halfway done with the quantum final.

Scattering theory sucks.

Lecture Summary 03/7/2007

Posted by Russell on March 07, 2007 at 2:08 p.m.
Today we discussed transitions using time independent perturbation theory. Some strange things happened with relativity that I didn't catch. OK -- I didn't catch it because I was working on a homework assignment during lecture.

The end result was the formula for the decay transition of an individual system, which coincidentally is the same as the formula for fractional decay in a bulk material from statistical mechanics. The two decay rules are distinct, as they are based on different physics and describe different systems.

The lonely ballot

Posted by Russell on March 07, 2007 at 5:01 a.m.
Evidently I was the only one in my district who noticed the Official Sample Ballot that showed up in my mailbox a few weeks ago. When I walked into the the building (a Goodwill donation center near my apartment), the poll workers regarded me with astonishment and bewilderment. "Can I... Can I help you?" one of them asked.

It was well past noon, and they'd been there since 8:00. Besides the five of them, I was the first voter to arrive. They'd been drinking soda, telling stories and playing cards all day. I inked my ballot, dropped it into the scanner thingy. I could actually hear it go thunk into the empty plastic bottom of the ballot box.

I live in a very crowded West Los Angeles district; by population alone, I'd guess that there are a few thousand people assigned to my polling place.

On Sunday, I handed out fliers at an Albertsons grocery store for Bennett Kayser, who is running for the school board (Bennett and Peggy Kayser are old family friends). Almost everyone I spoke with -- about a thousand people -- was surprised to learn that there was an election coming up. Not a single person remembered receiving a sample ballot. Evidently, my observations weren't anecdotal:

Despite the high stakes and high spending, Tuesday's election was marked by low turnout. Poll workers sat waiting futilely in school auditoriums, offices and churches across the sprawling, 700-square mile district that serves Los Angeles and more than two dozen other cities.

"This is the lowest turnout I've ever seen," said Leslie Spikes, who has worked at a polling station in an education center on West 48th Street for the last three years. "It's kind of sad when you think it's about the kids."

Depressing. California has too many damn elections.