Unused Cycles

May 30, 2008

Physics of GPS relativistic time delay

So I realized today I’ve been posting quite a bit about GNU/Linux and mathematics, but I haven’t really done much with physics. So here’s my first physics post!

This problem is actually one assigned in the undergraduate general relativity course I took in the spring 2008. It’s from James B. Hartle’s book Gravity: An Introduction to Einstein’s General Relativity, chapter 6, problem 9.

A GPS satellite emits signals at a constant rate as measured by an onboard clock. Calculate the fractional difference in the rate at which these are received by an identical clock on the surface of Earth. Take both the effects of special relativity and gravitation into account to leading order in 1/c^2 . For simplicity, assume the satellite is in a circular equatorial orbit, the ground-based clock is on the equator, and that the angle between the propagation of the signal and the velocity of the satellite is 90° in the instantaneous rest frame of the receiver.

The problem is very simplified as to make the calculations doable at the undergraduate level. Thus it is using the simplified Geometric Newtonian gravity, that is, the line element given by

\displaystyle ds^2=-\left(1+\frac{2\Phi}{c^2}\right)(c dt)^2+\left(1-\frac{2\Phi}{c^2}\right)(dx^2+dy^2+dz^2).

One could, of course, use Schwarzchild coordinates (and this is, in effect, what I did for the general relativistic part). The solution is broken into three parts: orbital information, the special relativistic effects, and the general relativistic effects.

Orbital Information

The key here (that’s not given in the problem) is that the time t that it takes satellites to orbit Earth is 12 hours. Recalling that the speed of an orbit in Newtonian gravity is v_{\text{orbit}}=\sqrt{\frac{GM}{R}}, where R is the radius of the orbit and M is the mass of the object being orbited, we get that

\begin{array}{rcl}\displaystyle \frac{2\pi R}{t}&\displaystyle=&\displaystyle \sqrt{\frac{GM}{R}}\vspace{0.3 cm}\\\displaystyle R&\displaystyle=&\displaystyle \sqrt[3]{\frac{GMt^2}{4\pi^2}}\vspace{0.3 cm}\end{array}

Plugging in the appropriate values gives R=26,605 km and v_\text{orbit}=3871.0 m/s.

Special Relativistic Effects

Let A denote the ground observer and B denote the satellite. Then we can use time dilation to get that

\begin{array}{rcl}\displaystyle\frac{\Delta \tau_{B,S}}{\Delta\tau_{A,S}}&\displaystyle=&\displaystyle\frac{1}{\gamma}\vspace{0.3 cm}\\&\displaystyle=&\displaystyle \sqrt{1-v_\text{orbit}^2/c^2}\vspace{0.3 cm}\\&\displaystyle=&\displaystyle 0.999999999917.\end{array}

General Relativistic Effects

For general relativistic effects, note that the frequencies are related by

\displaystyle \frac{\Delta\tau_{B,G}}{\Delta\tau_{A,G}}=\frac{\omega_A}{\omega_B}=\sqrt{\frac{g_{00}\left[(\vec{x}(B)\right]}{g_{00}\left[(\vec{x}(A)\right]}}=\sqrt{\frac{1+\frac{GM}{Rc^2}}{1+\frac{GM}{R_\oplus c^2}}}.

The derivation of this formula is beyond the scope of chapter 6 and uses Killing Vectors and photon geodesics introduced in a later chapter. However, an approximation to this result is given in equation 6.12 of Hartle. Plugging in the appropriate results gives the ratio to be 1+5.2873 x 10-10, very nearly 1.

Putting things together, the whole shift is

\begin{array}{rcl}\displaystyle\frac{\omega_A}{\omega_B}=\frac{\Delta\tau_B}{\Delta\tau_A}&\displaystyle=&\displaystyle(0.999999999917)(1+5.2873\times 10^{-10})\vspace{0.3 cm}\\\displaystyle&=&\displaystyle 1+4.4573\times 10^{-10}.\end{array}

As a check, suppose that a day passes on Earth (in other words, \Delta\tau_A = 24 hours = 86,400 s). Then for the satellite, (86,400 s)(4.4573 x 10-10) = 38.511 μs more have passed every day. According to Wikipedia, this number is 38 μs.

Also according to Wikipedia, the desired frequency on Earth is \omega_A=10.23 MHz. This leaves \omega_B to be 0.0045598 Hz less (compare this to Wikipedia’s claim of 0.0045700 Hz less).

The problem of course is not as simple as it was made to be. Difficulties arise when one takes into account that Earth is rotating (so the metric is more complicated), that the observer is not necessarily orbiting in the same plane as the satellite, and the orbit is not perfectly circular. However, these corrections are minute and don’t affect the problem very much.

Hope this was an interesting read!

May 29, 2008

MAC Address Spoofing

Filed under: GNU/Linux — Tags: , , — Kevin @ 7:30 pm

I had always thought that spoofing a MAC address was difficult. After all, one security precaution to wireless routers is to only let certain MAC addresses into the router.

Today I wanted to spoof a MAC address, though not for illegal purposes such as hacking into a wireless network. The university that I’m working at for the summer requires that you activate ports in the research labs by sending a request to the department’s ITS people containing the MAC address of the computer you’re trying to hook up and waiting a few days. Unfortunately I didn’t have a few days because the hard drive on the computer that we used had crapped out. It’s an old computer (pre-2000) so booting a live cd of Ubuntu was out of the question. I had my laptop and needed to connect to the internet but I couldn’t connect using the dead computer’s ethernet port since my MAC didn’t match. On top of that, we were in the sub-basement of the building, so there were no Wifi points around.

Reading through the man pages for ifconfig, I found out it’s extremely simple to spoof a MAC, at least in Linux. All commands need to be run as root, so either su to root or prefix each command with sudo.

First, disable your device (mine was eth0) by using

ifconfig eth0 down

Then, enter the line

ifconfig eth0 hw ether 00:01:02:03:04:05

and of course substitute in the MAC address that you desire. Then, just do

ifconfig eth0 up
dhclient eth0

and you’re done! You’ll now connect with your new MAC. Don’t worry, your MAC will reset on the next boot.

So anyway, I was online and looked up external hard drive enclosures to see if it would be reasonable to try one out just to make sure it wasn’t the motherboard or cables that was fried. After looking, I decided to take off the computer’s cover and poke around a bit, but didn’t actually change anything other than unplugging and replugging a few cables. Next boot it found the drive! Strange, but at least I was able to make a last backup of the data on the hard drive before we replace the computer within the next few days.

May 28, 2008

Auto Gordian-Knot v2.40 in Wine 0.9.59

Filed under: GNU/Linux — Tags: , , , , , — Kevin @ 12:10 am

I’ve had some trouble in the past getting AutoGK running in Wine on Kubuntu, but it had been a while since I tried so I decided to give it a go again to see how much Wine has progressed.

The Wine HQ profile for AutoGK claims that version 2.40 runs fine on Wine 0.9.53, so I went ahead downloaded it from AfterDawn after some searching. It installed just fine, and I downloaded the DLL files suggested by this site (it’s in German but is basic enough to be able to make out). Even after doing this I was having problems – as soon as I started it, I got the errors below:

installation is corrupted. please reinstall the application

followed by,

\home\name\history.txt". file not found

After these errors it would start, but every time I tried to open an IFO file, it told me that it was unable to parse, and if I opened a VOB directly, it said it was an invalid stream.

Just by chance, I cd’d to the Wine directory where wine installed it to check out the files in the directory. After poking about for a bit, I tried one last time…and it started just fine!

Not sure what I did, I went ahead and added it to my dock (using a hi-res icon found here). I went about encoding a DVD file that I had ripped using DVDFab (which works beautifully right away in Wine!) and watched it afterwards in Kaffeine. Satisfied, I decided to encode some more.

But starting the launcher from my dock, I got the same errors as before. Confused, I tried poking around my winecfg settings and got nothing. I decided to run the program in the same setting as before, so I cd’d again to the install directory and ran it from there. It worked again! It seems that, for whatever reason, running AutoGK in Wine requires that you be in the install directory.

I wrote a very simple bash script to put on my dock icon.

cd ~/.wine/drive_c/Program\ Files/AutoGK
wine "C:\Program Files\AutoGK\AutoGK.exe"

Save this to any directory you’d like and chmod it to 755 so that it is executable. Then run it any time you want!

If this was helpful, please drop me a line through e-mail or a comment.

UPDATE: To install AutoGK, you have to use a virtual desktop in your winecfg settings. Once you’re done installing you can remove the virtual desktop.

May 26, 2008

Circumference of a Circle

Filed under: Mathematics — Kevin @ 2:06 am

So I was thinking about my previous area problem and the thought occurred to me that the same method could also be used to derive the circumference of the circle.

Using the same setup as before, the perimeter of the polygon is just Nb. So again if we let N\rightarrow\infty we should get the circumference of a circle.

Recall that I found the formula for b in terms of the number of sides and the radius: it was

\displaystyle b=\frac{r\sin(2\pi/N)}{\sin(\pi/2-\pi/N)}

The circumference of a circle is then

\begin{array}{rcl}\displaystyle C&\displaystyle=&\displaystyle \lim_{N\rightarrow \infty}N\frac{r\sin(2\pi/N)}{\sin(\pi/2-\pi/N)}\vspace{0.3 cm}\\&\displaystyle=&\displaystyle \lim_{N\rightarrow \infty}\frac{r\sin(2\pi/N)}{N^{-1}\sin(\pi/2-\pi/N)}\vspace{0.3 cm}\\&\displaystyle=&\displaystyle \lim_{N\rightarrow\infty}\frac{r\cos(2\pi/N)(-2\pi N^{-2})}{-N^{-2}\sin(\pi/2-\pi/N)+\pi N^{-3}\cos(\pi/2-\pi/N)}\vspace{0.3 cm}\\&\displaystyle=&\displaystyle \lim_{N\rightarrow\infty}\frac{r\cos(2\pi/N)(-2\pi)}{-\sin(\pi/2-\pi/N)+\pi N^{-1}\cos(\pi/2-\pi/N)}\vspace{0.3 cm}\\&\displaystyle=&\displaystyle 2\pi r,\end{array}

which is again exactly as expected.

And now with that out of the way, I can get some sleep. Good night!

May 24, 2008

LaTeX Tests

Filed under: LaTeX — Tags: , — Kevin @ 5:11 pm

So I just imported my (few) files from Blogger.com because I was unhappy with how it handled math equations. I did some research and found out that WordPress handles them natively with \LaTeX, so I was quick to switch since I’ll probably be using mathematics quite a bit.

For example, did you know that if, for a function f of one variable,

|f(x)-f(y)| \le (x-y)^2

implies that f is actually a constant function?

The geodesic equation that test particles follow in a given metric is

\displaystyle\frac{du^\alpha}{d\tau}=\Gamma^\alpha_{\beta\gamma}u^\beta u^\gamma,

where the Christoffel symbols \Gamma^\alpha_{\beta\gamma} are given by

\displaystyle\Gamma^\alpha_{\beta\gamma}=\frac{1}{2} g^{\alpha\epsilon}\left(\frac{\partial g_{\alpha\epsilon}}{\partial x^\beta}+\frac{\partial g_{\beta\epsilon}}{\partial x^\alpha}-\frac{\partial g_{\alpha\beta}}{\partial x^\epsilon}\right).

There are a few things missing such as equation arrays, but I’ve been able to figure out how to emulate such things using arrays. For example, in a commutative ring R with elements a and b,

\begin{array}{rcl}\displaystyle(a+b)^2&\displaystyle=&\displaystyle a^2+ab+ba+b^2\vspace{0.3 cm}\\&\displaystyle=&\displaystyle a^2+2ab+b^2.\end{array}

Overall, some things are a bit annoying, but it’s definitely workable!

Codecogs images render mathematics

Filed under: LaTeX — Kevin @ 3:46 pm

So I was a little upset at how poorly Blogger.com handled math, so I did a little searching. I found a website called codecogs.com which has a LaTeX image generator. One can just direct an img tag to that website and get images such as this one:

It seems that in-line variables, such as a variable called , look fine as well.

This code is open-source, so it would be very helpful if Blogger.com would install it so that it can be used without relying on CodeCogs’ website to be up. With my luck, I’ll start using this as my sole method of rendering math and they’ll go out of business…

Interesting way to derive the area formula for a circle

Filed under: Mathematics — Kevin @ 2:19 pm

I was bored today and looking through some old notebooks of mine and came across an interesting derivation of the circle area formula using some geometry and the concept of a limit. This idea dates back to my freshman or sophomore year.

Consider an N-gon that is broken up into N identical isosceles triangles with their unique angle touching the center. Let the side that is shared by each triangle have length r. This description might be difficult to understand, so I drew the case for N=5, a pentagon.

Clearly if we let N approach infinity, we get smoother and smoother polygons until we finally get a circle, as shown in the picture below.

So, if we’d like to find the area of the N-gon, we can find the area of each triangle we’ve created and multiply by N. Using that and letting N approach infinity should give us the area of a circle.

Now the inner angle on each of these pentagons is 2\pi /N radians, which leaves each of the outer angles to be

\displaystyle\psi=\frac{\pi-2\pi/N}{2}=\pi/2-\pi/N ,

in radians. As a sanity check, as N goes to infinity here, the angle goes to \pi/2, which is expected.

Recall that the area for a triangle is a=\frac 1 2 b h , where b is the base width and h is the height of the triangle. We can find the base by the law of sines. That is:

\begin{array}{rcl}\displaystyle\frac{\sin\theta}{b}&\displaystyle=&\displaystyle\frac{\sin\psi}{r}\vspace{0.3 cm}\\\displaystyle\frac{\sin(2\pi/N)}{b}&\displaystyle=&\displaystyle\frac{\sin(\pi/2-\pi/N)}{r}\end{array}.

This gives us b, but we still don’t have h. Luckily, we can form a right triangle out of half of each isosceles triangle. This new triangle has hypotenuse r and legs h and b/2. Thus

\displaystyle \sin\psi=\frac h r.

Putting things together, we get that

\displaystyle \frac{\sin\theta}{b}=\frac h{r^2},

or after rearrangement,

\begin{array}{rcl}\displaystyle A&=&\displaystyle Na\vspace{0.3 cm}\\&\displaystyle=&\displaystyle N\frac{bh}{2}\vspace{0.3 cm}\\&=&N\left(\frac{r^2\sin\theta}{2}\right)\vspace{0.3 cm}\\&=&N\left(\frac{r^2\sin(2\pi/N)}{2}\right)\end{array}

If we now take the limit as N goes to infinity, we get an indeterminate form. We can, however, apply L’Hopital’s rule after some rearrangement:

\begin{array}{rcl}\displaystyle\lim_{N\rightarrow\infty}\frac{r^2\sin(2\pi/N)}{2N^{-1}}&=&\displaystyle\frac{r^2}{2}\lim_{N\rightarrow\infty}\frac{\cos(2\pi/N)(-2\pi N^{-2})}{-N^{-2}}\vspace{0.3 cm}\\&=&\displaystyle\frac{r^2}{2}\lim_{N\rightarrow\infty}2\pi\cos(2\pi/N)\vspace{0.3 cm}\\&\displaystyle=&\displaystyle\pi r^2\end{array}

Taking the limit gives the familiar formula.

Part of my purpose for this posting is to test out how Blogspot handles mathematical formulas. As far as I can tell, there’s no easy way to do so. I had to use an image renderer here to render the formulas, and I’m not too impressed with it. I’ll be experimenting with MathML here in the next few days to see how it renders.

Update: Fixed all of the math to go with WordPress’s built in \LaTeX capabilities. Looks pretty nice.

May 20, 2008

KDE Superkaramba Themes

Filed under: GNU/Linux — Kevin @ 11:41 pm

Well, I was hesitant at first to put time into learning even basic Python commands, but in one evening I learned enough to be able to write two themes for Superkaramba. Both are very similar: the first fetches Garfield comics, and the second fetches xkcd. I’ve uploaded them to KDE-Look.org, and they can be found here and here.

My motivation for creating them was two-fold. First, there were already a few Garfield fetchers for Superkaramba. One seemed to work only when it was the first theme opened in Superkaramba; the other didn’t resize itself for Sunday comics which are a few more panels. Second, there wasn’t an xkcd fetcher for Superkaramba, so I thought I’d make the first!

The Garfield theme does have a small “bug” if you will. The file names change from day to day, and it’s actually a predictable pattern so I’m just using this pattern for now. Unfortunately, it seems the newest comic isn’t posted right at 12:00 AM EST. In fact, it’s almost 1 AM here now, and it still hasn’t been posted. So the theme searches and searches for the file, but it’s not there. I’m not sure when it’s uploaded, but as soon as it is uploaded it should grab it and update itself. I guess the easiest way to fix this is to wait until, say 5:00 AM EST to get it. I’ll work on it soon.

The xkcd grabber, on the other hand, shouldn’t have this problem since I have it reading the newest url right from xkcd’s RSS feed.

If you enjoy them, I’d like to hear from you!

May 19, 2008

The Best (and Worst) of KDE 4

Filed under: GNU/Linux — Kevin @ 3:02 am

So I’ve been using KDE 4 for the past few days to try it out. Some things I’m very pleased about. Others, not so much. Here’s a short list of what I’ve found to be good and bad about it. But first, my specs:

Intel Core Due Processor @ 1833 MHz running Kubuntu 8.04 (Hardy Heron)
1 GB Ram
Sound Blaster Live! (with ALSA drivers)
Dell WLAN 1390 Wireless (with ndiswrapper)
ATI Radeon Mobility X1400 with fglrx 8.47.3 driver

  1. The interface itself looks pretty. I’ve actually stuck with the default theme for now, but I haven’t really experimented with changing around themes. It’s fairly easy in KDE 3, so I’m assuming that they’ve kept that ability in the newer version.
  2. CompositingKDE 4 has its own built in composited desktop effects. While nowhere near as flashy or sophisticated as Compiz Fusion or Beryl, they do add a nice zing to the desktop. The only problem I had with it is that when they are enabled OpenGL apps such as Google Earth flicker. This probably isn’t KDE 4’s fault, however; running Compiz Fusion in any desktop environment causes this flickering which seems, at least in the case of CF, to be the fglrx driver.
  3. Plasmoids – Desktop widgets similar to Apple Dashboard Widgets or Microsoft Gadgets. Interesting idea, but a very limited selection so far and no easy way to install new ones. Certain distributions have an import button, but I haven’t been able to find it anywhere. The KDE team says they’ll eventually have support for Dashboard Widgets (still in development) and Superkaramba widgets are supposed to work as well, but none come by default. And as I mentioned, I can’t install new ones, so I’m left with the dozen or so default plasmoids, of which about 2 are useful to me personally. Once support for these is actually implemented, it will actually be a useful feature! For now, I’m sticking with Superkaramba because of the wider selection.
  4. Konsole’s text input is a bit screwy. As I enter text, the cursor at times moves too fast for the input itself, and sometimes it moves too slow. I haven’t had this trouble with Konsole in KDE 3, so I’ve been using the KDE 3 version of it. Still haven’t figured out why it’s doing this…
  5. KDM hangs on logout when I use KDE 4. I had the problem with KDE 3, but was able to fix it. But the problem is still there with KDE 4.
  6. Objects on the panel don’t persist after I log out. For example, I usually run with four virtual desktops and I like it if it shows these in two rows on the panel. By default, KDE 4 shows them in one row, but I can change that to two easily enough. However, when I log out and log back in, it reverts to the original one row. The same has happened with other objects on the panel. Worse yet, I’m not a fan of the new K menu (which is reminiscent of the Windows Vista start menu), so I tried adding the traditional-style K menu (more like the XP menu) to the panel. First off, I can’t move the menu from the right of the screen to the left. Secondly, it again disappears when I log out.
  7. KMilo doesn’t work. Which means that I can’t control the volume with my extra buttons on my laptop. Which means when my computer starts blaring a YouTube video at an obscenely loud volume, I can’t quickly mute it. Luckily I was able to set global shortcuts for KMix, but this doesn’t show the volume percentage bar that KDE 3 has when you change the volume.
  8. Lastly, it seems that they’re trying to replace Kaffeine as the default video player with Dragon player. I’m a big fan of Kaffeine and it does the job just fine, so why they’re trying to replace it mystifies me. The new video player doesn’t seem to be as configurable as Kaffeine, either, but this may have something to do with the Phonon interface I’ve read a bit about.

Overall, KDE 4 is not for me yet. While I’ll definitely be upgrading to KDE 4 sometime in the future, not until the little things get worked out. I believe KDE 4.1 is supposed to be fixing some of these gripes, so here’s hoping!

May 18, 2008

Just bored, I suppose

Filed under: First Post — Kevin @ 11:23 pm

I’m not sure if it’s boredom or just plain curiosity, but I figured I’d start out a new blog. I’d sort of been keeping up to date with a blog on my website but haven’t updated it in quite a while because it got to be too much of a hassle to make sure I had the latest copies of my web site and upload it.

In any case, I’ll try it out for a while. Keeping track of my thoughts and things that have been going on. Who knows, I may post about my life, school, politics, or maybe nifty websites I’ve found.

Blog at WordPress.com.