Monthly Archives: March 2007

Gutenberg Gem: Handwork in Wood by William Noyes

I know a couple of readers of mine are interested in woodworking, so when I saw Handiwork in Wood come by on the recently completed list over at Distributed Proofreaders, I thought I’d have a look. The title suggested a book about the working of wood with handtools, and indeed, the book does that, but it also includes a large section on the working of large lumbermills around the turn of the century, with many photos. Some are really pretty neat, like:

Loggers

It does include a wide variety of information on hand joinery using both simple and sophisticated planes of the day. Worth checking out.

Handwork in Wood by William Noyes – Project Gutenberg

[tags]Wood Working,Public Domain, Project Gutenberg[/tags]

Don Knuth’s Dancing Links and Algorithm X

Tom does probably as much if not as more code tinkering as I do, and his is probably more interesting. At lunch today he mentioned that he implemented Knuth’s Algorithm X for solving the exact cover problem. I couldn’t remember what that was, but I did recall it was related to Knuth’s Dancing Links, which I know my friend Jeff had implemented before as part of his exploration of polyominoes, but I didn’t recall what it was about either. So, to help me, I dug out the link below, which I’ll share with y’all.

Link to the pdf.

[tags]Don Knuth, Programming, Exact Cover, Polyominoes[/tags]

Gutenberg Gem: A Field Book of the Stars by William Tyler Olcott

Need an introductory guide to the stars? You could worse than downloading William Tyler Olcott’s A Field Book of the Stars. It’s not the most detailed, but will get you started in being able to navigate the skies with your naked eyes, a pair of binoculars or even a small telescope. Good stuff, and the price is right.

A Field Book of the Stars by William Tyler Olcott – Project Gutenberg

Taurus

[tags]Astronomy,Public Domain,Star Guide[/tags]

Pi Day – Einstein’s Birthday – A National Science Holiday?

While I was up in Truckee this weekend with some of my old college buddies, David said that his daughter had received an assignment which was to pick someone whose birthday we should make into a national holiday. Their rather excellent suggestion was that Albert Einstein would make an excellent choice. As it happens, Albert celebrated his birthday on March 14th, which has also been designated pi day (3.14 being the first three digits of pi, naturally). Albert Einstein was named as Time Magazine’s Person of the Century, and his name is indeed a household word, virtually synonymous with genius.

It truly would be terrific to have a national holiday which emphasized the role of science in the advancement of society. Einstein of course contributed a great deal to the understanding of the physical universe. In the glorious year of 1905, Einstein published papers which established the existance of atoms, explained the photoelectric effect, discovered special relativity and the equivalence between matter and energy. Not a bad year’s work.

In discussing this, I also thought that the birthday of Charles Darwin (February 12th) might also make a good holiday. Besides it’s close proximity to Valentine’s Day (a holiday carefully designed to perpetuate stereotypes of sexual roles), some of our housemates thought that Darwin would be “too controversial” to make a good candidate. Ironically, I think that Einstein’s political activism was certainly more pronounced than Darwin’s, and while Darwin is demonized for ills which he had nothing to do with, Einstein’s pacifism and support for a one world government are largely ignored. Such are the ironic judgements of history.

Oh well. These thoughts are too big for this tiny blog.

Tomorrow I’ll have some more links and information about Ï€.

[tags]Einstein’s Birthday,Pi Day[/tags]

Addendum: Here’s an image from an old posting.
Albert would have read my blog...

You could make your own if you like.

Reno — a trip of some firsts…

Carmen and I got back from a trip to Truckee/Reno.  She wanted to take skiing lessons, so we did.  We both did well and had fun.  She also took me to the driving range and taught me how to smack balls into the water.  That was fun too.

Carmen Playing Golf

[tags]Vacation[/tags]

Gosper’s Acceleration of Series

While working on my various and sundry Ï€ programs, I kept finding references to Gosper’s paper Acceleration of Series, so I thought I’d find it on the web and have a read. It’s quite the magnum opus of series acceleration with all sorts of gems that are, to be truthful, beyond my understanding. Worth reading, worth studying.

From the abstract:

The rate of convergence of infinite series can be accelerated b y a suitable splitting of each term into two parts and then combining the second part of the n-th term with the first part of the (n+1)-th term to get a new series and leaving the first part of the first term as an “orphan”. Repeating this process an infinite number of times, the series will often approach zero, and we obtain the series of orphans, which may converge faster than the original series.

[tags]Mathematics[/tags]

Cornell University has scans of Scientific American

As part of Cornell Uniersity’s Making of America, they have scans of Scientific American from 1846-1869. Very nice, albeit with their rather obtuse and probably meaningless usage restrictions.

[tags]Public Domain,Scientific American[/tags]

Here’s the full page of an issue which describes Lord Rosse’s telescope (with the illustration below). Oops. That was a link to the gifcache. You’ll have to dig to find it again.

Lord Rosse's Telescope

Billionth Hex Digit of π

Well, after tinkering around with my implementation of the BBP algorithm a bit more, i was able to get it to work out until about 108, but no further. I suspect that some kind of implicit type conversion was happening that was truncating values in an inappropriate way, resulting in loss of precision. So, after grumping about that for a couple of days, I rewrote the basic algorithm again using the gnu bignum library, and ran it last night as I went to bed. In the morning, I found:

Script started on Thu 08 Mar 2007 11:15:07 PM PST
[chessboard] % ./a.out
0.6631159945223164865255091753630803566662e0
0.9631390752150799992020096304874891670995e0
0.2731996222104393979293359647540544136843e0
0.1069573797110732818888081014815876046136e0
pi = 0.5895585a0428b564084e74a23ba96459fb@0
12412.399u 43.758s 3:27:37.39 99.9%     0+0k 0+0io 0pf+0w
[chessboard] %

If you compare this to the digits listed in Bailey’s paper, you’ll see they match, offset by one. It appears that in Bailey’s programs, he counts the initial 3 at the head of Ï€, whereas my program does not. I’m not sure how many significant digits I’m using, I doubt I’m getting much more than about 14 significant hex digits in the result. I’ll do another run, offset by one and see how much they overlap. Total runtime was about 3x slower than my version which used the native floating point formats, which on the whole isn’t bad.

Addendum: Just as a check, here’s my run to compute the 10 millionth digits of π to compare with what I did earlier.

[chessboard] % ./a.out 10000000
0.9529379795180445077636575590185365825231e0
0.2166774963446692996905073127592122197319e0
0.2634515579817620244087507021447804419826e0
0.6346364623910829689209479177718852530542e0
pi = 0.7af5863efed8de97033cd0f6b756186bf9@0
103.966u 0.464s 1:46.88 97.6%   0+0k 0+0io 0pf+0w

[tags]Mathematics,Pi[/tags]

Hex Digits of π

The 10 hex digits of π starting at the 10 millionth place after the decimal point (is it really a decimal point if you are writing numbers base 16?) are 7AF58 63EFF. How do I know? Why, courtesy of my own implementation
of the Bailey-Borwein-Plouffe formula for computing hex digits of pi. This remarkable discovery allows you to compute hex digits of pi without computing all the digits to the left of it. My program is probably accurate out until 107 decimal places and runs reasonably fast. When compiled with -ffast-math and -O3 on my AMD box, it computes the 10 millionth place in about 21.3 seconds. Not bad.

Addendum: Incidently, this program was written largely because I tried downloading this program from the LiteratePrograms wiki, and found that the “Basic Implementation” simply didn’t work for any n > 0.

Addendum2: The final digit is actually off in the above example. It should be 7AF58 63EFE. If you run the program to find the 10000001 digits, you get AF586 3EFEE (again, the final digit is off). We are operating at the limits of precision right around there. (Oddly, I seem to get the proper result on my Intel Xeon box at work. Not sure what’s going on there.) Whether I get the final digit right or not appears to depend on whether I compile with -ffast-math. With, it gets the final digit right. Without, it gets it wrong. Interesting.

Addendum3: You might want to read this paper for more information. The examples seem to differ in one position than the results I got, probably because my program addresses digit 0 as the first digit to the right of the decimal. No biggie.

Addendum4: If you replace “double” in the code with “long double”, apparently you can get 128 bit math, at least on my AMD64. It seems to work, I ran it out to 10^8th, and I’m getting the right digits:

bbp (using long double arithmetic)
CB840 E2192
421.034u 2.256s 8:20.93 84.4%   0+0k 0+0io 0pf+0w

Bit Twiddling Hacks

I had need for a reminder of a bit twiddling hack that I had forgotten, and found this useful page that included many I don’t think I had seen before. These are mostly “too clever”, and should be used sparingly in your code. You’ve been warned.

Bit Twiddling Hacks

[tags]Programming,Hackery[/tags]