Knuth · Weeks 64 to 89
TAOCP Volume 2: Seminumerical Algorithms
Volume 2 is about numbers as computers see them. Chapter 3 is random numbers: how to generate them, how to test them, and how to turn them into shuffles and samples. Chapter 4 is arithmetic: floating point, bignums, fast multiplication, gcd, factoring and polynomials. Some sections are deep number theory; the guides tell you where to dig in and where to skim.
Every section, week by week
Each section links to its reading guide: what it covers, how to approach it, exercises picked from the book with their ratings, common traps and links. Picked is how many exercises the guide recommends; time is its budget for the week.
What you will be able to do
- Pick, use and test a random number generator, and avoid the classic biased-shuffle and modulo-bias bugs.
- Explain floating-point error and write numerically careful code.
- Implement arbitrary-precision arithmetic, including long division and a faster-than-schoolbook multiply.
- Implement gcd, modular inverses, primality testing and Pollard rho factoring.
Before you start
- Vol 1 math, especially 1.2.4 (number theory) and 1.2.9 (generating functions).
- Basic probability and statistics: mean, variance, distributions.
- C or another language with 64-bit integers for the bignum work.
Getting the book
The current edition is the third edition (1997), ISBN 0-201-89684-2.
Vol 2, 3rd edition is about $64 new from InformIT, less used. Borrow before you buy: many public and university libraries give you free access to O'Reilly Learning, which carries TAOCP; Libby/OverDrive and interlibrary loan (search WorldCat) work too. Older used editions are fine for Vols 1 to 3; section numbers barely changed. If you buy the eBook, get the PDF from InformIT. Knuth himself warns that the Kindle and ePUB versions mangle the math.
What you need has every option with prices, and which edition do I need covers the differences.
Tips
- 3.3.3 and parts of 3.5, 4.5.3 and 4.6.2 are heavy math. It is fine to read for ideas and move on.
- Turn the bignum work into a small library with tests; you will reuse it.
Questions
How long does TAOCP Volume 2 take?
On the cracked.guide path it takes 26 weeks (weeks 64 to 89), about 6 months, and the reading guides budget about 198 hours in all.
How many exercises are in TAOCP Volume 2?
918 in the sections the path covers, rated 00 to HM50, and about 240 of them carry Knuth's triangle for recommended. Each reading guide picks the ones worth your time.
Which edition of Volume 2 do I need?
The current one is the third edition (1997). Older used editions work for most of it; section numbers barely changed. Buy the PDF, not Kindle, if you want an eBook.