Friday, June 17, 2011

A Coin Tossing Game

Here's the rule: With a fair coin, Helen gets a point when it flips head and Tim gets a point when it flips tail. Helen wins when she becomes 3 points ahead. Tim wins when he becomes 10 points ahead. How much more likely is Helen to win? And if we use a weighted coin, what should the weight be to make this into a 50/50 fair game?

Sunday, May 22, 2011

TBBT Physics Bowl

In one of the episodes of The Big Bang Theory, the gang enters into the department physics bowl. Near the end, Sheldon was stunned by the following Feynman diagram problem:

Considering that this is one of the basic diagram for QED, it would be impossible for the character to not even recognize the problem. Anyway, the janitor then answered that the correct answer is \( -8 \pi \alpha \). It is incorrect. Well, at least not without additional conditions not specified by the problem.

Saturday, May 07, 2011

中文字體測試

sans:中文字体测试。中文字體測試
serif:中文字体测试。中文字體測試
mono:中文字体测试。中文字體測試
黑体:中文字体测试。中文字體測試
宋体:中文字体测试。中文字體測試
新细明体:中文字体测试。中文字體測試
楷体:中文字体测试。中文字體測試

Saturday, February 05, 2011

0.999.... = 1

I wrote this in respond to someone's question whether 0.9999.... = 1 in an HK forum. I liked it so much that I am pasting it here:

嚴格來說,小數并不代表實數、而是代表運算嘅一種簡寫(對人類來說比較方便)方法。

當你寫一個(10進制)小數嘅時候,例如0.33,這4嘅符號(0 . 3 3)代表嘅係以下運算嘅結果 它是一個實數(因為實數有限個基本運算下閉合)。而我們把這運算簡寫成0.33。

當你寫一個無限小數嘅時候,例如0.3333....代表嘅係以下无限級數嘅運算結果

這時候你就必須先問清楚咩係『無限個運算嘅結果』因為你不可能真係去做無限個運算。很自然你會回答:無限個運算我『識』做,因為我學過极限和收敛等概念!
跟住你必須問:咁呢個級數是否收敛到一個實數?如果不能收敛到一個實數、當然不能代表任何實數。好彩答案是肯定的:實數有完备性、以上數列是柯西序列、所以它收敛於一個實數(但這些都不是小學能輕易證明的事情)。和1/3結果一樣嘅實數。

所以說0.9999.... = 1只不過係表示 這個級數嘅收敛极限和幾個運算結果相等。至於點證明,自己Google。

Tuesday, June 08, 2010

Converting vdi to vmdk

The only Windows installation I have is in a virtual machine that I keep for odd jobs. Usually these jobs are related to firmware updates because manufactures usually do not support Linux out-of-box. Generally the non-open source edition of VirtualBox works very well with USB pass-through. One item in which it decidedly failed is HTC's HTCSync software: it simply refuse to connect to my HTC Hero. Further research shows that VMWare is able to do the same job. So I decided to try VMware-player. I don't want to create a new image just for it, so I would like to convert the VBox image (.vdi) to the VMware format (.vmdk). Since VBox can also use .vmdk, I can keep using VirtualBox for all the stuff it can handles. VMware has some behavior that just annoy the hell out of me.

Simple googling shows how to convert the VirtualBox HDD image to a VMware one:

$ qemu-image convert -O vmdk hddimage.vdi hddimage.vmdk
This, however, did not work for me. VMware cannot boot the converted image. Some blog mentioned that this is because dynamically allocated images are different and incompatible in the two formats. My image is pre-allocated, yet I still have problem. Does not matter. The solution is the same.

Sunday, March 07, 2010

4-force

Classes in relativity usually avoid discussing force even though every physics student started in non-relativistic physics with . It is not immediately obvious if this is still true under relativity and if not what is the correct formula. Of course, discussion of regular 3-vector in relativity is not very convenience. It is more natural to construct relativistic (i.e. covariant) relations using 4-force , 4-momentum , 4-acceleration , 4-velocity , and with proper time . There is a problem: should we define 4-force by acceleration or momentum? .

Momentum is more fundamental than acceleration, so:

We still want Newton's law to hold in some sense. Consider the collision of two particles. Newton's third law would read like this:
But this is strange because it means both particles have the same proper time even though they might be travelling with very different velocities.

Sunday, February 28, 2010

Relativity and photons

It's a relatively free weekend, so I ended up thinking about bunch of random stuff. Another problem I pondered: is number of photon a Lorentz invariance? That is, do observers in different frame count the same number of photons? From intuition, it seems photon number should be an invariance.

Series are fun.

We learned in grade school that order in which one adds a bunch of numbers doesn't matter. So . This is not necessarily true when you are adding infinitely many numbers. Consider this series:
and this one:
The question is: are they equal?

Sunday, February 07, 2010

Python vs. MATLab

Whenever I need to put together quickly some numerical code, I immediately turn to MATLab. The problem with programs like MATLab and Mathematica is that they are very "packaged", i.e. it is not very easy to integrate those codes in to a regular SHELL session. If I want to further process the calculation result using other programs (e.g. gnuplot to make very pretty LaTeX plot), then I am almost always forced to write the result to some output file using fprintf or similar, then process that file. In principle, if the output is well formatted, one can run the MATLab code like this:

$ matlab -nodisplay -nodesktop -nojvm -r "run_my_code(args);exit;"
However, MATLab would also print out a long header as well as its own command prompts. Additional work is needed to get rid of those undesirables and make use of the print-out.

Saturday, February 06, 2010

Poles of GF (time-independent)

From college to graduate school, it took me years to get used to Green's function. I often wonder if it's the same case for others or am I just not too bright. GF is of course an extremely powerful method that takes many years of reading and practice until one is completely comfortable with it. Physics undergraduates probably learned about it---as I did---in a mathematics class, but it is usually unused by physics classes. For example, Griffiths' EM book---standard textbook on the subject---do not use and GF and his QM book only uses it in the scattering theory chapter (for which GF is very useful) at the very end.

My hand-waving understanding of GF is the following: it is the inverse of the Hamiltonian/Linear operator in the following sense:

with the parameter .

Thursday, February 04, 2010

Two bands interaction: self-energy and effective low energy Hamiltonian.

Consider the following model of two-bands Hamiltonian with interaction between the bands:
$$ H = \left( \begin{array}{cc} H_{11} &H_{12} \\ H_{12}^{\dag} & H_{22} \end{array} \right)\,, $$
where $H_{11}$ and $H_{22}$ are some low and high energy bands that we know how to diagonalize and $H_{12}$ is some interaction between them. Since we know the spectrum of $H_{11}$, we can write down the GF. Here it is:
$$ G_{11}^{(0)} = \frac{1}{H_{11} - \epsilon^{0}} $$

Wednesday, February 03, 2010

Process substitution

I suppose I should go buy a reference on BASH, but even the basic stuff never fails to amaze me. In doing more research on how to do a remote diff (see my last post), I found that another way to do similar thing using process substitution:

$ diff <(cat FILE1) <(ssh remote-host cat remote-path/FILE1)
$ diff FILE1 <(ssh remote-host cat remote-path/FILE1)

Monday, February 01, 2010

scpdiff

I often work on the same files across multiple computers (home, office, laptop) and I often wants to compare the work. This often involve copying a remote file locally, careful not to replace and existent file.

For convenience, I wrote the following function in my .bashrc:

Saturday, January 30, 2010

My LaTeX Makefile

This is work in progress. As of time of writing, this is my Makefile to compile LaTeX project. It automatically scan the tex file for dependency and runs appropriate number of times of latex/bibtex to make the final document. It does so by using a simple GNU awk few-liner. Also it works with multibib package, which I use to make my c. v.

Friday, October 30, 2009

Terminator keyboard shortcut list

I had to run terminator with no mouse, so I needed all the keyboard shortcut at my disposal. Yes, I know terminator uses the keyboard shortcut as gnome-terminal. When I google "terminator keyboard shortcut", no such list is easily available. So here they are:

Wednesday, September 09, 2009

Loop over filename with space

Instead of using
for x in $(find -depth 1 -type d); do
  ...
done
which breaks at space and therefore would fail for filename with space, do
find -depth 1 -type d | while read x; do
  ...
done

Saturday, May 19, 2007

林狗 超低能 勁搞笑 勁歌金曲



林海峰 - 勁歌金曲 ~ 踎低噴飯版

買餸 最驚孔雀石綠
食咗有毒魚頭 行氣活血 不過就會嘔