Sunday, May 19, 2013

Keep R Rockin' Me Baby

I've been to Phoenix, AZ. I know I've been to Seattle, but I'm not sure if I made it to Tacoma. I once rode the train from DC to NY, which had at least one stop in Philadelphia. I've somehow never been to Atlanta, not even for a layover; I've been to L.A., and I've seen Northern California.

In the song "Rockin' Me" Steve Miller travels to all these destinations. He does so, he first claims, to be with his “sweet baby,” only a few verses later "just to hear [his] sweet baby say 'Keep on a rockin' me baby.'" The thing I don’t really understand, however, is why he needs to visit these locations.

One thought, based on the first verse, is that he is travelling to all of these cities looking real hard to find a job. Another theory is he has found a job which requires his travel. Perhaps he’s just stalking this girl, but I kind of always thought he was just on a concert tour.

Regardless of the reason, I’ve found the list of cities to be curious. We start out in Phoenix, a southwestern US city, and the only city listed in which the state is named. He might name the state to ensure that we don't get it confused with one of the other 6 cities/towns named Phoenix, but I think that it’s probably because Arizona is a near-rhyme with the next city: Tacoma. From the southwest to the northwest, we round off the four corners of the country with Philadelphia and Atlanta, only to end up back on the west coast in L.A. From there it’s just a short trip up the coast to Northern California (38.2813° N, 120.9045° W), where the Steve Miller Band happened to call home. I really don’t know if I am just reading too much into the lyrics, but that is a long trip! How long? Well, I thought I’d approximate it:

So that’s really it - I wanted to know how far this alleged trip was, and if past the convenient rhymes and less convenient proximities, if there were any patterns that emerged from plotting out this odyssey.

The answer - no.

R Code:

cities = c("Phoenix, AZ","Tacoma","Philadelphia","Atlanta","L.A.","Northern California")
lat = c(33.4492,47.2531,39.9522,33.7489,34.0522,38.2813)
long = -c(112.0739,122.4431,75.1642,84.3881,118.2428,120.9045)
distance = c(1093,2381,658,1938,336)

m=map("state", interior = T)
y.seq = x.seq=NULL
slope = rep(NA,length(lat)-1)
int = rep(NA,length(lat)-1)
for(i in 2:length(lat)-1) {
  slope[i] = (lat[i+1]-lat[i])/(long[i+1]-long[i])
  int[i] = lat[i]-slope[i]*long[i]

  l.out = sqrt((long[i]-long[i+1])^2 + (lat[i]-lat[i+1])^2)

  x.seq[[i]] = seq(long[i],long[i+1],length.out=l.out)
  y.seq[[i]] = int[i] + x.seq[[i]]*slope[i]

  a1 = lat[i]
  a2 = lat[i+1]
  b1 = long[i]
  b2 = long[i+1]
  d[[i]] = seq(0,distance[i],length=l.out)
x.seq[[5]] = c(x.seq[[5]],rep(x.seq[[5]][5],10))
y.seq[[5]] = c(y.seq[[5]],rep(y.seq[[5]][5],10))
d[[5]] = c(d[[5]],rep(d[[5]][5],10))
for(x in 2:5) {
  d[[x]] = d[[x]]+d[[x-1]][length(d[[x-1]])]

  for(i in 1:5) {
    for(j in 1:length(x.seq[[i]])) {
           main="Rockin' Me")
      #map("state", boundary = FALSE, col="gray70", add = TRUE)
      if(i>1) {
        for(q in 1:(i-1)) {
}, = "rockinmebaby.gif", interval = 0.03, nmax = 1000,
        ani.width = 930, ani.height = 600)