Research

iTunes University @MIT

Saturday, August 25th, 2007 -- By ET

If you have an iPod, and want to keep studying new things, you can actually download MIT lectures and watch them.

Just go to this page. You can find a lot of courses to choose from. This is part of MIT’s opencourseware project.

The following is a screen shot for the course “Differential Equations”.

itunes_mitu.jpg

My Perl IDE

Monday, July 9th, 2007 -- By ET

snap1.jpg

 

I wanted to write “The Best Perl IDE” on the title, but on a second thought, I have decided not.  There are so many good ones out there, why would this be the best?  Anyway, I think it is the best for me.  It is extremely compact, but fits my need.  Beauty is simplicity.

It is called SciTe.  The one I’m using has only one file. Only 500KB.  You can type in the code on the left panel, and the result will be shown on the right panel.

More information can be found here.

SciTE currently is able to syntax style these languages (* denotes support for folding):

  • Ada
  • ANS.1 MIB definition files*
  • APDL
  • Assembler (NASM, MASM)
  • AutoIt*
  • Avenue*
  • Batch files (MS-DOS)
  • Baan*
  • Bash*
  • BlitzBasic*
  • Bullant*
  • C/C++/C#*
  • Clarion*
  • conf (Apache)*
  • CSound*
  • CSS*
  • diff files*
  • E-Script*
  • Eiffel*
  • Erlang*
  • Flagship (Clipper / XBase)*
  • Flash (ActionScript)*
  • Fortran*
  • Forth*
  • Haskell
  • HTML*
  • HTML with embedded JavaScript, VBScript, PHP and ASP*
  • Gui4Cli*
  • IDL - both MSIDL and XPIDL*
  • INI, properties* and similar
  • InnoSetup*
  • Java*
  • JavaScript*
  • LISP*
  • LOT*
  • Lout*
  • Lua*
  • Make
  • Matlab*
  • Metapost
  • MMIXAL
  • MSSQL
  • nnCron
  • NSIS*
  • Objective Caml*
  • Opal
  • Octave*
  • Pascal/Delphi*
  • Perl, most of it except for some ambiguous cases*
  • PostScript*
  • POV-Ray*
  • PowerBasic*
  • PureBasic*
  • Python*
  • Rebol*
  • Ruby*
  • Scheme*
  • scriptol*
  • Specman E*
  • Spice
  • Smalltalk
  • SQL and PLSQL
  • TADS3*
  • TeX and LaTeX
  • Tcl/Tk*
  • VB and VBScript*
  • Verilog*
  • VHDL*
  • XML*
  • YAML*

Bibtex Entry Extractor/Subsetter

Wednesday, July 4th, 2007 -- By ET

Suppose you have a LaTeX file (e.g. latexfile.tex) with some BibTeX entries (in the form of \citet{zhang2007,dellarocas2006}, etc). Suppose these entries can be found in a huge bibtex file (e.g. references.bib) that includes more than 1000 bibtex entries.

When you are done with the $$LaTeX[/tex] file, you want to send out the paper to a journal. One way is to include this “references.bib” file with the latexfile.tex file. However, it is very difficult for the editors of the journal to use your huge file. It would be ideal if there could be a program to extract the right subset of references from the references.bib file and create a specific bibtex file for your article (latexfile.tex).

This is a real issue to me, since my co-author Feng Zhu started to manage all his references in one big file. Of course it is relatively small to carry this file around, however, when I have multiple collaborators, this will be a serious issue. I can not just copy all the references to another co-author, and if all people are doing the same thing, the reference bibtex file would be so large and extremely hard to keep in-sync among collaborators.

So I wrote the following program in PERL. Here is the introduction from the file:

FLIE: EXTRACTBIB.PLaa.gif
(Rename the file to extractbib.pl after downloading)

Version: 1.0

Description:
This program traverses all citations in one latex file (e.g. latexfile.tex), then go to a big bibtex file (e.g. references.bib) and extract only those papers that appear in the latex file, and outputs a new bibtex file (e.g. latexfile.bib) with the subset of papers that appear in the tex file.

One way to use it is to manage all the references in one big file (online, or offline), when a paper is finished, the author can run this program to get a small bibtex file so that this small file can be sent to a journal.

I guess this is often needed, however, I have not found a good solution so far. So here is mine. It is fairly complicated to address different cases. I’ll try to update it when I find a need. If you have any suggestions, please let me know.

Xiaoquan (Michael) Zhang
Assistant Professor, Hong Kong University of Science and Technology
July 04, 2007

zhangxiaoquan (a) gmail.com

Usage: perl extractbib.pl latexfile.tex references.bib [output.bib]
latexfile.tex is the original tex file
references.bib is the bibtex file containing all the references
output.bib contains the subset of references appear in the tex file
(If the output filename “output.bib” is omitted, the program will
generate a bibtex file with name: latexfile.tex)

Download the file (extractbib.pl) Here…
(Rename the file to extractbib.pl after downloading)

P.S.

After posting this, I thought about some ideas to improve this.

  1. The easiest way is to implement a web interface for this program. I can do two possible things:
    1. post two “text areas” for people to copy and paste latex article and the bibtex file. I can return the result to a new text box.
    2. post two tabs for people to “Browse” and upload the files, and return the result to a text box as well as to a link to the bibtex file.
  2. Feng Zhu suggested writing a macro for WinEDT. I can foresee this to be very popular, but I don’t have time for that. Besides, I’m not a big fan of WinEDT. I use Bakoma and LyX more often.

Austin posted the following program that extracts bibtex entries from the aux file. (bibsubset.pl)

Install a New Document Class to Bakoma LaTeX

Tuesday, May 29th, 2007 -- By ET
  1. Download the file xxxx.cls, xxxx.sty.
  2. Copy the style and class files to the folder ‘\LOCAL\TeX\LaTeX’ of the BaKoMa TeX installation directory. (normally this would be under C:\BaKoMa.TeX\LOCAL\TeX\LaTeX).
  3. If there are template files, copy the template file ‘xxxx_template.tex’ to the folder ‘\BaKoMa\Template\Dir\User’ of the BaKoMa TeX installation directory (C:\BaKoMa.TeX\BaKoMa\Template\Dir\User).
  4. Copy the file ‘xxxx_template.lcd’ to the folder ‘\BaKoMa\Template\Class’ of the BaKoMa TeX installation directory (C:\BaKoMa.TeX\BaKoMa\Template\Class). This file usually defines the customizable document properties of the template.
  5. Now rebuild the folder structure. Open the CENTAUR Text Editor or BaKoMa TeX Word and choose from the menu ‘Options/Directories’. Select the entry ‘$TEXMFLOCAL…’ from the list and click on ‘(Re)Build ls-R’. Close this window.
  6. The template is now successfully installed. To apply this template for a document, you have to create a new document in BaKoMa TeX Word and choose the template from the list ‘User/xxxx_template’. After clicking on ‘open’ you can customize the specific document options you prefer for your document.

Congestion Pricing, Part II

Thursday, May 10th, 2007 -- By ET

I wrote about the congestion pricing yesterday, and here are some follow-on thoughts.

In a paper published by Barro and Romer in 1987 (American Economic Review) they actually developed a model to discuss this problem:

ski.jpg

The intuition of the paper is that queues may have an effect on the allocation of resources that has nothing to do with the cost of time, and queues help to achieve an efficient allocation of the resources.

In the case of per-ride pricing, in equilibrium, the total capacity of rides, Jx[/tex] equals the total number demanded qN[/tex], that is

 Jx=D(P)\cdot F_{s}\left(\phi [D(P)]-PD(P)\right)=D(P)\cdot N(P,s)[/tex]</p>
<p>In the case of fixed-fee pricing, equilibrium condition for people to be indifferent between areas is</p>
<p>\phi (q_j)-\pi_{j} =\phi(q_k)-\pi_{k}.[/tex]

Differentiating, and noticing \phi^{'}(x/n_j)=D^{-1}(x/n_j),[/tex] (by <a href=Leibnitz’s formula) we can get

” />\frac{dn_j}{d\pi_j}\cdot \frac{\pi_j}{n_j}=-\frac{\pi_j}{D^{-1}(x/n_j)\cdot (x/n_j)}[/tex]

Maximization of revenue requires the elasticity of n_j[/tex] with respect to \pi_j[/tex] to be -1, so in equilibrium \frac{\pi_j}{q_j}=D^{-1} (q_j)[/tex]. Define the left hand side to be the effective price per ride \hat {P_j}[/tex], the condition for equilibrium in the areas is still

$$ Jx=D(\hat{P})\cdot N(\hat{P},s)[/tex]

Compare this with the previous one, we know both types of pricing reach the efficient allocation of the resource.

There can be structural operational cost differences between the two types of pricing. So which type is selected also depends on the operational costs. This congestion pricing (pay per use) in NYC is probably enabled by new technology.

The reduction in costs of monitoring and charging the pay-per-use fee is probably the determining factor in Bloomberg’s selection of this pricing scheme. In the NYT article, it was mentioned that the payment will be made by prepaid cards, etc. Actually, in my last ISMT101 class some students presented possibilities to use RFID to charge tolls in these situations. Compared with the huge loss in value of congestion, the price of RFID tags is negligible.

Yet another story about successfully using new tech to solve efficiency issues. When can people realize that this is only a tip of the iceberg of unlimited uses of IT to improve our lives? Or in Google’s lingo: “the world will be a little bit better place for everyone of us.”

Congestion Pricing

Wednesday, May 9th, 2007 -- By ET

There is an interesting story in New York Times yesterday: The mayor of New York City announced that a “Congestion Price” will be charged during peak hours on the most congested roads in NY.070507_talkcmntillu_p233.jpg

From NYT: The basic idea behind congestion pricing is simple: make motorists pay to use the busiest streets. Under the Mayor’s proposal, an invisible line would be drawn around Manhattan from Eighty-sixth Street south to the Battery. Vehicles crossing this line on weekdays between 6 A.M. and 6 P.M. would be charged a fee—eight dollars for cars, twenty-one dollars for trucks. (Those travelling only within the congestion zone would pay half price, while taxis and livery cabs would be exempt.) The fees would be assessed electronically and could be paid either with a toll pass or over the phone or the Internet.

This seems a natural response to the problem of congestion: if you really need to use that street, that means you have something important to do, and potentially would rather pay more than other people to get a less congested street. However, look at many other congested places: Disney Land, Ski resorts, amusement parks, Movie theaters on the first day of blogbuster movie release. It seems that fixed price is a pretty standard practice. Why these places do not increase the price in peak season?

I went to watch Spider-Man 3 this Monday, in the whole cinema there were only a few people. So it felt like I had the movie in my living room, giving me the full freedom and preventing me from exposure to the germs in public areas… Should they increase the price or decrease the price on Monday? On one hand, I had a much better movie-going experience than people who went just one day before. I’d rather pay twice the price to enjoy this experience. Yet they did not over charge me. On the other hand, they can lower the price to attract more people to go on Mondays. Yet they did not lower the price. Maybe, these two effects can cancel out! That is: they do not need to lower the price to attract people, because people expected a better experience, and the people I saw on Monday already took this into consideration.

Research Trip

Thursday, May 3rd, 2007 -- By ET

Due to my presentation at ACM EC’07 Conference at San Diego. I’m planning this research trip.

I’ll spend a week in Chicago, then stay at the conference for 3 days. Will spend a few days in LA.

I’ll definitely visit some friends and co-authors along the way, and I plan to visit some schools on the route. If not limited by summer vacation, I’d love to give some talks at various schools nearby.

trip.jpg

How Smart is Smart?

Tuesday, May 1st, 2007 -- By ET

I guess more than in any other profession, in academia, being smart is very important.

This is true in many senses. First of all, without being smart, it is very hard to survive. There are only these many top journals, and there are so many equally smart people competing for the few locations of publication quota. It is often believed that quarterly journals are of higher quality in general, I have no question about that, this is something typical in the business world: when you want to differentiate yourself from other, limit the supply!

Second, people need to look smart in this profession. In addition to being researchers, we are often professors, and this scary title determines that we need to be the most professional, maybe more professional than the professionals. After all, we train the professionals.

These two factors might explain why we see some arrogant people in the academia. When I was on the job market, I met an assistant professor in an interview. He wrote some nice papers in my area, and I really looked forward to meet him. His first sentence to me was: “Why did not you quote my paper in your paper?” I thought it was a joke, so I joked: “because your papers are so seminal, we don’t really quote Pigou, Hayek these days, right?” The real reason was that his papers were not quite relevant to that particular paper of mine. He then asked about my research topics, and after listening for two to three sentences, he would say: “that is wrong, since you did not consider such and such.” My response was: “I did not really have time to explain the details, and I did consider these minor issues.” For one particular paper, he said instead of using your proposed mechanism, you can as well use this mechanism… I did not want to bother telling him that I was looking at a society’s social welfare point of view (instead of a firm’s view as his suggestion is related), so I simply said:”thank you for your suggestion, I’ll think about it when I go back.” Then he stopped me:”No, this is my idea, and you don’t have permission to use my idea in your paper.” I was speechless.

feynmanlecturesonphysics.jpgeinstein_head.jpgstephen_hawkingstarchild.jpg

Talking about being smart in academia, no other fields can compare with Physics and Mathematics. I personally worship many of the great economists, but aggregately as a discipline, Economics is not comparable with these two, not yet. In Physics, we can’t avoid mentioning Albert Einstein, Stephen Hawking and Richard Feynman. In a recent post on “cosmic variance“, it is discussed how this “Feynman-Einstein-Hawking smart” can drive away many smart people from doing physics. It is suggested that there are three possible ways to exit physics: 1) be F-E-H smart, 2) pretend to be F-E-H smart, and 3) drop out. While it is not impossible to be F-E-H smart, I’m sure these people represent only a small portion of people we see everyday. [ I remember my advisor Prof. Erik Brynjolfsson's (himself a super smart person) comment on Prof. Dimitris Bertsimas:"Bertsimas is probably the smartest guy on the east part of the MIT campus." I took his class Optimization, and liked his way of teaching. Then I read some of his papers, and books. It was totally impressive. There were many many smart people in the Economics department at MIT: Frank Fisher, Bengt Holmstrom, Jerry Hausman, Jean Tirole, Susan Athey, Paul Milgrom, etc. (I do not list Peter Diamond, Robert Solow, Paul Samuelson because I have not taken their classes.) They may not be F-E-H smart, but they are truly outstanding. For the rest of us, only two ways are left, you decide for yourself.

In terms of research, following Erik's advice, I choose to work on big issues at this stage. Instead of writing trashy quick papers to publish on borderline journals, I try to do something significant, in the end, at least I would have enjoyed the process.

In terms of personality, I had an interesting discussion with my colleague Sean. We observe that smart guys in our field are usually nicer than others. We tried to figure out the direction of causality: whether being smart is responsible for being nice, or vice versa. My take on this? A mean person can never truly be a master.

Let me end this long and messy story with a story, about Einstein and Hilbert.

Einstein was quite weak with mathematics (”weak” for the unbelievable work he has done, not weak as in “weak with mathematics”). Invited by great mathematician David Hilbert, he visited University of Gottingen and reported his research to people there. After a few weeks, Hilbert solved the famous field equations of general relativity, later to be called Einstein Field Equations. When people tried to persuade Hilbert to claim credit for the equations, he replied:”although the kids on the Gottingen streets know more than Einstein about solving equations, Einstein is the one discovered the theory of relativity.”

MediaWiki Database Schema

Monday, April 30th, 2007 -- By ET

mediawiki-database-schema.png

[[Click Image to Enlarge ]]

Supporting LaTeX in my Wordpress Blog

Saturday, April 28th, 2007 -- By ET

I’ve decided to support \LaTeX in my blog, just to prepare for some “more technical” posts.

Here is my favourate equation:

 \displaystyle \frac{f(p)}{1-F(p)}=\frac{1}{p}

where f(p) is some probability density function, F(p) is its corresponding cumulative distribution function.

By the fundamental theorem of calculus: \displaystyle \int_{a}^{b}{f(x)}dx=F(b)-F(a)

Of course, we also have \displaystyle \frac{dF(x)}{dx}=f(x)

To show off the Greek letters: \displaystyle \alpha (z) \Gamma (z)=\int_{0}^{\infty}{\frac{\theta^{z-1}}{e^\theta-1}}d\theta

I do this because I can. :-)

Ah, I need to thank the nice folks who produced this plugin for latexrender at http://sixthform.info/steve/wordpress/?p=13.


BlogTimer
You are visitor number several since September 1, 2001

Copyright Xiaoquan (Michael) Zhang, 2004-2007. All rights reserved.
All trademarks property of their owners.