[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

Friday, October 09, 2009

Download compete twitter timeline

Upon popular request, I wrote a small script to download all tweets of a given twitter id. Have fun!


#!/usr/bin/perl

use Net::Twitter;
$|=1;

unless(@ARGV){
print "Usage: $0 twitter_id [sleep_seconds]\n";
exit 0;
}

my ($follow,$sleeper) = @ARGV;

# No account needed for this.
my $twit = Net::Twitter->new(username => 'MYNAME', password => 'XXX');

$p=1;
while(1){
my $result = $twit->user_timeline({id => $follow, page => $p});

foreach my $tweet (@{$result}){
print "At ", $tweet->{'created_at'},"\n";
print $tweet->{'text'},"\n\n";
}
++$p;
sleep $sleeper if $sleeper;
}


You might have to install the Net::Twitter module. This is most easily done as


sudo perl -MCPAN -e shell


and then (possibly after answering a few questions)


install Net::Twitter

Monday, October 05, 2009

Not so canonical momentum

Two weeks ago, I was on Corfu where I attended the conference/school/workshop on particles, astroparticles, strings and cosmology. This was a three week event, the first being on more conventional particle physics, the second on strings and the last on loops and non-commutative geometry and the like. I was mainly there for the second week but stayed a few days longer into the loopy week.

I think it was a clever move by the organisers of the last week to give five hours to the morning lecturers rather than one or two as in the string week. So they had the time to really develop their subjects rather than just mention a few highlights. John Baez has already reported on some of the lectures.

I would like to mention something I learned about elementary classical mechanics and quantum mechanics which was just a footnote in Ashtekar's first lecture but which was new to me: One canonical variable can have several canonical conjugates! In the loopy context, this appears as both the old and the new connection variables have the same canonical momentum although they differ by the Imirzi parameter times the second fundamental form (don't worry if you don't know what this is in detail, what's important that the 'positions' are different in the two sets of variables although they have the same canonical momentum).

How can this be? I always thought that if x is a canonical variable the conjugate variabel is determined by p=\partial L/\partial\dot x. What I had not realized is that you could for example take p'=p+x and obtain the same fundamental Poisson brackets (and consequently commuation relations after quantization). Similarly, you could add any function f(x) to the momentum without changing the commutation relations.

The origin of this abiguity can be found in the fact that also the Lagrangian is not unique: You can always add a total derivative without changing the action (at least locally, see below). For example, to obtain p'=p+f(x) by the derivative formula, add d/dt (\int f) to the action. The most general change would be to add d/dt \Lambda(x).

What about the quantum theory? This is most easily seen by realising that upon a gauge transformatio \delta A=d\Lambda, the action of a charge Q particle changes by Q\int d\Lambda. Thus our change in Lagrangian (with a corresponding change in the canonical momentum) can be viewed as a gauge transformation (even if no gauge field is around one could add a trivial one). Correspondingly, the wave function would have to be changed to \psi'=\psi e^{i\Lambda} as acting on \psi' by a canocially quantized p' is the same as \psi acted on by \psi.

So, it seems as if you would get exactly the same physics in the primed variables as in the unprimed ones. But we know that not all total derivatives have no influence on the qunatum theory the \theta-angle \int F\wedge F being the most prominent example. How would that appear in our much simpler quantum mechanics example? Here, it is important to remember that one should only use gauge transformations that are trivial at infinity. Here, if you change the phase of the wave function too wildly at x=\pm\infty you might leave the good part of the Hilbert space: For example the kinetic energy being an unbounded operator is not defined on all of Hilbert space but only on a dense subspace (most often taken to be some Sobolev space). And that you might leave by adding a wild phase and end up in a different self adjoint extension of the kinetic energy.

I have no idea if all this is relevant in the loopy case and the old and new variables or the variables are related by a (generalized) gauge transformation but at least I found in amusing to learn that the canonical conjugate is not canonical.