Tuesday, December 28, 2010
Python Keyboard ShortCut
- Backspace deletes to the left; Del deletes to the right
- Arrow keys and Page Up/Page Down to move around
- Home/End go to begin/end of line
- C-Home/C-End go to begin/end of file
- Some Emacs bindings may also work, including C-B, C-P, C-A, C-E, C-D, C-L
- C-C interrupts executing command
- C-D sends end-of-file; closes window if typed at a >>> prompt
- Alt-p retrieves previous command matching what you have typed
- Alt-n retrieves next
- Return while on any previous command retrieves that command
- Alt-/ (Expand word) is also useful here
NLTK Home
- News - NLTK Cookbook by Jacob Perkins [December 2010], NLTK book in third printing [November 2010], Japanese translation of NLTK book published [November 2010], Version 2.0b9 released [July 2010], Version 2.0b8 included in Ubuntu 10.4 [February 2010]
- Code - functionality provided by NLTK in over 100,000 lines of Python code, distributed under the Apache License
- Data - ~60 corpora, grammar collections, and trained models that come with NLTK
- Quotes - what people have said about NLTK
Getting Started
- Documentation - book, articles, guides, reviews
- Download - instructions for downloading and installing Python and NLTK on all platforms
- Getting Started - simple things to try, including NLTK's demonstrations
- Subscribe - sign up for important announcements - approx 1 post per month
Getting Help
- FAQ - answers to frequently asked questions
- HOWTO - guides for a variety of NLTK packages, including many examples
- User forum - mailing list for discussion amongst NLTK users
- Chatroom - #nltk on irc.freenode.net (not often staffed)
- API Documentation - complete documentation of all NLTK modules
- Source - browse the Python source code
- Google Code - the home of the NLTK development work (submit a feature request or bug report)
- People - the NLTK development team
- API Documentation - complete documentation of all NLTK modules
- Source - browse the Python source code
- Google Code - the home of the NLTK development work (submit a feature request or bug report)
- People - the NLTK development team
Education and Research
- Courses - ~100 courses in 23 countries using NLTK (artificial intelligence, computational linguistics, information retrieval, machine learning)
- Projects - ideas for student projects
- Teaching - information for instructors teaching courses using NLTK
- Research - hundreds of research papers that mention or use NLTK, via Google Scholar
Saturday, December 25, 2010
Some Mathematical Gifts
Gifts of all kinds: a site, theorems, and proofs
Ron Rivest is one of the most famous computer scientists in the world. While he has done many important things in many aspects of computer theory, he is best known as the “R” in RSA. This is the renowned public key system based on the hardest of factoring created by Ron and Adi Shamir and Len Adleman. They won the Turing Award for this terrific achievement.
One of the “gifts” is from Ron, and the others are from various places and people. It is near the end of the year and the winter solstice is coming up soon: it is on December 21, at 6:38 pm EST. This time of year various cultures also have holidays, festivals, and rituals that celebrate this time. Of course this is the time also for gifts of all kinds, since many holidays involve gifts or celebrations: Chinese New Year, Christmas, Hanukkah, Kwanzaa, New Year, St. Lucia Day, and many others.
In this spirit I hope you enjoy a small number of fun items that I view as gifts from mathematics to all of us.Gift I
Daniel Kirsch’s gift.One of the coolest sites I have seen in years is this. Go to the site and then draw with your mouse any symbol at all, anything at all, and magically the site lists a number of LaTeX commands that it thinks are what you want. I drew this
Very cool. Does everyone know about this great site—am I the last to discover it?
(Let us not forget that TeX itself was a gift. And LaTeX and AMSTeX and all the rest too. That is on a scale beyond the margins of this post.)
Gift IIRon’s gift.
Ron had a brilliant idea that help solve an important open problem called the Aanderaa-Karp-Rosenberg Conjecture. It is still not completely resolved, but I want to highlight his idea—actually the work was joint with Jean Vuillemin. Suppose that is a boolean function. There are many ways to define the complexity of such a function:
the size of its smallest formula;- the size of its smallest general circuit;
- the size of its smallest circuit of a given constant depth;
- and so on.
The depth of the decision tree is the length of the longest path in the tree from the root to a leaf. This is the measure that Ron’s idea works on—note the size of the tree is also quite interesting, but that for another day.
Call a boolean function elusive provided any decision tree for the function, of any size, has some path of depth . Since it is unnecessary to evaluate a variable more than once on any path, an elusive function has the maximum depth possible.The natural question is how does one prove that various functions are elusive? In general this can be quite hard, but Ron’s beautiful idea resolves it for many functions.
Theorem: Let be a boolean function. Suppose that the number of so that is odd. Then the function is elusive.
The proof is really wonderful. Consider a decision tree for that is not elusive. For a leaf define to be the number of ‘s so that on that input to the tree the path taken goes to the leaf . There are two simple observations. Since the tree is not elusive, all paths are less than , so is alway even. This follows because some was not examined on the path to the leaf and so the number of inputs that go to this leaf is even.Next we note that the following identity is true:
This is one of the most elegant counting arguments, in my opinion. Perhaps in each case there is an alternative proof, perhaps one based on an adversary. But this counting is so nice. As a simple example consider the majority function on inputs: it is when there are two or more ‘s in its input. This happens ways, so the function is elusive.
Gift III
Bettina Richmond’s gift.Imagine that you are given a black box . It has a slot where you can put any real number, after you place one, it makes some sound, vibrates a bit, and returns a value. Inside the box is a secret polynomial : if you put in , you get out .
Your job is to find the exact coefficients of the polynomial, but to make it hard you are only allowed to put in two numbers—one after the other. So far the problem is impossible: it is easy to show that if the black box says each time, you still have no way to get the whole polynomial. So we will restrict the polynomial in a simple way: all the coefficients of the polynomial are natural numbers:The claim now is the problem is solvable: only two numbers need be evaluated by the black box .
The proof of this is quite neat. Ask the black box for the value . Then ask it for the value at . A moments thought will show that this essentially yields the coefficients of the polynomial: one just converts the answer to radix and reads off the coefficients. Note it works precisely because the coefficients are all non-negative natural numbers.
This is from the article called: On a Perplexing Polynomial Puzzle . By the way I have seen this puzzle elsewhere on the Web, and some sites ask money for the solution. No regrets here—it’s a gift.Gift IV
Pythagoras’ gift.Well not quite. There is an interesting discussion on MathOverflow whether or not there is a proof that is not rational that does not use “proof by contradiction.” See also Tim Gowers’ interesting discussion on this and more.
Our goal is to try and get such a proof. A proof that is not rational—without using proof by contradiction. Suppose we examine the polynomialWe will show that this polynomial over the natural numbers is only zero if both and are . The proof is based on the magic number , not , and is unfortunately a series of cases. Well its a gift—if you do not like it, then return it.
I need two basic facts about integers:
Any non-zero integer is of the form where is a natural number and is a non-zero integer than is not divisible by .
I claim these both are provable by induction. To prove (1) use simple induction. It is clearly true for . Suppose that . Then is congruent to one of . By case analysis we can show the same is true for . For example, if , then . To prove (2) use complete induction and prove it for positive integers, which is enough. It is clearly is true for . Suppose that . If is not divisible by , then the statement is true. If divides , then , and the proof follows again by induction.
Let’s start the proof. Fix and , not both zero and let . Our goal is to show is not zero.
Suppose and . Then is clearly non-zero.
So we can assume that both and are not zero. So far no proof by contradiction—right? Now on to the more interesting cases.
Suppose that both and are not divisible by . Then modulo is which is not zero. Thus is not zero. This uses (1) and the fact that .
Suppose that and by (2) above. Then,
So assume that . Then is equal to
The last sub-case is . Then is equal to
Open Problems
Is the proof of irrationality of without contradiction? Can it be simplified? Are there other gifts that you would like to share this time of year?