## Using nocite and multibib

2009/12/16 12:01 Computer/Tools
When making a CV for yourself in LaTeX, one shall use nocite instead of cite command to make a list of publications. This avoids the problem of hiding citations using some other tricks. But what if you want multiple bibliographies in your document? One for journal articles and one for conference articles?
There's a LaTeX package called multibib. Here's an example:
\usepackage[resetlabels]{multibib}
...
\newcites{journal}{foo}
\bibliographystylejournal{unsrt}
\newcites{conf}{foo}
\bibliographystyleconf{unsrt}
...
Journal
\nocitejournal{Park2008a}
\bibliographyjournal{bibfile}
Conference
\nociteconf{Park2005}
\bibliographyconf{bibfile}
...
LaTeX will generate separate aux files for each bib, so you'll need to run bibtex for each aux files.
(In this example, bibtex journal and bibtex conf will do.)

## sum(sum(K)) vs o * K * o'

2009/09/16 08:12 No category
Simple speed comparison on MATLAB 7.0.4.356
K = randn(100,100);
>> o = ones(1,size(K,1)); tic; for k = 1:10000; o * K * o'; end; toc
Elapsed time is 0.156108 seconds.
>> tic; for k = 1:10000; sum(sum(K)); end; toc
Elapsed time is 0.937100 seconds.

## Operation on multiple files using sed and sh

2009/08/13 11:26 No category
This is a versatile and generic method worth memorizing.

ls -d *.JPG | sed -s 's/$$.*$$.JPG$/mv"&" "\1.jpg"/' and when you want to execute it put a pipe to 'sh' ls -d *.JPG | sed -s 's/$$.*$$.JPG$/mv"&" "\1.jpg"/' | sh

Update 2010 Nov 7th - My friend AM pointed out it's much easier to do either

mmv '*.JPG' '#1.jpg'

or

for i in *.JPG; mv $i${i/.JPG/.jpg}

## Back to the source

2009/08/05 14:48 No category
I'm always late on these things, but I still write the first post of 2009 with something I support.
It's just like wikipedia's {{cite}} tag. As in this xkcd comic

## My handwriting

2008/12/21 10:13 Mathematics
For 2008 Fall, I took Analysis I, measure theory. This is my cheat sheet that I made for the final, just for studying purposes. It's written on a letter paper with a HITEC-C 0.3 black pen.

## Excluding the output of URL in bibliography

2008/11/14 13:01 Computer/Tools
Source: Zdenek http://www.tug.org/pipermail/tex-live/2007-August/014582.html

Sometimes, the LaTeX style files provided by the publisher does things that are not desirable. One of the big hassles is the URL in the bibliography portion. For example, the Elsevier bst file does it. I used to just go into my BiBTeX files and remove all the URL fields (that were automatically included when I exported from websites such as citeUlike)
\bibliographystyle{elsart-harv}

But there's a better solution. It is to modify the bst file directly.
Open the corresponding bst file (in my case elsart-harv.bst), and look for the following function.
FUNCTION {write.url}
{ url empty${ skip$ }
{ "\newline\urlprefix\url{" url * "}" * write$newline$ }
{ "" }
{ "" }
if$} This is where the URL is being output. Change this to FUNCTION {write.url} { url empty$
{ "" }
{ "" }
if\$
}
and you are done!
Make sure to clean the aux files and rerun BiBTeX and LaTeX.

## Stability of synchronization for a pair of identical coupled oscillators

2008/08/12 15:56 Mathematics
Let there be two identical, symmetrically coupled oscillators, denote the phase as $$\phi_1, \phi_2$$. Let us denote the phase response curve (PRC) as $$Z(\phi)$$. The PRC represents the change in phase for infinitesimal perturbation at phase $$\phi$$.
If the coupling is pulse coupled with some sort of transfer function $$\p(\phi, \Delta\phi)$$, the effective coupling function (or effective PRC in [3]), $$\Gamma(\Delta\phi) = \frac{1}{2\pi} \int_0^{2\pi} Z(\phi) p(\phi, \Delta\phi) d\phi$$.
The phase dynamics can be described by,
$$\frac{d\phi_1}{dt} = \omega + \Gamma(\Delta\phi)$$,
$$\frac{d\phi_2}{dt} = \omega + \Gamma(-\Delta\phi)$$.
Now, in case of phase synchrony, $$\frac{d\phi_1}{dt} = \frac{d\phi_2}{dt}$$.
Therefore,
$$\Gamma_{-}(\Delta\phi) = \Gamma(\Delta\phi)-\Gamma(-\Delta\phi)$$.
is the key function to consider. If this function is 0 at 0, it means there exist a stable synchronizing solution. And 0 at other phase differences implies phase synchrony.
Note that this function has the same sign and solution as the odd portion of $$\Gamma(\Delta\phi)$$.

As $$\Delta\phi \rightarrow 0$$, the alternative expression,
$$(\Gamma(\Delta\phi)-\Gamma(0))-(\Gamma(-\Delta\phi)-\Gamma(0))$$,
says the second derivative of $$\Gamma(\Delta\phi)$$ has the same sign and solution.

[1] Dong-Uk Hwang, Sang-Gui Lee, Seung K Han, Hyungtae Kook, "Phase-model analysis of coupled neuronal oscillators with multiple connections", Physical Review E (Statistical, Nonlinear, and Soft Matter Physics), Vol. 74, No. 3. (2006) [doi]
[2] Hyungtae Kook , Sang-Gui Lee , Dong-Uk Hwang and Seung Kee Han Synchronization of a Neuronal Oscillator Network with multiple connections of time delays Journal of the Korean Physical Society, 2007 50:341-345.
[3] Hideyuki Cateau, Katsunori Kitano, Tomoki Fukai, "Interplay between a phase response curve and spike-timing-dependent plasticity leading to wireless clustering", Physical Review E (Statistical, Nonlinear, and Soft Matter Physics), Vol. 77, No. 5. (2008) [doi]

## Street-Fighting Mathematics

2008/08/05 12:45 Mathematics

When I was a teenager, I used to use these kinds of tricks to do well on tests. Especially useful for multiple choices but works very well otherwise. The course material is inspiring and well organized. I highly recommend to take a look.

http://ocw.mit.edu/OcwWeb/Mathematics/18-098January--IAP--2008/CourseHome/index.htm

Sanjoy Mahajan, course materials for 18.098 / 6.099 Street-Fighting Mathematics, IAP 2008. MIT OpenCourseWare (http://ocw.mit.edu/), Massachusetts Institute of Technology. Downloaded on [5 Aug 2008].

## How to plot in MATLAB without opening a figure window

2008/07/28 14:54 Computer/Tools
When you have millions of MATLAB figures to plot automatically and save them, you probably don't want to see each and every figure rendered on your screen. It's a waste of time (of your computer). In this case, open the figure with no visibility option as follows!
f = figure('visible','off');

## Why I am not buying Nokia's N800/N810 now

2008/07/08 16:22 No category
Recently, my phone bill has been rising, so I was considering to go completely free by combination of services: grandcentral + gizmo + WiFi + bluetooth headset.
Since I am almost always within a WiFi environment, a mobile device such as N800/N810 will make things absolutely free.
All incoming phone calls come via grandcentral, and if I am within WiFi, I would pickup via Gizmo on the N800, otherwise I'll pick it up via my (prepaid) cell phone.
For outgoing calls, I would call via grandcentral and Gizmo again.
It's a free VoIP solution with backup via a prepaid phone.
(You don't need to pay anything if you don't call/recieve anything for a prepaid phone)

However, there are a couple of serious problems.
The most annoying thing is the caller presentation feature of grandcentral, which cannot be disabled at the moment. I have to press 1 to pickup the phone, which means I have to unlock the N800/N810, (one hardware key stroke and a touch screen stroke), then click answer call button, click app minimize, and then click 1 to get the phone call. I searched the forums to find an elegant solution, but there seems to be none. (Not to mention the bluetooth headset button will be useless.)

The second problem is the WiFi login problem. Whenever I go from one access point (AP) to another, I would need to relogin to the university (yes, I'm on campus) account to use the network. I'm sure somebody wrote a script to do this seemlessly but I couldn't find one so far.

So, I just decided to buy a headset for home, and I'll continue to use Gizmo with my PCs and labtop. No fancy internet tablet PC for me! (Yay~ I saved more money!)