No account? Create an account
 drostie [entries|archive|friends|userinfo]
drostie

 [ userinfo | livejournal userinfo ] [ archive | journal archive ]

 Molecular Electronics [Jun. 21st, 2009|09:12 pm] drostie I only really aced one out of the four big questions on my molecular electronics exam. Oddly enough, it also had a serious typo in the Hamiltonian, and didn't really define its own language. It took me 10-20 minutes to decipher what was going on, and then the TA wanted 10-20 minutes to verify that my version was indeed correct. Here's the problem:Consider the motion of an electron on a linear chain of hopping sites separated by a distance a. The motion is described by the following tight-binding Hamiltonian:H = -t Σn=-∞∞ ( | n > < n+1+ | n+1 > | < n | )a) What is the meaning of t? What is the unit of t?b) Show that plane waves are eigenfunctions of this Hamiltonian.c) Find the expression for the dispersion relation for the electrons and plot it. How large is the band width?d) Show that at low energy the dispersion relation is that of a free electron with an effective ass. Find the expression of the effective mass as a function of the band width. If you read this question the obvious way -- by deleting the + symbol that doesn't mean anything, you get:H = Σn | n > < n+1 | n+1 > < n | BUT -- and this is a big but -- since wavefunctions are always normalized, < a | a > is just trivially 1. That makes this the sum of all | n > < n | states, but if they're exhaustive and orthogonal, then that's just the identity matrix. So the Hamiltonian is trivially "H = -t." No good. The key here is that there's an extra | symbol which is in between a ket and a bra on the rightmost part -- and it doesn't mean anything there. It was misplaced, and the interaction is supposed to read:| n > < n+1 |   +   | n+1 > < n | Which is indeed a nearest-neighbors coupling.Anyway. Cute problem. Link 1 comment|Leave a comment

 convert_me challenge. [Jun. 8th, 2009|12:25 pm] drostie I've detailed my religious beliefs in my favorite religious discussion community. People who read me on their friends lists might be somewhat interested.Here: http://community.livejournal.com/convert_me/1305189.html Link Leave a comment

 vim sucks. [Mar. 22nd, 2009|10:06 am] drostie The saga of emacs-vs-vim is legendary, and hearing the passionate rhetoric on both sides, you get the impression that you should at least try both out, and see what the fuss is about. Of course, everybody will admit that neither one is for "just trying": vim takes, by various estimates by vim users, weeks-to-months-to-years to learn to use properly; apparently Emacs requires learning a Lisp dialect and building up configuration files. The goal of vim is that you go to any *nix terminal you want and suddenly can edit source code at a high level. The goal of Emacs is the exact opposite: that the text editor should come to fit you like a well-worn glove, to the point where whatever keys are most intuitive to you are bound to whatever actions you use the most.My adventures started out with vim, which will be the subject of this post. My test document was a mixture of indented Javascript code between paragraphs, motivating the Y-combinator with actual examples and such. A text file deriving the Y-combinator seemed like a nice quick project to jump into any given language: it's not too long; it involves both coding and writing plain text; and so forth. Typing "vim ycombinator.text" creates a blank screen with color-coded tildes, which I can immediately understand are "this line is not actually in the file" markers. Good stuff. As I begin to just write out the first word, "function", I quickly notice that absolutely nothing is being written to screen, and the screen spits back some kind of error at me: "E35: No previous regular expression." Wha...?Okay, so I have to google a tutorial to find out that, in fact, vim doesn't support editing by default. Instead, it dumps you into a command mode, and editing is accomplished by typing the "i" or "a" keys, to get into "insert" mode. Insert mode is like a very crappy text editor, because it lacks all of the basic amenities you like (which have been moved to the command mode). For example, if you press the left arrow key at a new line, you might have expected to jump to the end of the last line. That doesn't happen. Also, it doesn't auto-indent your text. Word-wrap is enabled, but it's strictly speaking a character wrap: if your word is too long, it gets divided in half across the lines. And the up and down keys don't move within the virtual lines of a word-wrapped line, but instead move to the next physical line up and the next physical line down. The command mode includes undo commands for anything that happens within command mode. These are vital if you want to waste your time with command mode, which is apparently necessary to be a real Power User of vim. So let's experiment with those. Poring over several web pages, it's a while before I find anything useful. Here's one: I prefer my tabs to be four spaces long. Since vim apparently doesn't grok this by default (i.e. notice that the last line I wrote was tab-indented four spaces, and thus make the next one the same), the command string goes something like this: `0i    Esc,j0; ..j0...j0..j0.` or so. Since most of these characters are typed with the right hand and they're in wildly different places, this is really inconvenient, but at least you get to see some sort of benefit from the multiple-periods.Okay, but that doesn't need to be done in command mode. There's a third mode intended for problems just like this, called "Visual Mode" (really meaning "Selection Mode"). You type Ctrl-v, you select a box with your cursor, and then you type `I    Esc` to indent multiple lines by four spaces. And then you have to do it again for the interior code. And then again for the code inside that.The rest of command mode strikes me as deliberately inconvenient. Yes, there is a backspace function, no, it isn't accessed by hitting the backspace key (bwuh?!), but rather by hitting Shift-X. Without the shift, the "x" is secretly the "Del" key. Some things are exceptions to this rule: Entire line edits can often be done by repeating a command twice, so ">>" indents a line, "dd" deletes a line, "yy" copies a line onto a clipboard. (Not *the* clipboard -- vim is completely oblivious to your system clipboard. It has its own internal clipboard, though, and you can copy things to it with "y".) The find key ("f", thank God) only works on the current line with a one-character input, and *cannot* be repeated by period -- to make it search backwards, you need to use F instead, to make it search for anything more than one character, you need the / key, which can be repeated (i.e., find the "next" result) with "n", even though the "f" key cannot be repeated with n. Incidentally, this is why I got the previous error, "E35: No previous regular expression."To summarize: vim's actual text-editing component, insert mode, is a crippled and horrible mess, lacking the most basic of text-editing and code-editing idioms. To rectify this problem, vim includes a separate component, command mode, by default. Everything that you would expect to have a non-text-editor mode (e.g. find/replace, saving to a new filename) is jammed uncomfortably into this one modality, along with many things you would expect to have in text-editor mode (e.g. copying the current line, undo/redo, quit the editor, et cetera). One particular idiom which you'd expect to find in text-editor-mode, namely text selection, is in fact given a third mode completely different from the other two. And, as a bonus, all of the things you might like to do in command mode are based on a single-character language which you'll have to become fluent in before command mode becomes at all useful to you. And if you are generating large amounts of new code, command mode is not the idiom du jour -- command mode mostly suffices to help you search around in a document that's already been created and copy text from point A to point B.Unless I've missed something.I don't see why vim devotees claim that vim makes their coding much faster; I haven't seen anything in vim to suggest even a possible ~10% coding speedup waiting around the corner. Rather, since it lacks some basic amenities, it looks like vim would slow me down by ~10-20% even when I learn it fully and can use it at top-speed. It has brace highlighting. That's about it.I've tried to also play around with emacs, which also isn't pretty. Possibly there's a follow-up post to this one coming? Link 9 comments|Leave a comment

National Condom Day [Feb. 10th, 2009|04:01 pm]
drostie
 [ Tags | computers, drostie.org, odd, pwext ]

The Dutch have a National Condom Day. It is February 14th -- one day after the day when it really mattered. (I suppose good Hollandse sex happens after midnight?)

I have a laptop again! Finally. It's a Toshiba Portege (not a typo!), and it's a tablet PC. You cannot imagine the delight of dragging windows around Minority Report style. However, I must recommend against Toshiba as a brand: too much bloatware, and you must wait for all of it to install on the computer when it first arrives -- the operating system doesn't exactly come preinstalled.

It came with Vista. I tried to give it a fighting chance, I really did. They messed up the Start menu pretty bad, though, and the minor chrome adjustments that I saw were not really worth the extra wait at boot time. Toshiba kindly sent me Windows XP Tablet Edition restore disks instead of Vista restore disks, so I'm now running XP again.

(But I will install Kubuntu Linux on it sometime soon -- once I can wrap my head around what this guy did.)

pwext is almost finished as a bookmarklet. There is a delay because I don't yet have a framework that I can use to publish applications. I'm working on learning Django so that I can create something nice on drostie.org -- possibly with an eventual comment system. Also, I still need to create a setup script that will generate your pwext seed from random keypresses, et cetera. It's a bit of work, but it's going.

With a tablet PC, One Dark Dream (a webcomic/webdrama story that has been kicking around in my head for about a year now) can possibly start up. I'll have to see how long it takes for me to write the first few comics, draw them out, assemble them, and publish. One thing I don't like: in Windows, the cursor has this nasty tendency to lag behind the tablet pen, which might smooth the curves but it might also be annoying. I don't know yet.