﻿<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type='text/xsl' href='blogformat.xsl' version='1.0'?>
<!-- (c) 2007 by Charles Petzold (www.charlespetzold.com) -->
<blog>
  <item>
    <title>Reading Casti’s “The Cambridge Quintet”</title>
    <permalink>2008/05/120214.html</permalink>
    <comments>Comments (0)</comments>
    <dateline>May 12, 2008<br />Roscoe, N.Y.</dateline>
    <content><p>  A friend mentioned John L. Casti's <i>The Cambridge Quintet: A Work of Scientific Speculation</i> (Perseus Books, 1998) to me recently because Alan Turing plays a major role in this fictional dialogue concerning machine intelligence.  </p>  <p>  The premise is this:  In 1949, C.P. Snow wants to advise the British government on the possibilities and potentials of machine intelligence, so he hosts a dinner party at his home in Cambridge with four guests to discuss the issues: Turing, philosopher Ludwig Wittgenstein, geneticist J. B. S. Haldane, and physicist Edwin Schrödinger. Over seven chapters corresponding to the courses of the dinner (sherry, soup, fish, meat, salad, dessert, and cigars and brandy), Casti narrates this imagined conversation. The result is an entertaining introduction to some of the philosophical concepts associated with artificial intelligence and human consciousness.  </p>  <p>  The philosophical dialogue is a time-honored genre, although traditionally it's populated by character types (such as in the dialogues of Cicero, Galileo, and Hume) rather than actual historical personages.   The personalities definitely make <i>The Cambridge Quintet</i> more compelling than it would have been otherwise. We get to see the rumpled Turing often excitedly stuttering when describing his research and ideas, and Wittgenstein already suffering from the cancer that will kill him but taking the stage to deliver his profound pronouncements.  </p>  <p>  The debate is primarily between Turing and Wittgenstein, with Snow playing the moderator.   It's not always clear why Casti specifically brought Schrödinger and Haldane into the fray &#x2014; although Schrödinger sometimes introduces a Eastern religious perspective, and Haldane bemoans the Lysenko travesty in the U.S.S.R.  </p>  <p>  Casti warns us in the Author's Note that he incorporates ideas that arose much later than 1949, and it is indeed startling to hear Wittgenstein adopt a lightly altered version of John Searle's famous Chinese Room argument, and for Turing to describe ideas normally attributed to Noam Chomsky: "Suppose," Casti's Turing says "there is a structure in our brains given to us by evolution that is specialized just for language, a kind of language 'organ", if you like." (pg. 121) I know of no analysis of language by Turing at all, let alone one like this.  </p>  <p>  The anachronism that bothered me the most, however, was Alan Turing describing his 1936 computing machines in terms of the "halting problem" (pg. 42). If there is any hope at all I have for my forthcoming book   <a href="http://www.TheAnnotatedTuring.com"><i>The Annotated Turing</i></a> it is for readers to appreciate the difference between Turing's original machines and the reformulated machines in Stephen Kleene's <i>Introduction to Metamathematics</i> (1952) and Martin Davis's <i>Computability and Unsolvability</i> (1958), which is where the term "halting problem" first appeared in print four years after Turing's death.  </p>  <p>  The anachronisms in <i>The Cambridge Quintet</i> compound to the point where the conversation just doesn't sound like it took place in 1949. It is my understanding that in 1949 there were still many people who held to mind/body dualism &#x2014; the belief that the physical composition of the human brain is insufficient to account for all the functionality of the mind. Indeed, it was in 1949 that Gilbert Ryle's <i>Concept of Mind</i> was published that helped dismantle vestiges of dualism that remained in Western thought.  </p>  <p>  If the mind has something "extra" that can't be accounted for by the biological machinery of the brain, then the debate about mechanical intelligence is basically over. Surely in 1949 it would have been necessary to dispense with dualism before the real discussion got underway. Yet in <i>The Cambridge Quintet</i> dualism is only alluded to on page 138 when Haldane announces his belief that mind "is a separate entity interacting with ordinary material systems." Snow quickly cuts off this "metaphysical speculation."   </p>  <p>  If we're going to put five people in a room, most of whom never met each other in real life (Turing had attended Wittgenstein 1939 lectures at Cambridge on the Foundations of Mathematics), why not bring Kurt Gödel into the mix? Gödel was almost as famous a Dualist as he was a Platonist &#x2014; see Judson C. Webb's notes on a 1972 "remark" by Gödel in Kurt Gödel, <i>Collected Works, Volume II</i> (OUP, 1990), pgs. 292-304 &#x2014; so Gödel's attendance might have provided another interesting perspective.  </p>  <p>  Still, I enjoyed <i>The Cambridge Quintet</i>, and it joins the many other cultural artifacts that now surround the fascinating figure of Alan Turing.  </p>      <table bgcolor="Yellow" align="center"  cellpadding="6">      <tr>         <td rowspan="4"><a href="http://www.TheAnnotatedTuring.com">             <img src="http://www.charlespetzold.com/AnnotatedTuring/AnnotatedTuringCover25.jpg" />         </a></td>         <td colspan="3" align="center"><font size="+1"><b>Coming June 16, 2008!<br /><br />Available for Pre-Ordering</b></font></td>      </tr>      <tr>         <td align="center"><a href="http://www.wiley.com/WileyCDA/WileyTitle/productCd-0470229055.html">Wiley</a></td>         <td align="center"><a href="http://www.amazon.com/Annotated-Turing-Charles-Petzold/dp/0470229055">Amazon US</a></td>         <td align="center"><a href="http://search.barnesandnoble.com/The-Annotated-Turing/C-Petzold/e/9780470229057">Barnes &amp; Noble</a></td>      </tr>      <tr>         <td align="center"><a href="http://www.amazon.ca/Annotated-Turing-C-Petzold/dp/0470229055">Amazon Canada</a></td>        <td align="center"><a href="http://www.amazon.co.uk/Annotated-Turing-through-Historic-Computability/dp/0470229055">Amazon UK</a></td>        <td align="center"><a href="http://www.amazon.de/Annotated-Turing-Through-Historic-Computability/dp/0470229055">Amazon Deutsch</a></td>      </tr>      <tr>        <td align="center"><a href="http://www.amazon.fr/Annotated-Turing-Charles-Petzold/dp/0470229055">Amazon Français</a></td>        <td align="center"><a href="http://www.amazon.co.jp/Annotated-Turing-Charles-Petzold/dp/0470229055">Amazon Japan</a></td>        <td align="center"><a href="http://bookshop.blackwell.co.uk/jsp/id/The_Annotated_Turing/9780470229057">Blackwell</a></td>      </tr>  </table>  </content>
    <datetime>Mon, 12 May 2008 14:14:52 GMT</datetime>
  </item>
  <item>
    <title>The 300 Page Ideal</title>
    <permalink>2008/05/The-300-Page-Ideal.html</permalink>
    <comments>Comments (5)</comments>
    <dateline>May 10, 2008<br />Roscoe, N.Y.</dateline>
    <content><p>  The ideal length of a song is 3 minutes. The ideal length of a movie is 2 hours. The ideal length of a book is 300 pages.  </p>  <p>  Of course, these "ideals" are really more like averages, and much leeway is allowed. There is nothing wrong at all with the lengths of "Der Abschied,"  <i>Lawrence of Arabia</i>, or <i>Clarissa</i>. But under the "life is too short" principle, we are usually inclined to favor movies and books of modest duration. We need more persuasion or confidence to begin tackling a work that's much longer than these ideals.  </p>  <p>  Whenever Deirdre and I are browsing the New Nonfiction section of a bookstore, we're always reading off intriguing titles or jacket copy to each other, but also checking the page count. A book that seems interesting at 300 pages needs to be a lot more compelling at 500 pages.   </p>  <p>  For that reason, I have sometimes tried to write 300-page books. I would very much like to write a 300-page book. But I have always failed.  </p>  <p>  All the time I was working on   <a href="http://www.charlespetzold.com/code"><i>Code: The Hidden Language of Computer Hardware and Software</i></a> (Microsoft Press, 1999)  I always thought of it as a 300-page book. I well remember my horror when my publisher began laying out the pages and it was estimated to be coming in at about 400 pages. We tried a number of techniques to get the page count down:  I cut a section on the symbolic logic of Lewis Carroll, pages were made a few lines longer than normal, and chapters were allowed to start on the verso (left-hand page) rather than being restricted to the recto.   </p>  <p>  The last page of text in <i>Code</i> is 382, and the last page of the index is 393, so at least we avoided actually displaying the dreaded 400 number.    </p>  <p>  <i>Code</i> actually has <i>exactly</i> 400 pages. As you might know, books are printed on large sheets of paper, which are then folded into <i>signatures</i>, pasted together, and trimmed. Most books these days are a size called <i>octavo</i>, which results from folding a sheet of paper three times into eight leaves or 16 pages. The total page count of a book &#x2014; including all front and back matter &#x2014; is thus a multiple of 16. <i>Code</i> contains 25 of these signatures.  </p>  <p>  I've always believed that <i>Code</i> would have been more popular had it been a 300-page book. (Not that the book lacks admirers &#x2014; check out   <a href=" http://www.youtube.com/watch?v=hYydgBXYGk0">this recent video tribute</a>   &#x2014; but <i>Code</i> has always seemed to have more of a cult fanbase rather than a mainstream audience.) I've even been tempted to try to made a 2<sup>nd</sup> edition of <i>Code </i> by performing some ruthless editing. Every time I look at the book with that in mind, I'm at a loss figuring out what can go, so this will probably never happen.  </p>  <p>  It might be that 400 pages is a "natural" book length for me. Some of my recent programming books have been about that length:. <i>Programming in the Key of C#</i> (Microsoft Press, 2003) has 27 sixteen-page signatures, <i>Programming Microsoft Windows Forms</i> (Microsoft Press, 2005) has 25 signatures (the same as <i>Code</i>), and <i>3D Programming for Windows</i> (Microsoft Press, 2007) has 28 signatures.  </p>  <p>  <a href="http://www.TheAnnotatedTuring.com"><i>The Annotated Turing: A Guided Tour through Alan Turing's Historic Paper on Computability and the Turing Machine</i></a> was, like <i>Code</i>, always intended to be a 300 pages in length.  Surely 300 pages is sufficient to discuss a single 36-page mathematics paper! The first eleven chapters that I completed in 2005 covered the first 60% of Turing's paper and came in at 204 pages. I confidently asserted that the book was 2/3 completed.  </p>  <p>  Once again, I underestimated. When Wiley began composing pages, the estimated page count was coming in closer to 400 than 300, and once again, I was horrified. I tried cutting some stuff &#x2014; a page or so in Chapter 8 that I could barely read without falling asleep, some unnecessary detail in Chapter 17 &#x2014; but there wasn't much I could do. I wouldn't have minded deleting Chapter 13 in its entirety, but that would have required also deleting Section 10 of Turing's paper! This might well be the most expendable section of Turing's paper, but it simply had to stay.  </p>  <p>  I suggested tightening some of the spacing that separates Turing's paper from my commentary, but I think that would have been a disaster. This book contains a lot of different looking stuff in it, including regular math, strange tables, odd fonts, peculiar strings of characters, and the "air" in the layout is necessary to maintain at least the aura of readability. All of the chapters begin on rectos, which in the book business is certainly a touch of elegance. Most importantly, the book doesn't seem cramped.  </p>  <p>  In the end, the page count wasn't too bad. The last page of text in the last chapter is numbered 359, and the entire book contains just 24 sixteen-page signatures.   </p>  <p>  I am extremely proud to report that <i>The Annotated Turing</i> is my shortest book.  </p>    <table bgcolor="Yellow" align="center"  cellpadding="6">      <tr>         <td rowspan="4"><a href="http://www.TheAnnotatedTuring.com">             <img src="http://www.charlespetzold.com/AnnotatedTuring/AnnotatedTuringCover25.jpg" />         </a></td>         <td colspan="3" align="center"><font size="+1"><b>Coming June 16, 2008!<br /><br />Available for Pre-Ordering</b></font></td>      </tr>      <tr>         <td align="center"><a href="http://www.wiley.com/WileyCDA/WileyTitle/productCd-0470229055.html">Wiley</a></td>         <td align="center"><a href="http://www.amazon.com/Annotated-Turing-Charles-Petzold/dp/0470229055">Amazon US</a></td>         <td align="center"><a href="http://search.barnesandnoble.com/The-Annotated-Turing/C-Petzold/e/9780470229057">Barnes &amp; Noble</a></td>      </tr>      <tr>         <td align="center"><a href="http://www.amazon.ca/Annotated-Turing-C-Petzold/dp/0470229055">Amazon Canada</a></td>        <td align="center"><a href="http://www.amazon.co.uk/Annotated-Turing-through-Historic-Computability/dp/0470229055">Amazon UK</a></td>        <td align="center"><a href="http://www.amazon.de/Annotated-Turing-Through-Historic-Computability/dp/0470229055">Amazon Deutsch</a></td>      </tr>      <tr>        <td align="center"><a href="http://www.amazon.fr/Annotated-Turing-Charles-Petzold/dp/0470229055">Amazon Français</a></td>        <td align="center"><a href="http://www.amazon.co.jp/Annotated-Turing-Charles-Petzold/dp/0470229055">Amazon Japan</a></td>        <td align="center"><a href="http://bookshop.blackwell.co.uk/jsp/id/The_Annotated_Turing/9780470229057">Blackwell</a></td>      </tr>  </table>  </content>
    <datetime>Sat, 10 May 2008 04:50:12 GMT</datetime>
  </item>
  <item>
    <title>Letting Go of the Book</title>
    <permalink>2008/05/Letting-Go-of-the-Book.html</permalink>
    <comments>Comments (6)</comments>
    <dateline>May 9, 2008<br />New York, N.Y.</dateline>
    <content><p>  Wiley &#x2014; my publisher for   <a href="http://www.TheAnnotatedTuring.com">The Annotated Turing</a>  &#x2014; will this morning ship the book's files to the printer. Sometime after that, printed books will emerge. The official publication date seems to be June 16.  </p>  <p>  It's been my last chance to fix things. For the past several days I've been scouring PDF files of the front matter (copyright page, epigraph, table of contents, and introduction), the 18 chapters, and the bibliography, hoping to find and correct a few final errors, and to persuade the production editor that movie titles should be italicized rather than appear in quotation marks. (The book refers to <i>Soylent Green</i>, the <i>Back to the Future</i> trilogy, and <i>2001</i>.)  </p>  <p>  Yesterday morning I discovered that a sentence on page 39 contains a mixed metaphor that I probably wrote years ago and which only now leaped out to taunt me: "With these foundations being nailed into place shortly before the turn of the century, mathematics seemed to be on a good track, ..."   </p>  <p>  I toyed around with changing the sentence but finally told myself "You really have to let this go." There is no such thing as a perfect book, and if the biggest problem in the book is a mixed metaphor, this will be the best book ever!  </p>  <p>  Letting go of the book &#x2014; particularly one I've been working on since 1999 &#x2014; is extremely difficult, both emotionally and intellectually. In the past month, as the book has made a transition from DOC files to PDF files, my freedom to make changes has been sharply curtailed. Now the book makes a final transition &#x2014; from something I've owned to something readers will own, and over which I'll have very limited control. I can't control if people buy the book, or read the book, or interpret the book in the way I intended. The book now exists apart from me, and I have become irrelevant to its future autonomous existence.  </p>  <p>  In an ideal imaginary world, a book is finished only when the author is fully satisfied that every word and comma is perfect. In the real world, that doesn't work. The only way books ever get finished is with the imposition of a deadline &#x2014; sometimes from the author him or her self, but most often from a publisher.   </p>  <p>  This is a good thing. The deadline requires much focused work to drive the book into a completed state. It is one of my fears about online publishing that books will never be finished &#x2014; that they will exist forever in some slippery amorphous state, forever demanding that they be twiddled and tweaked, enslaving the author in a never-ending cycle of continual revision.  </p>  <p>  The finality of publication is ultimately liberating. The author is given permission to let go, but more importantly, to move on. This book must be finished and left to live on its own because there are many other books that need to be written.  </p>      <table bgcolor="Yellow" align="center"  cellpadding="6">      <tr>         <td rowspan="4"><a href="http://www.TheAnnotatedTuring.com">             <img src="http://www.charlespetzold.com/AnnotatedTuring/AnnotatedTuringCover25.jpg" />         </a></td>         <td colspan="3" align="center"><font size="+1"><b>Coming June 16, 2008!<br /><br />Available for Pre-Ordering</b></font></td>      </tr>      <tr>         <td align="center"><a href="http://www.wiley.com/WileyCDA/WileyTitle/productCd-0470229055.html">Wiley</a></td>         <td align="center"><a href="http://www.amazon.com/Annotated-Turing-Charles-Petzold/dp/0470229055">Amazon US</a></td>         <td align="center"><a href="http://search.barnesandnoble.com/The-Annotated-Turing/C-Petzold/e/9780470229057">Barnes &amp; Noble</a></td>      </tr>      <tr>         <td align="center"><a href="http://www.amazon.ca/Annotated-Turing-C-Petzold/dp/0470229055">Amazon Canada</a></td>        <td align="center"><a href="http://www.amazon.co.uk/Annotated-Turing-through-Historic-Computability/dp/0470229055">Amazon UK</a></td>        <td align="center"><a href="http://www.amazon.de/Annotated-Turing-Through-Historic-Computability/dp/0470229055">Amazon Deutsch</a></td>      </tr>      <tr>        <td align="center"><a href="http://www.amazon.fr/Annotated-Turing-Charles-Petzold/dp/0470229055">Amazon Français</a></td>        <td align="center"><a href="http://www.amazon.co.jp/Annotated-Turing-Charles-Petzold/dp/0470229055">Amazon Japan</a></td>        <td align="center"><a href="http://bookshop.blackwell.co.uk/jsp/id/The_Annotated_Turing/9780470229057">Blackwell</a></td>      </tr>  </table>    </content>
    <datetime>Fri, 09 May 2008 08:42:20 GMT</datetime>
  </item>
  <item>
    <title>My Neighborhood, circa 1849</title>
    <permalink>2008/05/070530.html</permalink>
    <comments>Comments (1)</comments>
    <dateline>May 7, 2008<br />New York, N.Y.</dateline>
    <content><p>  My apartment overlooks Broadway, the longest street in Manhattan, and if I move to one side of my window &#x2014; and particularly if I hang my head out &#x2014; I can see Grace Church, on the east side of Broadway between 10<sup>th</sup> and 11<sup>th</sup> Streets, right where Broadway curves for its long straight plunge downtown.  </p>  <p align="center">  <img src="http://upload.wikimedia.org/wikipedia/en/c/ce/GraceChurchBroadway.JPG" />  </p>  <p>  Grace Church was built in the 1840s based on a design by James Renwick (1818&#x2013;1895). Renwick was educated as a structural engineer rather than an architect. A competition was held in 1843 to design a new church; Renwick studied European gothic churches, submitted a design, and won. He later went on to design the Smithsonian Institution Building in Washington DC and St. Patrick's Cathedral.  </p>  <p>  I recently acquired a book about the street over which I live entitled <i>Broadway: The Grand Canyon of American Business</i> (Broadway Association, 1926), and by "acquired" I mean "found." Sometimes when New Yorkers want to get rid of something, they don't dispose of it properly but instead put it out on the sidewalk in case somebody else might find it of value. That's how I got this book. (One good place to pick up free books is right outside The Strand, located just north of Grace Church. People bring books to The Strand to sell, and when The Strand doesn't want them, the disappointed sellers often just leave them behind. Deirdre recently found a thick book outside The Strand on bread-baking over which she has been poring.)  </p>  <p>  This book on Broadway has a chapter on Grace Church by the rector at the time, Rev. W. Russell Bowie, and he quotes from an earlier book entitled <i>Grace Church and Old New York</i> by William Rhinelander, who quotes from a diary entry from August 6, 1849 by a girl named Catherine Elizabeth Havens, who lived on the same street I live on today:  </p>  <ul>  New York is getting very big and building up. I walk some mornings with my nurse before breakfast from our house on Ninth Street up Fifth Avenue to Twenty-Third Street and down Broadway home. An officer stands in front of the House of Refuge on Madison Square ready to arrest bad people and he looks as if he would like to find some. Fifth Avenue is very muddy above Eighteenth Street, and there are no blocks of houses as there are downtown, but only two or three on a block.  </ul>  <ul>  Stages run through Bleecker and Eighth Street and Ninth Street right past our house, and it puts me to sleep when I come home from the country to hear them rumble along over the cobblestones. There is a line on Fourteenth Street too, and that is the highest uptown &#x2014; I roll my hoop and jump the rope in the afternoon, sometimes in the Parade Ground on Washington Square and sometimes in Union Square. Union Square has a high iron railing around it and a fountain in the middle. My brother says he remembers when it was a pond and the farmers used to water their horses in it.  </ul>  <p>  Washington Square and Union Square are still neighborhood parks.  New York University holds their graduation ceremonies in Washington Square Park, and the Union Square Park hosts a Farmer's Market on its perimeter several days a week.  </p>  <p>  Of course, these days we can add a tiny bit of research to a serendipitous found book to discover that Catherine Elizabeth Havens' diaries were published as the book <i>Diary of a Little Girl In Old New York</i> (second edition, 1920), and that Google Book Search has two "full view" copies:  </p>  <p align="center">  <a href="http://books.google.com/books?id=aVsEAAAAYAAJ">http://books.google.com/books?id=aVsEAAAAYAAJ</a>  </p>  <p align="center">  <a href="http://books.google.com/books?id=-ICZCOA8D-4C">http://books.google.com/books?id=-ICZCOA8D-4C</a>  </p>            </content>
    <datetime>Wed, 07 May 2008 17:30:58 GMT</datetime>
  </item>
  <item>
    <title>The Old Design Argument, Now Politicized</title>
    <permalink>2008/04/Old-Design-Argument-Now-Politicized.html</permalink>
    <comments>Comments (12)</comments>
    <dateline>April 24, 2008<br />Roscoe, N.Y.</dateline>
    <content><p>  Here's the Roman philosopher and politician Cicero on intelligent design, c. 44 BC:  </p>  <ul>  Consider again the harmony, unanimity, and unbroken affinity in nature; this will surely compel one and all to express agreement with my case? How could the earth at one time blossom, but then in turn become rigidly barren? How could the approach and departure of the sun at the summer and winter solstices be signalled by a spontaneous transformation in so much of nature? How could the sea-tides and the confined waters in the straits be affected by the rising and setting of the moon? Or the diverse courses of the stars be maintained in the single rotation of the entire heavens? What is certain is that these processes could not take place through harmonious activity in all parts of the universe, unless they were embraced by a single divine, all-pervading, spiritual force. <sup>1</sup>  </ul>  <p>  Understanding how the tides could "be affected by the rising and setting of the moon" was a particular problem in western science until Isaac Newton pretty much nailed it &#x2014; at least the equilibrium theory of the tides &#x2014; in his monumental <i>Philosophae Naturalis Principia Mathematica</i> (1687), where he showed how the movement of the tides are a combination of the effects of gravity and inertia as manifested in centrifugal force.  </p>  <p>  Although Newton had asserted in the <i>Principia</i> that "No more causes of natural things should be admitted than are both true and sufficient to explain their phenomena" (Part III, "The System of the World"), he also had ideas about intelligent design. That all the planets of the solar system rotated in the same direction and in approximately the same plane indicated a deliberate act:   </p>  <ul>  [T]he motions which the planets now have could not spring from any natural cause alone, but were impressed by an Intelligent Agent. For since comets descend into the region of our planets and here move all manner of ways, going sometimes the same way with the planets, sometimes the contrary way, and sometimes in crossways, in planes inclined to the plane of the ecliptic and at all kinds of angles, it is plain that there is no natural cause which could determine all the planets, both primary and secondary, to move the same way and in the same plane, without any considerable variations; this must have been the effect of counsel. Nor is there any natural cause which could give the planets those just degrees of velocity, in proportion to their distances from the sun and other central bodies, which are requisite to make them move in such concentric orbits about those bodies. <sup>2</sup>  </ul>  <p>  A century later, Pierre-Simon Laplace hypothesized that the planets travel in the same direction and the same plane as a result of the early formation of the solar system, a concept later called the "nebular hypothesis," which remains (in somewhat altered form) the prevailing model.  </p>  <p>  The writings of Cicero and Newton and many others form the heritage of <i>natural theology</i>: the derivation of proofs of the existence and attributes of a Creator based on natural phenomenon and human reasoning (as opposed to <i>revealed theology</i> based on divine writings). The seeds of natural theology date at least as far back as the Hebrew Bible: “The heavens declare the glory of God; and the firmament sheweth his handywork.” (Psalms 19:1; also see Psalm 8).  In the <i>Laws</i>, Plato demonstrates that the natural world proves that the Gods (notice the plural) care about us and guard our interests.  </p>  <p>  More modern manifestations of natural theology were particularly pervasive in England following the Restoration (1660), perhaps due to the need to find common ground among the Christian religions and avoid the conflicts that had plagued England after the death of Elizabeth in 1603. William Paley's <i>Natural Theology</i> of 1802 is the best known example, but that book is really more of a summing up of ideas from numerous books and other writings dating back to the seventeenth century.  </p>  <p>  The above quotation from Newton is from a letter he wrote to the Reverend Richard Bentley, who had been chosen to give the first Boyle Lecture in 1692. In his will, scientist Robert Boyle bequeathed funds to establish lectures for “proving the Christian Religion, against notorious Infidels, viz Atheists, Theists, Pagans, Jews and Mahometans, not descending lower to any Controversies, that are among Christians themselves.” <sup>3</sup>  The reference to “theists” may seem odd, but at the time the word denoted a person who believed in God but not much else &#x2014; someone who might today be considered a deist or a non-denominational believer. The mention of “Controversies, that are among Christians themselves” is a reference to the turbulent religious conflicts of seventeenth-century England among Anglicans, Roman Catholics, and Dissenters.  </p>  <p>  Even by the time Newton wrote to Bentley, natural theology had altered its focus from the heavens to the bodies of living things. This approach is characterized in such books as the <i>Wisdom of God Manifested in the Works of the Creation</i> (1691) by English naturalist and ordained minister John Ray. Ray had done much of his scientific work in describing and classifying species. In this book he showed how form and function in living things were perfectly meshed. Of the human body Ray said  </p>  <ul>  to imagine that such a machine composed of so many parts, to the right form, order and motion whereof such an infinite number of intentions are required, could be made without the contrivance of some wise Agent, must needs be irrational in the highest degree. <sup>4</sup>  </ul>  <p>  Natural theology could also get a bit silly: In his <i>Cosmologica Sacra</i> (1701), Nehemiah Grew asserted that the Creator designed the ears of the horse to be turned towards the rear so the horse could hear his human master's commands! <sup>5</sup>  </p>  <p>  Until well into the nineteenth century, criticisms of natural theology were rare. One major exception is David Hume's <i>Dialogues Concerning Natural Religion</i> (1779), which Hume considered so contrary to public feeling that he didn't seek publication during his lifetime, and it was published after he died in 1776. Because Hume wrote this book as a dialogue (undoubtedly inspired by Cicero's <i>Nature of the Gods</i>), it's sometimes hard to extract Hume's real opinion from it. He seems to think that the existence of the universe implies a Creator, but then concludes that it is impossible to discern the actual nature of this Creator &#x2014; or even that there's only one.  </p>  <p>  Although not offering a sustained critique of natural theology, evangelical Christians were somewhat wary of it. Too much reliance on natural theology alone could turn men towards deism &#x2014; at the time a belief that religion should be purged of everything that could not be established through investigation and reason. For these evangelicals, nature could provide support to one's beliefs, but these beliefs must be supplemented by revelation. The alternative is going down the dangerous path of John Locke, Edmund Halley, and Enlightenment <i>philosophes</i> such as Voltaire, Thomas Paine, and Benjamin Franklin:  </p>  <ul>  Some books against Deism fell into my hands; they were said to be the substance of sermons preached at Boyle's Lectures. It happened that they wrought an effect on me quite contrary to what was intended by them; for the arguments of the Deists, which were quoted to be refuted, appeared to me much stronger than the refutations; in short, I soon became a thorough Deist.” (<i>The Autobiography of Benjamin Franklin</i>)  </ul>  <p>  Perhaps the last major gasp of natural theology was the Bridgewater Treatises of the 1830s. Funded by &#x00A3;8000 pounds bequeathed by the eccentric Reverend Francis Henry Egerton, 8th Earl of Bridgewater, the Bridgewater Treatises presented state-of-the-art intelligent design arguments in 8 books spread out over 12 volumes and over 5,000 pages, to which Charles Babbage voluntarily contributed a <i>Ninth Bridgewater Treatise</i>.  </p>  <p>  The Bridgewater Treatise by the Reverend William Whewell &#x2014; the 'W' that begins his last name is silent  &#x2014; was entitled <i>Astronomy and General Physics Considered with Reference to Natural Theology</i> (1833) and in Chapter VII Whewell coined the term "nebular hypothesis." Despite Whewell's realization that later discoveries could render earlier design arguments invalid, he marveled, for example, how the length of the year was precisely suited to the cycles of plants and animals:  </p>  <ul>  The length of the year is so determined to be adapted to the constitution of most vegetables; or the construction of vegetables is so adjusted as to be suited to the length which the year really has, and unsuited to a duration longer or shorter by any considerable portion.... Now such an adjustment must surely be accepted as a proof of design, exercised in the formation of the world. Why should the solar year be so long and no longer? or, this being of such a length, why should the vegetable cycle be exactly the same length? Can this be chance? (Chapter 1)  </ul>  <p>  Without some familiarity with the long English heritage of natural theology, it is impossible to understand the context and revolutionary impact of Charles Darwin's <i>Origin of Species</i> (1859). Darwin was well versed in natural theology. Paley was part of the curriculum at Cambridge where Darwin studied. The second sentence of the Introduction of Darwin's book contains a phrase he found in Charles Babbage's <i>Ninth Bridgewater Treatise</i>. Darwin was familiar from his readings and studies of the multitude of ways in which plants and animals are adapted to their surroundings, and he made sure that natural selection would account for all these adaptations. Without the extensive entanglement of science and religion that characterized natural theology, <i>The Origin of Species</i> would have been quite improbable.  </p>  <p>  In one sense, Darwin merely shifted perspective. Whereas adaptation between living things and their surroundings had previously indicated design on the part of a Creator, Darwin saw adaptation as a natural process resulting from generational variations, differences in survivability, and the passing on of successful traits to one's offspring. It's a perspective shift, but one as profound as that of Copernicus.  </p>  <p>  Since <i>The Origin of Species</i>, no prudent scientist ever abandons natural explanations of phenomenon of the natural world, even if our knowledge is not sufficient to formulate a complete explanation. Simply attributing something to "intelligent design" is both lazy and cowardly, and the lessons of thousands of years of natural theology is that it is all too easy for us to discern deliberate design where it simply does not exist. Even among non-scientists, few people are rash enough to base a theology on gaps in our scientific knowledge, because our knowledge of the natural world increases almost daily.  </p>  <p>  Unfortunately, you won't find a speck of this history or perspective in the recent documentary <i>Expelled: No Intelligence Allowed</i>. This is a frighteningly myopic and dishonest film that presents intelligent design as an exciting new concept promoted by some brilliant scientists who are being silenced by the monolith of Darwinian orthodoxy.  </p>  <p>  But the target of this documentary is not Big Science. The agenda is very clearly to discredit Darwin and evolution through guilt by association. When a documentary is soaked through with black-and-white images of Nazis, concentration camps, and authoritarianist represssion &#x2014; when a tour of Darwin's Down House is accompanied by the same dark lighting, spooky music, and ominous camera pans as an earlier tour of Dachau &#x2014; when host Ben Stein deliberately conducts what appears to be (although I fear not) the most moronic interview that Richard Dawkins has ever endured &#x2014; when a Ben Stein speech about giving intelligent designers a fair chance is intercut with a Reagan speech about the Berlin Wall &#x2014; you know you're in the presence of filmmakers whose agenda is much broader than academic freedom.   </p>  <p>  This isn't science, and it surely isn't theology. It's politics, and it's really about what will be taught in the science classrooms of America's public schools.   </p>  <hr />  <p>  <sup>1</sup>Cicero, <i>The Nature of the Gods</i>, translated by P. G. Walsh (Oxford University Press, 1998), Book 2, Section 19 (page 54).  </p>  <p>  <sup>2</sup>H. S. Thayer, ed., <i>Newton’s Philosophy of Nature: Selections from His Writings</i> (Hafner Press, 1953), pages 47-48.  </p>  <p>  <sup>3</sup>Andrew Pyle, introduction to <i>The Boyle Lectures (1692 – 1732)</i> (University of Bristol, 2000).  </p>  <p>  <sup>4</sup>Quoted in Charles Raven, <i>John Ray: Naturalist</i>, second edition (Cambridge University Press, 1950), page 455.  </p>  <p>  <sup>5</sup>Richard S. Westfall, <i>Science and Religion in Seventeenth-Century England</i> (University of Michigan Press, 1958), page 62.  </p></content>
    <datetime>Thu, 24 Apr 2008 10:52:22 GMT</datetime>
  </item>
  <item>
    <title>Rounded Graphics in WPF</title>
    <permalink>2008/04/Rounded-Graphics-in-WPF.html</permalink>
    <comments>Comments (4)</comments>
    <dateline>April 17, 2008<br />Roscoe, N.Y.</dateline>
    <content><p>  A recent   <a href="http://forums.microsoft.com/forums/ShowPost.aspx?siteid=1&amp;PostID=3155632">MSDN WPF Forum posting</a>  inquired about drawing triangles with rounded corners. I responded with some code but thought it might be good to repeat it here with some visuals.  </p>  <p>  I originally used the <i>Path</i> element for drawing the triangles; for some variety &#x2014; and also to re-use a <i>Pen</i> object in my code &#x2014; here I'll render the figure with an <i>Image</i> displaying a <i>DrawingImage</i> based on a <i>GeometryDrawing</i>.   </p>  <p>  WPF supports rounded corners with the <i>LineJoin</i> property of the <i>Pen</i> class. The only catch is that your stroke thickness must be appreciable before this <i>LineJoin</i> property  becomes evident.  If you really want to draw thick lines with rounded corners, just set <i>LineJoin</i> to the <i>PenLineJoin</i> enumeration value <i>Round</i>. Here's some XAML:   </p>  <ul style='font-family: monospace; font-weight:bold; font-size:smaller'>  &lt;Page&#x00A0;xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"&gt;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;&lt;Image&#x00A0;Margin="24"&gt;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&lt;Image.Source&gt;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&lt;DrawingImage&gt;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&lt;DrawingImage.Drawing&gt;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&lt;GeometryDrawing&#x00A0;Geometry="M&#x00A0;300&#x00A0;100&#x00A0;L&#x00A0;500&#x00A0;400&#x00A0;100&#x00A0;400&#x00A0;Z"&gt;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&lt;GeometryDrawing.Pen&gt;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&lt;Pen&#x00A0;Brush="Blue"&#x00A0;Thickness="96"<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;LineJoin="Round"&#x00A0;/&gt;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&lt;/GeometryDrawing.Pen&gt;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&lt;/GeometryDrawing&gt;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&lt;/DrawingImage.Drawing&gt;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&lt;/DrawingImage&gt;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&lt;/Image.Source&gt;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;&lt;/Image&gt;<br />&lt;/Page&gt;<br /><br /><br />  </ul>  <p>  That results in the following visual:  </p>  <p align="center">  <img src="http://www.charlespetzold.com/blog/2008/04/RoundedTriangle1.png" />  </p>  <p>  Add a   </p>  <ul style='font-family: monospace; font-weight:bold; font-size:smaller'>  Brush="Blue"  </ul>  <p>  attribute to the <i>GeometryDrawing</i> tag and you'll get a filled triangle:  </p>  <p align="center">  <img src="http://www.charlespetzold.com/blog/2008/04/RoundedTriangle2.png" />  </p>  <p>  However, if you want a triangle with a thin stroke, this approach won't help. You'll need another solution that involves some code. The   <a href="http://www.charlespetzold.com/blog/2008/04/RoundedTriangle.cs">RoundedTriangle.cs</a>   and  <a href="http://www.charlespetzold.com/blog/2008/04/RoundedTriangle.csproj">RoundedTriangle.csproj</a>   files comprise a program that displays four progressively derived triangles in the cells of a <i>UniformGrid</i>. The first triangle is based on a <i>PathGeometry</i> named <i>pathGeo</i> and is the same as the first figure shown above.  </p>  <p>  The second figure is based on a <i>PathGeometry</i> obtained from a call to the <i>GetWidenedPathGeometry</i> method of <i>pathGeo</i>:  </p>  <ul style='font-family: monospace; font-weight:bold; font-size:smaller'>  PathGeometry pathGeoWidened = pathGeo.GetWidenedPathGeometry(penThick);  </ul>  <p>  The <i>Pen</i> argument is required because the method calculates a path that surrounds the original path as if drawn with the pen. My program then strokes this path with a thin pen:  </p>  <p align="center">  <img src="http://www.charlespetzold.com/blog/2008/04/RoundedTriangle3.png" />  </p>  <p>  Those artifacts are typical with widened paths.  However, it's possible to call the <i>GetOutlinedPathGeometry</i> method on this widened path:  </p>  <ul style='font-family: monospace; font-weight:bold; font-size:smaller'>  PathGeometry pathGeoOutlined = pathGeoWidened.GetOutlinedPathGeometry();  </ul>  <p>  That returns a new path that is the outline of the existing path, or:  </p>  <p align="center">  <img src="http://www.charlespetzold.com/blog/2008/04/RoundedTriangle4.png" />  </p>  <p>  We're getting very close! This <i>PathGeometry</i> obviously has two <i>PathFigure</i> objects in its <i>Figures</i> collection.  We only want one of them, and the one we don't want probably has a single item in its <i>Segments</i> collection of type <i>PolyLineSegment</i>. Let's see if we can remove it. It's first necessary to clone the outlined path because we need something we can alter:  </p>  <ul style='font-family: monospace; font-weight:bold; font-size:smaller'>  PathGeometry pathGeoCloned = pathGeoOutlined.Clone();  </ul>  <p>  Now loop through the <i>PathFigure</i> objects and see if there's a good candidate for removal:  </p>  <ul style='font-family: monospace; font-weight:bold; font-size:smaller'>  for (int i = 0; i &lt; pathGeoCloned.Figures.Count; i++)<br />  {<br />  &#x00A0;&#x00A0;&#x00A0;&#x00A0;PathFigure fig = pathGeoCloned.Figures[i];<br /><br />  &#x00A0;&#x00A0;&#x00A0;&#x00A0;if (fig.Segments.Count == 1) // ie, a PolyLineSegment<br />  &#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;pathGeoCloned.Figures.Remove(fig);<br />  }<br />  </ul>  <p>  And that does it!  The resultant <i>PathGeometry</i> looks like this:  </p>  <p align="center">  <img src="http://www.charlespetzold.com/blog/2008/04/RoundedTriangle5.png" />  </p>      </content>
    <datetime>Thu, 17 Apr 2008 13:28:41 GMT</datetime>
  </item>
  <item>
    <title>“The Annotated Turing” Typographic Triumph</title>
    <permalink>2008/03/270714.html</permalink>
    <comments>Comments (5)</comments>
    <dateline>March 27, 2008<br />New York, N.Y.</dateline>
    <content><p>  From its earliest conception, I knew that my forthcoming book   <a href="http://www.TheAnnotatedTuring.com"><i>The Annotated Turing</i></a>  would contain the complete text of Alan Turing's 36-page paper (and 3-page correction) "On Computable Numbers, with an Application to the Entscheidungsproblem," originally published in the <i>Proceedings of the London Mathematical Society</i> in 1936 and 1937.  </p>  <p>  There are basically two ways you can reproduce a 1936 paper in a modern book:  You can scan the original paper and essentially treat it like a bitmap, or you can entirely re-set the paper as if it were any other text.   </p>  <p>  The first approach is used in <i>The Collected Works of A. M. Turing</i> and Martin Davis's 1965 book <i>The Undecidable: Basic Papers on Undecidable Propositions, Unsolvable Problems and Computable Functions</i>. In theory I like this approach because the reader is actually encountering the original paper as it looked 70 years ago. However, depending on the condition of the original source, the result can look a bit gritty, and you can even get some broken characters.  Perhaps the best scan I've seen of Turing's paper is   <a href="http://www.turingarchive.org/browse.php/B/12">this one</a> and it's certainly not perfect.  </p>  <p>  The second approach (re-setting the paper) is used in B. Jack Copeland's book <i>The Essential Turing</i> and also in   <a href="http://www.thocp.net/biographies/papers/turing_oncomputablenumbers_1936.pdf">this online PDF version</a>. The paper becomes very readable (except in the online PDF version) but it doesn't look quite "real." It doesn't stand out as an object foreign to the modern parts of the book. The possibility also exists that new errors will be introduced when it's re-set.  </p>  <p>  For <i>The Annotated Turing</i> I had another major consideration. The book contains not only Turing's paper but my commentary and explanations interspersed with the paper.  Turing made use of a German gothic font and an unusual script font in his paper.  To minimize confusion, I would need to use those same fonts in my commentary and annotations, and I suspected it would be quite difficult to match the fonts exactly.  </p>  <p>  For those reasons, I wanted Turing's paper to be re-set in my book, but I also wanted it to look as close as possible to the original published version.  I struggled with this problem in Microsoft Word (as   <a href="http://www.charlespetzold.com/blog/2008/02/Mr-Turings-Computing-Machine.html">I have described</a>) so I was well familiar with the difficulties involved.  Besides the multiple fonts, the paper contains a lot of strange tables and mathematical formulas with subscripted subscripts.  </p>  <p>  I discussed these issues at length with the book's Development Editor at Wiley, and he agreed that the paper should be re-set.  I told him "I want to be able to proof-read the re-set paper by printing it on transparency film and putting it on top of the original version." He was amused by this concept, and of course neither of us expected the scheme to work. Small differences in type size and line spacing make an exact match impossible.  </p>  <p>  But I had to try. When I recently received a PDF of the re-set paper to review, I printed it on transparency film, and positioned each page of film on top of a normal printout of the original paper.  I discovered that I could proof-read the pages not by an exact positioning, but so that lines of text alternated, like this:  </p>  <img src="http://www.charlespetzold.com/blog/2008/03/TuringNewAndOld.png" />  <p>  That's a 200-DPI scan with the re-set version printed on transparency film oriented slightly above a printout of the original paper. By sliding the transparency around on the original, I was able to compare the two versions quite easily.   </p>  <p>  As you can see, the two fonts aren't <i>precisely</i> the same, but they're both variants of Century Schoolbook. I think that people familiar with the paper from <i>The Collected Works</i> or Davis's <i>The Undecidable</i> will pause a bit when encountering the paper in my book and ask "Is it real? Or is it re-set?" and not be able to decide for sure right away.  </p>  <p>  That's precisely the effect I wanted.  </p>    <table bgcolor="Yellow" align="center"  cellpadding="6">      <tr>         <td rowspan="4"><a href="http://www.charlespetzold.com/AnnotatedTuring">             <img src="http://www.charlespetzold.com/AnnotatedTuring/AnnotatedTuringCover25.jpg" />         </a></td>         <td colspan="3" align="center"><font size="+1"><b>Coming June 10, 2008!<br /><br />Available for Pre-Ordering</b></font></td>      </tr>      <tr>         <td align="center"><a href="http://www.wiley.com/WileyCDA/WileyTitle/productCd-0470229055.html">Wiley</a></td>         <td align="center"><a href="http://www.amazon.com/Annotated-Turing-Charles-Petzold/dp/0470229055">Amazon US</a></td>         <td align="center"><a href="http://search.barnesandnoble.com/The-Annotated-Turing/C-Petzold/e/9780470229057">Barnes &amp; Noble</a></td>      </tr>      <tr>         <td align="center"><a href="http://www.amazon.ca/Annotated-Turing-C-Petzold/dp/0470229055">Amazon Canada</a></td>        <td align="center"><a href="http://www.amazon.co.uk/Annotated-Turing-through-Historic-Computability/dp/0470229055">Amazon UK</a></td>        <td align="center"><a href="http://www.amazon.de/Annotated-Turing-Through-Historic-Computability/dp/0470229055">Amazon Deutsch</a></td>      </tr>      <tr>        <td align="center"><a href="http://www.amazon.fr/Annotated-Turing-Charles-Petzold/dp/0470229055">Amazon Français</a></td>        <td align="center"><a href="http://www.amazon.co.jp/Annotated-Turing-Charles-Petzold/dp/0470229055">Amazon Japan</a></td>        <td align="center"><a href="http://bookshop.blackwell.co.uk/jsp/id/The_Annotated_Turing/9780470229057">Blackwell</a></td>      </tr>  </table></content>
    <datetime>Thu, 27 Mar 2008 19:14:36 GMT</datetime>
  </item>
  <item>
    <title>My New Book on Charles Babbage</title>
    <permalink>2008/03/Mathematics-of-Miracles.html</permalink>
    <comments>Comments (8)</comments>
    <dateline>March 20, 2008<br />New York, N.Y.</dateline>
    <content><p>  Today is the first day of spring, a traditional time for new beginnings.  Instead of doing something useful like planting a tree, I am today officially beginning the writing of a new book. That means that I am creating a new Microsoft Word document and typing at least the magic words “Chapter 1.”  </p>  <p>  The new book is tentatively entitled:  </p>  <p align="center">  <font size="+2"><b>  The Mathematics of Miracles  </b></font>  <br />  <font size="+1"><b>  Charles Babbage and the Ninth Bridgewater Treatise  </b></font>  </p>  <p>  The <i>Ninth Bridgewater Treatise</i> is a short work of natural theology published in 1837 by nineteenth-century mathematician and computer pioneer Charles Babbage. I intend for my book to cover the historical, theological, and philosophical background of Babbage’s little book, as well as provide an analysis of Babbage’s use of probability mathematics.  </p>  <p>  <i>The Mathematics of Miracles</i> actually began life in my mind a couple years ago as an essay similar to   <a href="http://www.charlespetzold.com/etc/MaxwellMoleculesAndEvolution.html">“Maxwell, Molecules, and Evolution”</a>. The advancement of the conception to book length was recently prompted by some reading connected with the Humean critique of miracles. Although I’ve been doing some scattered research for <i>The Mathematics of Miracles</i> for about a year, the actual writing has only begun today.  </p>  <p>  Obviously such a book has, let’s say, a <i>limited</i> commercial appeal. At best I’d be able to interest a university press in the project, but that might require <i>years</i> (literally).  </p>  <p>  For that reason, I intend to avoid all that unpleasantness by posting the book online on   <a href="http://www.charlespetzold.com/MathematicsOfMiracles">The Mathematics of Miracles</a>   page of my web site.  </p>  <p>  But wait! There’s more:  </p>  <p>  I also intend to post <i>all my rough drafts</i> online on a daily basis. Every day that I work on the book, I intend to add the Word file that resulted from that day’s labor to the collection already on   <a href="http://www.charlespetzold.com/MathematicsOfMiracles">The Mathematics of Miracles</a>   page. In other words, you don’t have to wait for me to finish the book. You can begin reading it immediately!  </p>  <p>  Of course, all this is an <i>intention</i> rather than a promise. It’s possible that I’ll lose interest in the book, or that I’ll discover that it’s   <a href="http://www.charlespetzold.com/blog/2008/02/Follow-the-Data.html">yet another book beyond my capabilities</a>.   It's possible that another project will come along and I'll have to put this aside for awhile.  It’s even possible that an actual publisher will email me saying “We want to publish your book! Stop posting it online!”  </p>  <p>  But for now, I’ve begun and I’m excited. Wish me luck!  </p>  </content>
    <datetime>Thu, 20 Mar 2008 08:59:18 GMT</datetime>
  </item>
  <item>
    <title>Top Dollar for Turing's Paper</title>
    <permalink>2008/03/140823.html</permalink>
    <comments>Comments (1)</comments>
    <dateline>March 14, 2008<br />New York, N.Y.</dateline>
    <content><p>  I occasionally receive printed catalogs specific to Antiquarian Science from   <a href="http://www.WeberRareBooks.com">Jeff Weber Rare Books</a>, and I always find them fascinating.  Not all of the items are expensive, but the more interesting of them surely are.  </p>    <p>  For example, the Antiquarian Science catalog for Winter 2007 lists a book entitled <i>The First Six Books of The Elements of Euclid in which coloured diagrams and symbols are used instead of letters for the greater ease of learners</i> by Oliver Byrne, published in London in 1847.  Jeff Weber Rare Books is selling a copy of this for $9,500.  </p>  <p>  Some of the most expensive items in the recent catalog are for periodicals rather than books:  </p>    <ul><li>  An offprint from a 1958 paper by John von Neumann from the <i>Annals of Mathematics</i> for $200.  </li></ul>    <ul><li>  The 1950 issue of the British journal of philosophy <i>Mind</i> containing Alan Turing's famous paper "Computing Machinery and Intelligence" (in which he proposed what has come to be known as the Turing Test) for $1,500.  </li></ul>    <ul><li>  The 1953 issue of <i>Nature</i> that contains the paper "Molecular Structure of Nucleic Acid. A Structure for Deoxyribose Nucleic Acid" by James Watson and Francis Crick, and, as the catalog notes, "including the first appearance of the famous double helix image." This goes for $2,000.  </li></ul>    <ul><li>  The 1948 issue of <i>The Bell System Technical Journal</i> containing Claude E. Shannon's classic article "A Mathematical Theory of Communication" for $5,000.  </li></ul>    <ul><li>  The entire Volume 17 of <i>Annalen der Physik</i> from 1905 containing a total of 1020 pages including three of Albert Einstein's annus mirabilis papers.  $20,000.  </li></ul>    <p>  But the most expensive item in the catalog are the three issues of the <i>Proceedings of the London Mathematical Society</i> containing Alan Turing's paper "On Computable Numbers, with an Application to the Entscheidungsproblem" with the corrections. "<u>This is the seminal paper on computing</u>," the catalog says, "written when Maunchly [sic] and Eckert were virtually unknown and the ENIAC was ten years in the future." A bargain at $25,000.  </p>    <p>  A reproduction of Turing's entire paper on computable numbers is scattered throughout my new book <i>The Annotated Turing</i> along with some helpful hints on what it all means.  </p>    <table bgcolor="Yellow" align="center"  cellpadding="6">      <tr>         <td rowspan="4"><a href="http://www.charlespetzold.com/AnnotatedTuring">             <img src="http://www.charlespetzold.com/AnnotatedTuring/AnnotatedTuringCover25.jpg" />         </a></td>         <td colspan="3" align="center"><font size="+1"><b>Coming June 10, 2008!<br /><br />Available for Pre-Ordering</b></font></td>      </tr>      <tr>         <td align="center"><a href="http://www.wiley.com/WileyCDA/WileyTitle/productCd-0470229055.html">Wiley</a></td>         <td align="center"><a href="http://www.amazon.com/Annotated-Turing-Charles-Petzold/dp/0470229055">Amazon US</a></td>         <td align="center"><a href="http://search.barnesandnoble.com/The-Annotated-Turing/C-Petzold/e/9780470229057">Barnes &amp; Noble</a></td>      </tr>      <tr>         <td align="center"><a href="http://www.amazon.ca/Annotated-Turing-C-Petzold/dp/0470229055">Amazon Canada</a></td>        <td align="center"><a href="http://www.amazon.co.uk/Annotated-Turing-through-Historic-Computability/dp/0470229055">Amazon UK</a></td>        <td align="center"><a href="http://www.amazon.de/Annotated-Turing-Through-Historic-Computability/dp/0470229055">Amazon Deutsch</a></td>      </tr>      <tr>        <td align="center"><a href="http://www.amazon.fr/Annotated-Turing-Charles-Petzold/dp/0470229055">Amazon Français</a></td>        <td align="center"><a href="http://www.amazon.co.jp/Annotated-Turing-Charles-Petzold/dp/0470229055">Amazon Japan</a></td>        <td align="center"><a href="http://bookshop.blackwell.co.uk/jsp/id/The_Annotated_Turing/9780470229057">Blackwell</a></td>      </tr>  </table>    </content>
    <datetime>Fri, 14 Mar 2008 20:23:30 GMT</datetime>
  </item>
  <item>
    <title>Can a Notebook be *Too* Thin?</title>
    <permalink>2008/03/110146.html</permalink>
    <comments>Comments (1)</comments>
    <dateline>March 10, 2008<br />New York, N.Y.</dateline>
    <content><p>  Yes, apparently a notebook can be too thin. In this week's <i>Newsweek</i>, Steven Levy reports how   <a href="http://www.newsweek.com/id/120052">he lost his review copy of the MacBook Air</a>.  The best that he can figure is that it was probably stuck in a stack of newspapers on his coffee table that were then moved to the recycling bin!  </p>  <p>  While I can certainly sympathize with the pains of losing an expensive piece of hardware, I actually took great comfort in Levy's column.  It was a pleasure to learn that at least one other techie still lives in a New York City apartment cluttered with newspapers and magazines &#x2014; this despite the opinion of all right-thinking and forward-looking people that we should abandon paper in favor of getting all our information directly off the screen in convenient 500-word nuggets.  </p>  <p>  Our household is very paper oriented. Deirdre and I get the <i>New York Times</i> delivered daily to our door, we also pick up <i>The Onion</i> every week, and we subscribe to 5 weekly magazines, 2 biweeklies, 4 monthlies, 1 bimonthly, and 5 quarterlies. Sometimes they tend to pile up not only on the coffee table, but also on the dinner table, and then to the floor when we need to eat meals.  </p>  <p>  We have a recycling pile in the apartment but it's not optimum: It's the top of a little step stool that we also use for reaching the top shelves of the bookcases. The little room outside the apartment with the garbage chute and recycling bin is only a few yards down the hall, but we tend to avoid that step because you never really know when you might need something that you prematurely moved to the pile.   </p>  <p>  I am proud of one innovation, however.  For those newspaper sections and magazines that both Deirdre and I read, we avoid confusion by a simple technique:  When I'm finished with the paper or magazine, I tear about a half-inch off the bottom-right corner of the cover. When Deirdre is finished with an issue, she tears off the upper-right corner. Anything that's been read by both of us is eligible for the recycling pile (unless one of us has tagged an article with a Post-It flag, which indicates something that needs to be removed and saved).  </p>  <p>  The system works fairly well &#x2014; despite all the little triangular corners all over the place....  </p></content>
    <datetime>Tue, 11 Mar 2008 01:46:16 GMT</datetime>
  </item>
  <item>
    <title>Can You Help Us with Marketing for “The Annotated Turing”?</title>
    <permalink>2008/03/070901.html</permalink>
    <comments>Comments (0)</comments>
    <dateline>March 6, 2008<br />New York, N.Y.</dateline>
    <content><p>  My wife Deirdre has just designed a new web site specifically for my forthcoming book, <i>The Annotated Turing: A Guided Tour through Alan Turing's Historic Paper on Computability and the Turing Machine</i>:  </p>  <p align="center">  <a href="http://www.TheAnnotatedTuring.com">www.TheAnnotatedTuring.com</a>  </p>  <p>  Deidre also wishes to speak to my blog audience directly. Here she is:  </p>  <ul>  As readers of this blog know, Charles has an exciting new book coming out in June. <i>The Annotated Turing</i> promises to be an important resource for history of computing buffs, educators and students of mathematics and computer science, programmers who want a deeper understanding of the machines on their desks, and long-time fans of Charles's writing.  </ul>  <ul>  Charles's publisher Wiley is making a tremendous effort to get copies of the book into the hands of reviewers and professors. Instructors can request an evaluation copy of the book from   <a href="http://www.wiley.com/WileyCDA/WileyTitle/productCd-0470229055.html"><i>The Annotated Turing</i> page of Wiley's web site</a>.  </ul>  <ul>  We're also trying to compile some information that might help Wiley and us to publicize the book:  </ul>  <ul>  <ul>  <li>  Did you encounter any of Charles's book (and in particular, <i>Code: The Hidden Language of Computer Hardware and Software</i>) in a class?  Let us know what school, class, and who assigned the book.  </li>  </ul>  <ul>  <li>  Have you ever assigned any of Charles's books in a class you taught? What classes and where?  </li>  </ul>  <ul>  <li>  Did you ever write an on-line review of <i>Code</i>?  We have some of them on   <a href="http://www.TheAnnotatedTuring.com/code.htm"><i>The Annotated Turing</i> web site</a>, but if we missed yours, can you send us the URL? Can we quote you?  </li>  </ul>  <ul>  <li>  Do you know of a class or instructor who might use <i>The Annotated Turing</i>?  </li>  </ul>  </ul>  <ul>  Send any information you have to me at   <a href="mailto:deirdre@theannotatedturing.com">deirdre@TheAnnotatedTuring.com</a>.   </ul>  <ul>  Thank you for your help.   </ul>  </content>
    <datetime>Fri, 07 Mar 2008 09:01:40 GMT</datetime>
  </item>
  <item>
    <title>“The Annotated Turing” Illustrated Bibliography</title>
    <permalink>2008/03/060948.html</permalink>
    <comments>Comments (1)</comments>
    <dateline>March 6, 2008<br />New York, N.Y.</dateline>
    <content><p>  In the 9 years or so I was working (on and off) on my new book  <a href="http://www.charlespetzold.com/AnnotatedTuring"><i>The Annotated Turing</i></a>  I accumulated a bunch of books related to Alan Turing, the Turing Machine, and the mathematical foundations behind Turing's paper on computability.  </p>  <p>  Many of these books were last assembled together in a bookcase in the guest room of our house in Roscoe, New York. These photos were taken on January 24, shortly before we came back to New York City and some of the books had to be separated from their siblings.  </p>  <ul>  <a href="http://www.charlespetzold.com/blog/2008/03/AnnotatedTuringIllustratedBibliographyShelf1.jpg">  <img src="http://www.charlespetzold.com/blog/2008/03/AnnotatedTuringIllustratedBibliographyShelf1Small.jpg" />   Aberth to Chaitin (900K)</a>  <br />  <a href="http://www.charlespetzold.com/blog/2008/03/AnnotatedTuringIllustratedBibliographyShelf2.jpg">  <img src="http://www.charlespetzold.com/blog/2008/03/AnnotatedTuringIllustratedBibliographyShelf2Small.jpg" />   Church to Franzén (1M)</a>  <br />  <a href="http://www.charlespetzold.com/blog/2008/03/AnnotatedTuringIllustratedBibliographyShelf3.jpg">  <img src="http://www.charlespetzold.com/blog/2008/03/AnnotatedTuringIllustratedBibliographyShelf3Small.jpg" />   Frege to Hilbert (1M)</a>  <br />  <a href="http://www.charlespetzold.com/blog/2008/03/AnnotatedTuringIllustratedBibliographyShelf4.jpg">  <img src="http://www.charlespetzold.com/blog/2008/03/AnnotatedTuringIllustratedBibliographyShelf4Small.jpg" />   Hilbert to Minsky (970K)</a>  <br />  <a href="http://www.charlespetzold.com/blog/2008/03/AnnotatedTuringIllustratedBibliographyShelf5.jpg">  <img src="http://www.charlespetzold.com/blog/2008/03/AnnotatedTuringIllustratedBibliographyShelf5Small.jpg" />   Mlodinow to Schöning (880K)</a>  <br />  <a href="http://www.charlespetzold.com/blog/2008/03/AnnotatedTuringIllustratedBibliographyShelf6.jpg">  <img src="http://www.charlespetzold.com/blog/2008/03/AnnotatedTuringIllustratedBibliographyShelf6Small.jpg" />   Seife to Wilder (860K)</a>  </ul>  </content>
    <datetime>Thu, 06 Mar 2008 21:48:05 GMT</datetime>
  </item>
  <item>
    <title>Of a Book Entitled “Mr. Turing's Computing Machine”</title>
    <permalink>2008/02/Mr-Turings-Computing-Machine.html</permalink>
    <comments>Comments (6)</comments>
    <dateline>March 1, 2008<br />Roscoe, N.Y.</dateline>
    <content><p>  In 1999, as I was finishing work on my book   <a href="http://www.charlespetzold.com/code"><i>Code: The Hidden Language of Computer Hardware and Software</i></a>, I had ideas for four "spin-off" books. I prepared single-page descriptions of each of these book ideas and showed them to my agent.  None of these books was "normal" in any way. One of the oddest was a book I called <i>Mr. Turing's Computing Machine</i>.  </p>  <p>  In researching <i>Code</i>, I read (or tried to read) many of the seminal books and papers that contributed to the early history of computing. One of these was Alan Turing's 1936 paper "On Computable Numbers, with an Application to the Entscheidungsproblem" in which he invents the imaginary computer now called the Turing Machine. In trying to comprehend this paper, I thought "This is such an important paper in the history of computing that somebody should really write a book explaining what's going on in here."  </p>  <p>  I think the whole concept of the book sprung into my head almost fully formed: I would take Turing's paper and annotate the living daylights out of it. At the very least, trying to write this book would let me devote the time and attention to Turing's paper that it so obviously deserved.  </p>  <p>  I have a Word file that I created on May 12, 1999 with a title page that says <i>Mr. Turing's Computing Machine</i>.  On the next page the text begins:  </p>  <ul>  One hundred years ago, on TK, 1900, German mathematician David Hilbert stood before the Second International Congress of Mathematicians and challenged his colleagues to solve 23 problems in the forthcoming century.  </ul>  <p>  In magazine writing, TK means "to come" and really means "I'm too lazy to look this up at the moment but I'll fill it in later."  Notice that the paragraph suggests a publication date for the book of about 2000!  Even so, I wasn't sure it was proper to begin the book with Hilbert's problems. There was some confusion in my mind about the exact relationship between Hilbert's 10th problem from 1900 (on Diophantine equations) and the Entscheidungsproblem referred to in the title of Turing's paper.  </p>  <p>  Of course, the really big question was whether I'd be able to write this book at all! I knew that I would need to understand <i>every word</i> in Turing's prose and <i>every subscript and superscript</i> in his equations. Would that even be possible? Surely everyone's prose has a <i>little</i> ambiguity in it. As far as I knew, nobody had ever done anything quite like this. Maybe there was an excellent reason for that!  </p>  <p>  To demonstrate to myself that I could carry off this difficult task, I knew I needed to write a good chunk of the book before going public.  Only then could I show the manuscript to my agent and programmer friends. Because the book would contain Turing's complete paper, I also knew that I needed to reproduce that paper in the pages of this manuscript. I wanted my manuscript to look like the pages of a book, and for Turing's paper to look as close to the original as I could manage with a custom Microsoft Word style sheet. I knew this was not going to be easy: Turing's paper contains several different fonts and some very complex tables.  </p>  <p>  Beginning in 1999 and numerous times over the next five years, I would open up the file for <i>Mr. Turing's Computing Machine</i> and try to make a little progress.  Inevitably I'd find myself working on the style sheet to reproduce Turing's paper. It seemed as if I couldn't bring myself to write my own annotations until Turing's paper looked correct in the Word file. Yet, it also seemed like a waste of time to design a style sheet for Turing's paper until I knew I could actually do something with it.  </p>  <p>  In September 2004 I found myself with some free time. I had been expecting to work on my untitled "Avalon Book" but Avalon had been delayed, and no one knew for how long. I decided to attack <i>Mr. Turing's Computing Machine</i> and to conquer my psychological blocks by doing something completely bizarre and downright perverted: <i>I moved away from the computer</i>.  </p>  <p>  Well, not exactly. I first used the computer to scan Turing's paper and print out the pages. Then I got comfortable on the couch with a yellow legal pad, a pen, a little pair of scissors, and tabs of clear tape in a dispenser strapped to my wrist. I'd cut out a piece of Turing's paper, tape it to a page in the yellow pad, and then hand-write my annotations.   </p>  <p>  Like most people, I gave up handwriting long ago. For me it was sometime around 1982 when I first learned WordStar on my Osborne 1. To actually hand-write large chunks of a book felt very strange, but the strategy worked. By entirely avoiding the technical word-processing problems, I could give my full attention to Turing's paper. Each little cut-out piece of the paper became the focus of my attentions. Because I was working on a pad, I could experiment with equations and illustrations with more flexibility than the computer allows.   </p>  <p>  Here are two of my handwritten pages, along with a later whole page from Turing's paper with an amusing number of notes I made:  </p>  <p align="center">  <a href="http://www.charlespetzold.com/blog/2008/03/TuringYellowPad1.png">  <img src="http://www.charlespetzold.com/blog/2008/03/TuringYellowPad1Thumbnail.png" /></a>  (2.7 megs)  <a href="http://www.charlespetzold.com/blog/2008/03/TuringYellowPad2.png">  <img src="http://www.charlespetzold.com/blog/2008/03/TuringYellowPad2Thumbnail.png" /></a>  (2.2 megs)  <a href="http://www.charlespetzold.com/blog/2008/03/TuringPg260.png">  <img src="http://www.charlespetzold.com/blog/2008/03/TuringPg260Thumbnail.png" /></a>  (0.6 megs)  </p>  <p>  For a couple months I worked like this, enjoying the process immensely. After I had about 110 handwritten pages, I felt much more confident that I could make the whole book work. Only then did I go back to the computer and work on the style sheet that would reproduce Turing's paper in my manuscript. I then typed in my handwritten pages, giving each yellow page a big red check mark as it went into the file.  </p>  <p>  Sometime around the beginning of 2005, I received an alert from Amazon.com about a forthcoming book by B. Jack Copeland entitled <i>Alan Turing's Automatic Computing Engine</i>. This book was about the ACE computer and had almost no overlap with my book, but the title was too close to my title <i>Mr. Turing's Computing Machine</i> for my comfort.   I changed my title first to <i>Alan Turing's Amazing Imaginary Computing Machine</i> and then to   <i>The Amazing Imaginary Computing Machine of Mr. Alan M. Turing</i> with the subtitle <i>A Guided Tour through Alan Turing’s Historic Paper on Computability</i>. I liked the old-fashioned sound of the new title, somewhat reminiscent of the 1965 movie <i>Those Magnificent Men in Their Flying Machines</i>.  </p>  <p>  By the early summer of 2005, the first 11 chapters (about 200 pages) of the book were ready to be read. I sent copies to my agent and several friends in the computer industry.  Although the book was "mostly" finished &#x2014; I anticipated another 100 or perhaps 150 pages to cover the last 40% of Turing's paper &#x2014; further work had to stop because WPF was now coming. From September 2005 through July 2006 I worked full-time on what we called "The Avalon Book" but which became <i>Applications = Code + Markup</i>. In the fall, I wrote my online book <i>.NET Book Zero</i> and then started <i>3D Programming for Windows</i> in December 2006, finishing that in June 2007.   </p>  <p>  I didn't want to wait any longer to finish what I was now calling just "The Turing Book" (the complete title was just too fatiguing) and also to try to find a publisher. (I didn't think my longtime publisher Microsoft Press was a good fit for this book.) With a   <a href="http://www.charlespetzold.com/blog/2007/03/280150.html">brazen blog entry</a> I found a courageous publisher in John Wiley &amp; Sons.  Right before   <a href="http://ckwebb.com/authors/working-with-charles-petzold/">Chris Webb</a> and I began negotiating the contract, I came up with the title  </p>  <p align="center"><font size="+2"><b><u>  The Annotated Turing  </u></b></font></p>  <p align="center"><font size="+1"><b>  A Guided Tour Through Alan Turing's<br />   Historic Paper on Computability<br />  and the Turing Machine  </b></font></p>  <p>  and it stuck.  </p>  <p>  I still have some work to do on <i>The Annotated Turing</i>, but it's mostly just reviewing edits and (eventually) pages. It looks like the scheduled publication date for the book is now June 10, 2008 &#x2014; more than nine years after I first created a Word file for the manuscript. Sometimes these projects take some time.  </p>  <table bgcolor="Yellow" align="center"  cellpadding="6">      <tr>         <td rowspan="4"><a href="http://www.charlespetzold.com/AnnotatedTuring">             <img src="http://www.charlespetzold.com/AnnotatedTuring/AnnotatedTuringCover25.jpg" />         </a></td>         <td colspan="3" align="center"><font size="+1"><b>Coming June 10, 2008!<br /><br />Available for Pre-Ordering</b></font></td>      </tr>      <tr>         <td align="center"><a href="http://www.wiley.com/WileyCDA/WileyTitle/productCd-0470229055.html">Wiley</a></td>         <td align="center"><a href="http://www.amazon.com/Annotated-Turing-Charles-Petzold/dp/0470229055">Amazon US</a></td>         <td align="center"><a href="http://search.barnesandnoble.com/The-Annotated-Turing/C-Petzold/e/9780470229057">Barnes &amp; Noble</a></td>      </tr>      <tr>         <td align="center"><a href="http://www.amazon.ca/Annotated-Turing-C-Petzold/dp/0470229055">Amazon Canada</a></td>        <td align="center"><a href="http://www.amazon.co.uk/Annotated-Turing-through-Historic-Computability/dp/0470229055">Amazon UK</a></td>        <td align="center"><a href="http://www.amazon.de/Annotated-Turing-Through-Historic-Computability/dp/0470229055">Amazon Deutsch</a></td>      </tr>      <tr>        <td align="center"><a href="http://www.amazon.fr/Annotated-Turing-Charles-Petzold/dp/0470229055">Amazon Français</a></td>        <td align="center"><a href="http://www.amazon.co.jp/Annotated-Turing-Charles-Petzold/dp/0470229055">Amazon Japan</a></td>        <td align="center"><a href="http://bookshop.blackwell.co.uk/jsp/id/The_Annotated_Turing/9780470229057">Blackwell</a></td>      </tr>  </table>    </content>
    <datetime>Sat, 01 Mar 2008 07:49:51 GMT</datetime>
  </item>
  <item>
    <title>Of a Book Entitled “Follow the Data”</title>
    <permalink>2008/02/Follow-the-Data.html</permalink>
    <comments>Comments (8)</comments>
    <dateline>February 26, 2008<br />New York, N.Y.</dateline>
    <content><p>  In 1999, as I was finishing work on my book   <a href="http://www.charlespetzold.com/code"><i>Code: The Hidden Language of Computer Hardware and Software</i></a>, I had ideas for four "spin-off" books. I prepared single-page descriptions of each of these book ideas and showed them to my agent.  Her favorite and my favorite was a book that I called <i>Follow the Data</i>.  </p>  <p>  I decided I didn't want to try to get a book contract for <i>Follow the Data</i> right away.  I wanted to try writing at least some of it free from the pressures of contracts and deadlines to see how it went.  (I had done the same thing with <i>Code</i>:  I wrote the first 10 chapters of <i>Code</i> before I showed it to <i>anybody</i>.)  </p>  <p>  The title of <i>Follow the Data</i> came from the famous line "Follow the money" that screenwriter William Goldman wrote for the film version of <i>All the President's Men</i>.  My idea was to explain different types of analog and digital storage and communications by showing how the data is transformed in various ways and then transmitted or stored. (For example, vocal cords vibrate sound in waves to vibrate a microphone diaphragm that converts sound to electrical waves to be input to an analog-to-digital convertor, etc.)  </p>  <p>  I didn't want the book to be purely technical, however. I wanted to have actual characters in the book just like in a novel, except when a character would take out a cell phone and start dialing, the book would shift to a technical discussion of what's happening inside the phone, and then trace the data until it reached the ear of the person on the other end, and then the book would proceed somewhat as a novel again.  </p>  <p>  In short, any time that anybody used any type of media &#x2014; be it written, spoken, visual, audio, mechanical, electrical, electronic, etc, etc, etc,  &#x2014; the book would go off on a technical tangent.  </p>  <p>  I wanted my main character to be a musician of some sort, and I thought it would be most illuminating to have sections of the book set in the past, so I could discuss some obsolete forms of technology such as the telegraph or acoustic sound recording or the newspaper. To make it simple, I decided to spread out the book (and my character's life) over 100 years.  The book would have five sections separated by 25 years, corresponding to the years 1900, 1925, 1950, 1975, and 2000. What a perfect book to be published in the first year of the new century!  </p>  <p>  But what type of musician would still be performing at the age of 100? Not an opera singer or a classical pianist, for sure. But perhaps... a blues singer? And with that thought, the book crystallized very quickly. My main character would be a blues singer in the tradition of Bessie Smith, Ida Cox, Mamie Smith, Ma Rainey, and Alberta Hunter. I named her Mrs. G (I don't know where that came from) and I knew that she also played banjo like Elizabeth Cotten did in her early years.  </p>  <p>  In the 1900 section, she is born to a middle-class family in Atlanta. Her father is a professional photographer (storage of visual information), and he sends a telegraph (transmission of text) announcing the birth of his daughter to relatives up north.  </p>  <p>  In the 1925 section, Mrs. G is married, a new mother of a baby boy, and playing her music and recording 78s on acoustic equipment. Her father is now an aspiring filmmaker, perhaps a somewhat older version of Oscar Micheaux.  </p>  <p>  In the 1950 section, Mrs. G's son (a veteran of the second world war) is involved in the early civil rights movement. Mrs. G appears on the <i>Ed Sullivan Show</i>.  </p>  <p>  In the 1975 section, people are playing eight-tracks and cassette tapes. Mrs. G goes into a studio to record some of her old songs but an over-enthusiastic producer decides to mix her music with more modern tracks, making what is later regarded as a "travesty."  </p>  <p>  It is the year 2000 and Mrs. G is 100 years old. People are using cell phones and computers. Mrs. G has been persuaded to come to New York City to record some of her old songs on state-of-the-art digital equipment. This time there will be no messing with it. A film crew is making a documentary about this recording session, and everything going on is electronic and digital &#x2014; except for Mrs. G playing her old banjo and singing.  In the last scene she is standing outside the downtown studio performing live with no electronics at all for a group of awestruck New Yorkers.  </p>  <p>  On and off, for almost a year I worked on <i>Follow the Data</i>, mapping out what technologies I'd be discussing in what contexts, as well as doing a considerable amount of period research.  I remember spending many hours in the library trying to figure out precisely the level of technology involved in 1950 television, for example, and how live broadcasting was done.  </p>  <p>  The research was going fine. The actual writing was a disaster. Without quite realizing it, I had plotted out a 20th century epic &#x2014; except that this particular historical epic wasn't really the point of the book! The book was supposed to show how information gets from place to place, and from person to person. I was trying to mesh two completely different books into one coherent narrative, and it just would not cohere. Every time I sat down to write a simple scene, I'd be horrified at the result.  </p>  <p>  It's not good to be horrified at your work. When you're trying to write a book, you want pleasant, uplifting, and encouraging thoughts going through your head. What seemed to go through my head when working on <i>Follow the Data</i> was the scene in <i>Godfather II</i> where Kay describes to Michael Corleone her concept of their marriage: "Oh, Michael. Michael, you are blind. It wasn't a miscarriage. It was an abortion. An abortion, Michael. Just like our marriage is an abortion. Something that's unholy and evil."  </p>  <p>  It's not good to be thinking of your work as "unholy and evil" and as a freelancer, it's definitely not good to be spending so much time on something that's just not working at all.  There comes a time when you have to admit defeat and move on.  </p>  <p>  Sometime towards the summer of 2000, the book entitled <i>Follow the Data</i> collapsed under its own weight. I'm not sure there was ever one day when I realized the book would never be written; I think it happened more gradually. Mrs. G &#x2014; who by this time was a very real person to me &#x2014;  would never get out of my head onto the page. <i>Follow the Data</i> died, but Mrs. G has never quite faded away. I can still hear her music in my head.  </p>  <p>  I knew from the beginning that <i>Follow the Data</i> was an odd and unusual book, but by the summer of 2000 I knew it was a little <i>too</i> odd and unusual. Some books were never meant to be. I wondered what I could possibly do next.  </p>  <p>  By September 2000, I was working on my first book about the new Microsoft software technology known as .NET.  </p>  </content>
    <datetime>Tue, 26 Feb 2008 11:48:09 GMT</datetime>
  </item>
  <item>
    <title>Best Picture Nominees</title>
    <permalink>2008/02/200251.html</permalink>
    <comments>Comments (0)</comments>
    <dateline>February 20, 2008<br />Roscoe, N.Y.</dateline>
    <content><p>  Did this year seem a little cinematically emaciated? Regardless, here are my takes on the Big Five from worst to best:  </p>  <p><b>  Atonement  </b></p>  <p>  Ian McEwan's <i>Atonement</i> is a wonderful novel.  From the opening paragraphs, the character of budding novelist Briony Tallis is a true marvel. Through a vivid imagination deeper than her understanding, Briony makes a serious mistake with catastrophic consequences, and for which she spends the rest of the novel (or, let's say, the <i>entire</i> novel, if you know what I mean) atoning.  </p>  <p>  Turning this novel into a movie of thwarted love is moronic. This is a film that never should have been made.  </p>  <p><b>  Michael Clayton  </b></p>  <p>  Sure I enjoyed it while I was watching it, but it left me as soon as I exited the theater.  Even while watching, I wondered:  Why is one murder done so skillfully so that no trace can be found, while the next murder attempt involves a very showy car bomb?  A well-made trifle.  </p>  <p><b>  No Country for Old Men  </b></p>  <p>  I didn't read the Cormac McCarthy novel this was based on, but I have to assume that the Tommy Lee Jones role was reduced once the Coen brothers got a load of Javier Bardem's scene-stealing performance. I generally like Coen brothers movies more than most people &#x2014; I'm a big fan of <i>Miller's Crossing</i>, for example &#x2014; but this one seemed lopsided to me.  </p>  <p><b>  Juno  </b></p>  <p>  Yes, you can get pregnant the first time. This story of a smart wise-cracking 16-year old tomboy is at times a little too precious and a little too over-written, but Ellen Page and Michael Cera make it very real and very touching. Ellen Page is a gifted young actress &#x2014; you might want to catch her truly disturbing performance in <i>Hard Candy</i> to see what I mean  &#x2014; and I'm curious to see where she'll be headed in the future.  </p>  <p><b>  There Will Be Blood  </b></p>  <p>  Paul Thomas Anderson has always had epic tendencies, even with the non-epic subjects of <i>Boogie Nights</i>, <i>Magnolia</i>, and <i>Punch Drunk Love</i>. In this film, a rise-and-fall portrait of an oilman portrayed by Daniel Day-Lewis, Anderson finally tackles a subject that fits his skills. It's no <i>Citizen Kane</i> or <i>Chinatown</i> (and at times bears an uncomfortable resemblance to <i>Giant</i>) but it's a full commanding meld of American history and personal tragedy.  </p>  <p><b>  Sweeney Todd  </b></p>  <p>  I was very skeptical about this film, mostly because I still have fond memories of the original Broadway production of Stephen Sondheim's 1979 operetta, and nothing here seemed right. Casting Johnny Depp in the lead role seemed ridiculous and I hadn't been much impressed with much that Tim Burton has done recently. Then I read that all the choruses were being removed &#x2014; including the unforgettable opening "Attend the tale of Sweeney Todd" and indispensable "More meat pies! More meat pies!"  How could this possibly work?  </p>  <p>  Well, whattaya know: Tim Burton turned in a true masterpiece, a bleak view of Victorian London with dark gaslit interiors and foggy exteriors separated by wrinkled glass.   </p>  <p>  This is a near flawless integration of music, visuals, and performances.  Too bad it wasn't even nominated.  </p>   </content>
    <datetime>Wed, 20 Feb 2008 14:51:00 GMT</datetime>
  </item>
  <item>
    <title>"A room without books is like a body without a soul" (Cicero)</title>
    <permalink>2008/02/130857.html</permalink>
    <comments>Comments (11)</comments>
    <dateline>February 13, 2008<br />New York, N.Y.</dateline>
    <content><p>  I was paging through the Sunday Business section of the New York <i>Times</i> when I saw a drawing of what was claimed to be a home but which to me looked more like a well-equipped hotel room:  </p>  <p align="center">  <img src="http://graphics8.nytimes.com/images/2008/02/09/business/20080210_SOAP.jpg" />  </p>  <p>  Where are the books? I wondered. Doesn't every home have lots of books? But of course that was the whole point:  This is a home of the future as described in the accompanying article  <a href="http://www.nytimes.com/2008/02/10/business/10metrics.html">"Pushing Paper Out the Door"</a>. There are no books in this home because books are made of paper.  </p>  <p>  I gradually came to see the sense of it: If there's nothing to read, there's no reason to be forced to make a choice between classical incandescent bulbs and modern energy-saving flourescent bulbs. You don't need any lightbulbs at all, thus greatly reducing your carbon footprint.  </p>  <p>  Eventually I spotted the e-book reader on the table next to the sofa &#x2014; the very same sofa pointed at the TV set. Presumably in case you get tired of watching <i>American Gladiator</i>, <i>The Biggest Loser</i>, and <i>Supernanny</i>, you could pick up the e-book reader and catch a few episodes (I mean chapters, of course) of a book.  </p>  <p>  And then it hit me &#x2014; my billion-dollar idea.   </p>  <p>  I get one or two billion-dollar ideas a year but they never go anywhere because I don't have the entrepreneurial gene and can conceive of nothing more dismal than running my own company. So I get the billion-dollar ideas but then I throw them away.  </p>  <p>  This one I'm throwing away in public in case anybody wants to take it and run.  </p>  <p>  As you may know, one of the big marketing problems of e-book readers like the Kindle is that they don't really do that much.  Unless you want to read a book, they're pretty much useless. So here's my idea, inspired by seeing the e-book reader on the table next to the sofa facing the TV:  Combine the e-book reader with a universal remote, so it becomes a Universal Media Controller (UMC).  With the UMC you only need one device to turn off the boring TV to read a book, and the same device to turn the TV back on after you've had enough reading of the boring book.  </p>  <p>  Is this brilliant or what?  </p>  </content>
    <datetime>Wed, 13 Feb 2008 20:57:22 GMT</datetime>
  </item>
  <item>
    <title>600 Lines is a Luxury</title>
    <permalink>2008/01/250812.html</permalink>
    <comments>Comments (5)</comments>
    <dateline>January 25, 2008<br />Roscoe, N.Y.</dateline>
    <content><p>  Jeff Atwood asks   <a href="http://www.codinghorror.com/blog/archives/001043.html">What Can You Build in 600 Lines of Code?</a>  As someone whose entire career is based on writing the shortest programs I can, let me take a little obnoxious trip down memory lane.  </p>  <p>  In the mid 80's, Paul Somerson was Executive Editor of <i>PC Magazine</i> and ran the "back of the book" where all the programming stuff appeared.   The Programming column featured mostly handy command-line DOS utilities, and the criterion was 500 <i>bytes</i> of machine code in a .COM file &#x2014; up to 1K if the program was "really cool." We wrote them in 8086 assembly language, of course, so perhaps the actual line count exceeded 600 lines, but the byte count is easily calculable if you have the old issues.  </p>  <p>  Here are my <i>PC Magazine</i> utilities from a three-month period back when I was Jeff Atwood's age:  </p>  <ul>  DDIR, a double-column directory display (10/1/85 issue):  800 bytes.  </ul>  <ul>  VTREE to display directory trees with line-drawing characters (10/29/85 issue):  512 bytes.  </ul>  <ul>  SWEEP to execute a command in nested directories (11/12/85 issue):  592 bytes.  </ul>  <ul>  WAITASEC to call back scrolled-off lines (11/26/85 issue):  760 bytes.  </ul>  <ul>  KEY-FAKE for batch files. It shoved keystrokes into the keyboard buffer to be consumed by the next executed program (12/24/85 issue):  536 bytes  </ul>  <ul>  MONOGRAF.DRV for Lotus 1-2-3 that let you view bar graphs on the monochrome display with character-mode video boards (12/10/85 issue): 528 bytes.  </ul>  <p>  By this era, the actual assembly language listings were not printed in the magazine. Instead, <i>PC Magazine</i> had an Interactive Reader Service accessible by modem and a phone number in the 212 area code. Be sure to use the XMODEM protocol to download the files!  </p>  <p>  Instead of assembly language listings, the articles included a listing of a BASIC program with multiple DATA statements (8 numbers per line with a checksum) that generated the .COM file for you.  That's how I was able to determine the byte count of these old utilties so easily.  </p>  <p>  Where are the actual assembly language listings now that the <i>PC Magazine</i> Interactive Reader Service is no more?  I would say that they are pretty much gone into that great bit bucket in the sky.  (Too bad they weren't printed in the magazine, because as we all know, paper is forever.)  </p>  </content>
    <datetime>Fri, 25 Jan 2008 20:12:46 GMT</datetime>
  </item>
  <item>
    <title>Tennis and Technology</title>
    <permalink>2008/01/230536.html</permalink>
    <comments>Comments (1)</comments>
    <dateline>January 23, 2008<br />New York, N.Y.</dateline>
    <content><p>  During the first week of my freshman year at Stevens Institutute of Technology, the various organizations and sports teams attempted to seduce us into joining up. Our class of budding engineering and science students were quite impressed when the fencing coach told us that his sport was the only one "with a completely electronic scoring system."  </p>  <p>  Over the past few years, several sports have been edging towards more mechanized umpire calls, most notably tennis. A technology called Hawk-Eye &#x2014; here's the   <a href="http://en.wikipedia.org/wiki/Hawk_Eye">Wikipedia entry</a> and the   <a href="http://www.hawkeyeinnovations.co.uk/">company's site</a> with their   <a href="http://www.hawkeyeinnovations.co.uk/?page_id=1011">how it works</a> &#x2014; places multiple high-speed cameras around the court, and does a computer composite of the ball's motion. For tennis, the crucial information is whether the ball hit the ground inside the line, outside the line, or touched the line at all (which counts as in).  </p>  <p>  The technology was first used by TV broadcasters as a virtual instant replay to double-check the line refs, but has recently been adopted by several major tournaments.  Right now, it's being used at the Australian Open in at least two courts. On any match on these courts, each player gets three "challenges" per set if the player feels the line ref called the ball incorrectly. The computer simulation is shown on a JumboTron and the spectators make a crescendo "Whooo" sound as the animated ball strikes the ground. If the line ref was wrong and the player correct, the score is adjusted or the point is replayed, and that challenge doesn't count toward the three-set maximum.  </p>  <p>  Some players are somewhat opposed to the technology &#x2014; more philosophically than practically, I suppose &#x2014; but most players like it, and the spectators get into it, and it tends to lead to fewer "You cannot be serious!" meltdowns.  </p>  <p>  Tennis has always been susceptible to mistaken calls.  This may be one reason why a game must be won by two points, and a set won by two games. It's a built-in buffer for errors. The problem has probably become worse in recent decades as aluminum rackets have greatly increased ball speed.  I don't know if the Hawk-Eye technology can actually be applied yet in real time &#x2014; and sometimes it's not possible at all if one of the cameras is blocked in some way &#x2014; but it's not hard to imagine a time five or ten years in the future when all line calls in major matches are judged electronically.   </p>  <p>  Meanwhile, the women's side of the Australian Open is making history this week: Two women from Serbia have reached the semifinals. Twenty-two year old Jelena Janković will go up against Maria Sharápova, and 20 year old Ana Ivanović will meet   Daniela Hantuchová (whose appearance in the semifinal is a little bit of miracle in itself). The two women's semifinals will be begin at 1:30 PM Thursday afternoon in Melbourne, but by a strange time-warp effect can actually be viewed in the U.S. Wednesday evening (tonight) starting at 9:30 PM EST on ESPN2  </p>  <p>  Deidre and I will probably miss a bit of the Janković / Sharápova match &#x2014; we're in the city right now and we'll be driving back to Roscoe this evening &#x2014; but I suspect the Ivanović / Hantuchová match will be fun as well.  </p>          </content>
    <datetime>Wed, 23 Jan 2008 17:36:27 GMT</datetime>
  </item>
  <item>
    <title>Progressive Arcs in XAML</title>
    <permalink>2008/01/Progressive-Arcs-in-XAML.html</permalink>
    <comments>Comments (0)</comments>
    <dateline>January 16, 2008<br />Roscoe, N.Y.</dateline>
    <content><p>  No, these are not arcs who participate in anti-war demonstrations (alas). These are arcs that get longer with time, seemingly drawing themselves. It's a technique similar to the one I showed in a blog entry long, long ago:  </p>  <p align="center">  <a href="http://www.charlespetzold.com/blog/2006/08/150351.html">XAML Puzzle-Solving</a>  </p>  <p>  but with arcs instead of lines:  </p>  <p align="center">  <a href="http://www.charlespetzold.com/blog/2008/01/ProgressiveArcs.xaml">ProgressiveArcs.xaml</a>  </p>  <p>  The figure consists of eight 180° <i>ArcSegment</i> objects, and the animations are eight <i>PointAnimationUsingPath</i> objects, each targetting the <i>Point</i> property of each <i>ArcSegment</i>.  Notice that all the targetted points start at the same value, and all the animations start out the same, but one by one they stop based on both the <i>PathGeometry</i> and the <i>Duration</i>, leaving that point fixed.  </p>  <p>  For a fun variation, add  </p>  <ul>  StrokeDashCap="Round" StrokeDashArray="0 2"   </ul>  <p>  to the <i>Path</i> element.  </p>  </content>
    <datetime>Wed, 16 Jan 2008 21:48:24 GMT</datetime>
  </item>
  <item>
    <title>What Kind of Weirdo Company Makes a Product Like This???</title>
    <permalink>2008/01/151205.html</permalink>
    <comments>Comments (5)</comments>
    <dateline>January 14, 2008<br />New York, N.Y.</dateline>
    <content><p align="center">  <img src="http://ecx.images-amazon.com/images/I/31eInbLe8TL._SS500_.jpg" />  </p>  <p>  You can actually buy one from Amazon.com:  </p>  <p align="center">  <a href="http://www.amazon.com/I-Love-Charles-Petzold-T-Shirt/dp/B0010JAN3E">www.amazon.com/I-Love-Charles-Petzold-T-Shirt/dp/B0010JAN3E</a>  </p>  <p>  I strongly suspect it's a "print on demand" item: The photo doesn't look very realistic, and the company seems to have quite a few very similar products, some with names I've heard of, and many with names equally obscure to most people as my own.  </p>        </content>
    <datetime>Tue, 15 Jan 2008 00:05:07 GMT</datetime>
  </item>
  <item>
    <title>R.E.S.P.E.C.T.</title>
    <permalink>2008/01/Respect.html</permalink>
    <comments>Comments (8)</comments>
    <dateline>January 12, 2008<br />Roscoe, N.Y.</dateline>
    <content><p>  Recently when I was re-reading Philip Roth's <i>The Ghost Writer</i> (1979) I was struck by the following paragraph toward the end of Chapter 1.  The narrator is speaking of his idol, the fictional writer E. I. Lonoff:  </p>  <ul>  He winced when he stood up &#x2014; lumbago, he explained, from turning one too many sentences around [i.e., writing] that day &#x2014; and said that he still had his evening's reading. He did not do justice to a writer unless he read him on consecutive days and for no less than three hours at a sitting. Otherwise despite his notetaking and underlining, he lost touch with a book's inner life and might as well not have begun. Sometimes, when he unavoidably had to miss a day, he would go back and begin all over again. rather than be nagged by his sense that he was wronging a serious author.  </ul>  <p>  Of course, few of us have either the time or stamina to devote three hours a day, day after day, to reading a book until it's finished, but I envy such a strategy for paying proper respect to a book's author. It is perhaps a goal I might try to aspire to in the future.  </p>  <p>  At about the same time I was re-reading <i>The Ghost Writer</i>, Apple was running iPhone advertisements showing someone watching a <i>Pirates of the Caribbean</i> movie on the small screen. When a sea monster appears in the movie, the user suddenly gets a hunger for sea food. He switches away from the movie, does a search of sea food restaurants in San Francisco, picks one, and then the iPhone dials for reservations.  </p>  <p>  This ability to pause a movie on the iPhone to do something else &#x2014; to interrupt the viewing of the movie to give into every little whim and distraction &#x2014; is actually supposed to be a <i>feature</i> of the device rather than yet another hideous impediment to the interrupted viewing of movies.  </p>  <p>  "But Charles," you say. "It's not like it's <i>Citizen Kane</i>. It's only a stupid <i>Pirates of the Caribbean</i> movie. You can't even tell which one it is!"   </p>  <p>  Then why is it being watched to begin with? If it's worth watching at all, it's worth watching with a little bit of respect and consideration for the people who made the thing.  </p>  <p>  This is why theaters and public performances will never die. The enormous benefit of seeing movies in a theater is not just the big screen, and the benefit of attending plays or operas or concerts is not just the immediacy and the rare opportunity to hear music unadorned of amplification. The real advantage is that you're virtually <i>stuck in a seat</i> for the duration of the performance! Not only that, but it's dark! You can't read a magazine while the movie is going on or send text messages during the play. You're forced to look at the thing, and because it cost some money, you pay more attention than if it were free. You don't want to miss a word or a note, and if it's a live performance, you realize the experience is fleetingly temporal. The mind is focused; enjoyment is intensified; understanding is heightened.   </p>  <p>  I mention all this because there's a YouTube video of David Lynch going around where he dicusses how his movies can be better appreciated on the big screen rather than a little iPhone. (The video has been dressed up with some iPhone music.) Some people are actually <i>mocking</i> Lynch for his presumption for expressing these very simple and basic observations. How dare he tell us how to watch his movies!  </p>  <p>  No one is forcing you to watch David Lynch movies, and if you want to watch them on a tiny screen, or in an incorrect aspect ratio, or paused every few minutes, or while reading your email, or restricted to the sex scenes, you are free to do so. You can freely demonstrate that David Lynch isn't the boss of you by watching his movies in whatever damn way you please.  </p>  <p>  <i>We have the technology</i>, but that doesn't mean we have to use it. If we acknowledge that this director &#x2014; or any director &#x2014; may have something to say to us, the least we can do is meet him or her half way, and that means trying to watch the movie in a format for which it was intended.  </p>    <p>  It's simple common courtesy. It's respect.  </p>    </content>
    <datetime>Sat, 12 Jan 2008 02:48:24 GMT</datetime>
  </item>
  <item>
    <title>Cabinet Perspective in WPF 3D</title>
    <permalink>2008/01/091222.html</permalink>
    <comments>Comments (1)</comments>
    <dateline>January 8, 2008<br />Roscoe, N.Y.</dateline>
    <content><p>  This is a bookcase:  </p>  <p align="center">  <img src="http://www.charlespetzold.com/blog/2008/01/CabinetTransform.png" />  </p>  <p>  It's a place we used to store our books back in the dark ages.   </p>  <p>  It's also an illustration of a <i>cabinet perspective</i>. Notice that the front is all right angles but you can still see the left side and top.  </p>  <p>  To realize a cabinet perspective in WPF 3D you must make use of a <i>MatrixTransform3D</i> object and implement a three-dimensional skew transform. For this particular figure (which is 2 units wide, 4 units tall, and 1 unit deep), the transform formulas I used are:  </p>  <ul>  <i>x</i>' = <i>x</i> + 0.25<i>z</i><br />  <i>y</i>' = <i>y</i> &#x2013; 0.25<i>z</i><br />  <i>z</i>' = <i>z</i>  </ul>  <p>  Both the <i>x</i> and <i>y</i> coordinates are offset by an amount that's proportional to the <i>z</i> coordinate.  </p>  <p>  The following XAML file was used to make the image shown above. The sides and shelves are based on a unit cube that is scaled and translated in various ways. (I discuss this technique in Chapter 2 of my book  <a href="http://www.charlespetzold.com/3D"><i>3D Programming for Windows</i></a>.) The whole bookcase is defined as a  <i>Model3DGroup</i> resource, and then the transform is applied to the <i>ModelVisual3D</i> incorporating this model.  </p>  <p align="center">  <a href="http://www.charlespetzold.com/blog/2008/01/CabinetTransform1.xaml">CabinetTransform1.xaml</a>  </p>  <p>  If you're using this type of perspective a lot, it may make sense to define a dedicated camera transform for it.  You'd probably derive a class from <i>Viewport3D</i> and set up a <i>MatrixCamera</i> object in code using techniques discussed in Chapter 7 of my book. Here's a XAML example of camera transforms that realize the same perspective effect:  </p>  <p align="center">  <a href="http://www.charlespetzold.com/blog/2008/01/CabinetTransform2.xaml">CabinetTransform2.xaml</a>  </p>  <p>  Because I'm doing it all in XAML, notice that the <i>Height</i> of the <i>Viewport3D</i> is bound to its <i>ActualWidth</i> so it has a <i>ViewMatrix</i> aspect ratio of 1. As a result, the image might not be centered in your browser window.  </p>  </content>
    <datetime>Wed, 09 Jan 2008 12:22:12 GMT</datetime>
  </item>
  <item>
    <title>Even Before I Was Born</title>
    <permalink>2008/01/071152.html</permalink>
    <comments>Comments (1)</comments>
    <dateline>January 7, 2008<br />Roscoe, N.Y.</dateline>
    <content><p>  "Incidently, π is now know, by computation in the ENIAC computer at Aberdeen Proving Ground, to 2035 digits; the result of the voluntary week-end work of four operators of the machine!"  </p>  <p>  &#x2014; Raymond L. Wilder, <i>Introduction to the Foundations of Mathematics</i> (Wiley, 1952), p. 235  </p>  <p>  (According to the  <a href="http://en.wikipedia.org/wiki/Pi">Wikipedia entry on π</a>, it was 2037 digits, the year was 1949, 70 hours were required, and John von Neumann was in charge.)  </p>  </content>
    <datetime>Mon, 07 Jan 2008 23:52:18 GMT</datetime>
  </item>
  <item>
    <title>The Kindle Paradox</title>
    <permalink>2008/01/040339.html</permalink>
    <comments>Comments (8)</comments>
    <dateline>January 4, 2008<br />Roscoe, N.Y.</dateline>
    <content><p>  Jeff Gomez, the <i>Print is Dead</i> author and blogger, has now declared that  <a href="http://printisdeadblog.com/2008/01/04/the-unknown-solder-kindle-we-hardly-knew-ye/">the Kindle is dead</a>.  </p>  <p>  Mr. Gomez believes that for Kindle 2.0 to be successfully, Amazon must unlock some of the hidden features (such as  a Minesweeper game) and add some more features.  Otherwise, why pay $400 to read a book?  </p>  <p>  And therein lies the central paradox of ebook readers like the Kindle: The more features an ebook reader accumulates, the less suitable it is for actually reading books.  </p>  <p>  What are the prerequisites for reading a book? A good chair and light, of course (those are the technological requirements) but most important are <i>time</i>, a <i>quiet mind</i>, and <i>minimal distractions</i>. If you read a paragraph of the book and feel a need to look up something in IMDB &#x2014; and believe me, I've been there &#x2014; you might want to actually <i>turn off</i> the biggest assemblage of hyperlinked distractions you own.  </p>  <p>  The Kindle can already access Wikipedia. Why shouldn't it access the whole Internet? And why can't you get your email and read your RSS feeds? And shouldn't it play MP3's as well? These are not unreasonable features, and surely the Kindle seems emaciated without them. Yet each new feature is nothing more than another distraction that seductively lures you from the actual pages of the book.  </p>  <p>  Ebook readers like the Kindle can't survive in the market without features that end up subverting the original purpose of the device. Have you ever heard of a technological concept more doomed to failure?  </p></content>
    <datetime>Fri, 04 Jan 2008 15:39:02 GMT</datetime>
  </item>
  <item>
    <title>The Mathematics of ArcSegment</title>
    <permalink>2008/01/Mathematics-of-ArcSegment.html</permalink>
    <comments>Comments (4)</comments>
    <dateline>January 2, 2008<br />Roscoe, N.Y.</dateline>
    <content><p>  In the Windows Presentation Foundation, the traditional concept of the graphics path is realized by the abstract <i>Geometry</i> class and its derivatives, most prominently <i>PathGeometry</i>.   </p>  <p>  A <i>PathGeometry</i> is potentially a collection of connected and disconnected straight lines and curves, some of which might define enclosed areas. The easiest way to render a <i>Geometry</i> object (such as <i>PathGeometry</i>) on the screen is to set it to the <i>Data</i> property of a <i>Path</i> element, also specifying the pen characteristics used to stroke the path, and the brush to fill enclosed areas.  </p>  <p>  From the programmer's perspective a <i>PathGeometry</i> is a collection of <i>PathFigure</i> objects, each of which describes a single series of connected straight lines and curves. The <i>PathFigure</i> class has a <i>StartPoint</i> property and contains a collection of <i>PathSegment</i> objects. <i>PathSegment</i> is an abstract class from which seven other classes derive: <i>LineSegment</i>, <i>PolyLineSegment</i>, <i>BezierSegment</i>, <i>PolyBezierSegment</i>, <i>QuadraticBezierSegment</i>, <i>PolyQuadraticBezierSegment</i>, and <i>ArcSegment</i>. The first segment in the collection maintained by <i>PathFigure</i> begins at the <i>StartPoint</i> property that the figure defines. Each succeeding segment starts at the last point in the preceding segment. The points where one segment ends and the next one begins are always explicitly specified.   </p>  <p>  There may come a time when you need to generate polyline approximations to the various types of path segments. The <i>Geometry</i> class itself has a method named <i>GetFlattenedPathGeometry</i> and the <i>PathFigure</i> class has a method named <i>GetFlattenedPathFigure</i> that does this for you, but there might be a reason you want to do it yourself. (For example, you might want an approach that doesn't explicitly or implicitly cause routine memory allocations from the managed heap.)  </p>  <p>  Polyline approximations to the Bezier and quadratic Bezier curves are well know; the derivation of parametric formulas for these two curves is shown in pages 806 through 812 of my book   <a href="http://www.charlespetzold.com/wpf"><i>Applications = Code + Markup</i></a>.  </p>  <p>  The <i>ArcSegment</i>, however, is particularly tricky. That's what I'll tackle in this blog entry.  </p>  <p>  When using <i>ArcSegment</i>, the arc always begins at the end of the preceding segment (or the <i>StartPoint</i> property of <i>PathFigure</i>) and ends at the <i>Point</i> property of <i>ArcSegment</i>. Let's call these two points <i>pt1</i> and <i>pt2</i>:  </p>  <p align="center">  <img src="http://www.charlespetzold.com/blog/2008/01/ArcSegmentPoints.png" />  </p>  <p>  The <i>ArcSegment</i> class also defines a property named <i>Size</i> of type <i>Size</i>. The <i>Width</i> and <i>Height</i> properties of <i>Size</i> specify the horizontal and vertical radii of the ellipse (also known as semimajor and semiminor axes). To keep it simple (initially) let's assume that the two dimensions are equal , resulting in a circle:  </p>  <p align="center">  <img src="http://www.charlespetzold.com/blog/2008/01/ArcSegmentCircle.png" />  </p>  <p>  Conceptually, the WPF aligns this circle with the two points. In general, there are two ways this can be done:  </p>  <p align="center">  <img src="http://www.charlespetzold.com/blog/2008/01/ArcSegmentCircles.png" />  </p>  <p>  Thus, for a circle of a particular dimension, there are at most four ways to draw an arc from <i>pt1</i> to <i>pt2</i>. You specify which one you want using the <i>SweepDirection</i> and <i>IsLargeArc</i> properties of <i>ArcSegment</i>. Set the <i>SweepDirection</i> property to one of the two enumeration values <i>SweepDirection.Clockwise</i> or <i>SweepDirection.Counterclockwise</i>. Set <i>IsLargeArc</i> to true if you want the arc that's greater than 180° and false otherwise. Keep in mind that the arc is always drawn <b>from</b> <i>pt1</i> <b>to</b> <i>pt2</i>, so there's no ambiguity.   </p>  <p>  Here are the four possibilities shown in color:  </p>  <p align="center">  <img src="http://www.charlespetzold.com/blog/2008/01/ArcPossibilities.png" />  </p>  <p>  That's from a program in Chapter 28 of <i>Applications = Code + Markup</i>:  </p>  <p align="center">  <a href="http://www.charlespetzold.com/blog/2008/01/ArcPossibilities.xaml">ArcPossibilities.xaml</a>  </p>  <p>  I'm sure that a similar program is in every WPF programming book.  </p>  <p>  If you need to reproduce the <i>ArcSegment</i> with a polyline approximation, you must determine the center of one of the two circles. The two points are connected by a chord:  </p>  <p align="center">  <img src="http://www.charlespetzold.com/blog/2008/01/ArcSegmentChord.png" />  </p>  <p>  Get some information about that chord, including the vector from <i>pt1</i> to <i>pt2</i>:  </p>  <ul>  Point midPoint = new Point((pt1.X + pt2.X) / 2, (pt1.Y + pt2.Y) / 2);<br />  Vector vect = pt2 &#x2013; pt1;<br />  double halfChord = vect.Length / 2;  </ul>  <p>  Rotate the vector 90°. Which way you rotate it depends on the settings of <i>IsLargeArc</i> and <i>SweepDirection</i>. If the Boolean value of <i>IsLargeArc</i> equals (<i>SweepDirection</i> == <i>SweepDirection.Counterclockwise</i>), rotate it 90° clockwise:  </p>  <ul>  vectRotated = new Vector(&#x2013;vect.Y, vect.X);  </ul>  <p>  Otherwise, rotate it 90° clockwise:  </p>  <ul>  vectRotated = new Vector(vect.Y, &#x2013;vect.X);  </ul>  <p>  And normalize it:  </p>  <ul>  vectRotated.Normalize();  </ul>  <p>  That is now a unit vector perpendicular to the chord and pointing to the center of the appropriate circle. Now calculate the distance from the midpoint of that chord to the center of the circle using the Pythagorean theorem. The other two sides are half the length of the chord, and the radius of the circle:  </p>  <ul>  double centerDistance = Math.Sqrt(radius * radius &#x2013; halfChord * halfChord);  </ul>  <p>  You can then find the center point of the circle by multiplying that distance by the rotated vector and adding it to the midpoint of the chord:  </p>  <ul>  Point center = midPoint + centerDistance * vectRotated;  </ul>  <p align="center">  <img src="http://www.charlespetzold.com/blog/2008/01/ArcSegmentCenters.png" />  </p>  <p>  Once you have the center point, determine the angles from the center to <i>pt1</i> and <i>pt2</i> using <i>Math.Atan2</i>:  </p>  <ul>  double angle1 = Math.Atan2(pt1.Y &#x2013; center.Y, pt1.X &#x2013; center.X);<br />  double angle2 = Math.Atan2(pt2.Y &#x2013; center.Y, pt2.X &#x2013; center.X);  </ul>  <p>  Because <i>Math.Atan2</i> returns angles in the range of 0 to 2π, you will have to adjust them if <i>IsLargeArc</i> is true, and the absolute value of the difference between the angles is less than π. You'll want to increase the lesser of the two angles by 2π. You're now in a good position to calculate the points of the arc using the common parametric equations for the ellipse.  </p>  <p>  Here's a <i>FlattenArc</i> method appropriate for a circle. The arguments to the method correspond (roughly) to the properties of <i>ArcSegment</i> but with only one radius.  </p>  <p style='font-family: monospace; font-weight:bold; font-size:smaller; background:#E0E0E0'>  void&#x00A0;FlattenArc(IList&lt;Point&gt;&#x00A0;points,&#x00A0;Point&#x00A0;pt1,&#x00A0;Point&#x00A0;pt2,<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;double&#x00A0;radiusY,&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;bool&#x00A0;isLargeArc,&#x00A0;bool&#x00A0;isCounterclockwise,&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;double&#x00A0;tolerance)<br />{<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;//&#x00A0;Get&#x00A0;info&#x00A0;about&#x00A0;chord&#x00A0;that&#x00A0;connects&#x00A0;both&#x00A0;points<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;Point&#x00A0;midPoint&#x00A0;=&#x00A0;new&#x00A0;Point((pt1.X&#x00A0;+&#x00A0;pt2.X)&#x00A0;/&#x00A0;2,&#x00A0;(pt1.Y&#x00A0;+&#x00A0;pt2.Y)&#x00A0;/&#x00A0;2);<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;Vector&#x00A0;vect&#x00A0;=&#x00A0;pt2&#x00A0;-&#x00A0;pt1;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;double&#x00A0;halfChord&#x00A0;=&#x00A0;vect.Length&#x00A0;/&#x00A0;2;<br /><br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;//&#x00A0;Get&#x00A0;vector&#x00A0;from&#x00A0;chord&#x00A0;to&#x00A0;center<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;Vector&#x00A0;vectRotated;<br /><br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;//&#x00A0;(comparing&#x00A0;two&#x00A0;Booleans&#x00A0;here!)<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;if&#x00A0;(isLargeArc&#x00A0;==&#x00A0;isCounterclockwise)<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;vectRotated&#x00A0;=&#x00A0;new&#x00A0;Vector(-vect.Y,&#x00A0;vect.X);<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;else<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;vectRotated&#x00A0;=&#x00A0;new&#x00A0;Vector(vect.Y,&#x00A0;-vect.X);<br /><br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;vectRotated.Normalize();<br /><br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;//&#x00A0;Distance&#x00A0;from&#x00A0;chord&#x00A0;to&#x00A0;center&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;double&#x00A0;centerDistance&#x00A0;=&#x00A0;Math.Sqrt(radiusY&#x00A0;*&#x00A0;radiusY&#x00A0;-&#x00A0;halfChord&#x00A0;*&#x00A0;halfChord);<br /><br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;//&#x00A0;Calculate&#x00A0;center&#x00A0;point<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;Point&#x00A0;center&#x00A0;=&#x00A0;midPoint&#x00A0;+&#x00A0;centerDistance&#x00A0;*&#x00A0;vectRotated;<br /><br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;//&#x00A0;Get&#x00A0;angles&#x00A0;from&#x00A0;center&#x00A0;to&#x00A0;the&#x00A0;two&#x00A0;points<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;double&#x00A0;angle1&#x00A0;=&#x00A0;Math.Atan2(pt1.Y&#x00A0;-&#x00A0;center.Y,&#x00A0;pt1.X&#x00A0;-&#x00A0;center.X);<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;double&#x00A0;angle2&#x00A0;=&#x00A0;Math.Atan2(pt2.Y&#x00A0;-&#x00A0;center.Y,&#x00A0;pt2.X&#x00A0;-&#x00A0;center.X);<br /><br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;//&#x00A0;(another&#x00A0;comparison&#x00A0;of&#x00A0;two&#x00A0;Booleans!)<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;if&#x00A0;(isLargeArc&#x00A0;==&#x00A0;(Math.Abs(angle2&#x00A0;-&#x00A0;angle1)&#x00A0;&lt;&#x00A0;Math.PI))<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;{<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;if&#x00A0;(angle1&#x00A0;&lt;&#x00A0;angle2)<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;angle1&#x00A0;+=&#x00A0;2&#x00A0;*&#x00A0;Math.PI;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;else<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;angle2&#x00A0;+=&#x00A0;2&#x00A0;*&#x00A0;Math.PI;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;}<br /><br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;//&#x00A0;Calculate&#x00A0;number&#x00A0;of&#x00A0;points&#x00A0;for&#x00A0;polyline&#x00A0;approximation<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;int&#x00A0;max&#x00A0;=&#x00A0;(int)((4&#x00A0;*&#x00A0;(radiusX&#x00A0;+&#x00A0;radiusY)&#x00A0;*&#x00A0;Math.Abs(angle2&#x00A0;-&#x00A0;angle1)&#x00A0;/&#x00A0;(2&#x00A0;*&#x00A0;Math.PI))&#x00A0;/&#x00A0;tolerance);<br /><br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;//&#x00A0;Loop&#x00A0;through&#x00A0;the&#x00A0;points<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;for&#x00A0;(int&#x00A0;i&#x00A0;=&#x00A0;0;&#x00A0;i&#x00A0;&lt;=&#x00A0;max;&#x00A0;i++)<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;{<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;double&#x00A0;angle&#x00A0;=&#x00A0;((max&#x00A0;-&#x00A0;i)&#x00A0;*&#x00A0;angle1&#x00A0;+&#x00A0;i&#x00A0;*&#x00A0;angle2)&#x00A0;/&#x00A0;max;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;double&#x00A0;x&#x00A0;=&#x00A0;center.X&#x00A0;+&#x00A0;radiusY&#x00A0;*&#x00A0;Math.Cos(angle);<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;double&#x00A0;y&#x00A0;=&#x00A0;center.Y&#x00A0;+&#x00A0;radiusY&#x00A0;*&#x00A0;Math.Sin(angle);<br /><br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;Point&#x00A0;pt&#x00A0;=&#x00A0;new&#x00A0;Point(x,&#x00A0;y);<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;points.Add(pt);<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;}<br />}<br />  </p>  <p>  Set the <i>tolerance</i> argument to approximately the length of each segment in the polyline approximation. The value of 1 is fine if you're not applying transforms to make the figure much larger.  </p>  <p>  Obviously I simplified this job a lot by assuming a circle rather than an ellipse. However, an ellipse is really just a circle that's been uniformly stretched in one direction. Given a <i>radiusX</i> and <i>radiusY</i> for the ellipse, it's possible to derive a scaling factor that you can apply to <i>pt1</i> and <i>pt2</i> at the beginning of the calculation. At the end of the calculation, you scale the resultant points of the polyline approximation oppositely. Here's an enhanced version of the method (additions in red) that is appropriate for an ellipse:  </p>  <p style='font-family: monospace; font-weight:bold; font-size:smaller; background:#E0E0E0'>  void&#x00A0;FlattenArc(IList&lt;Point&gt;&#x00A0;points,&#x00A0;Point&#x00A0;pt1,&#x00A0;Point&#x00A0;pt2,<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;double&#x00A0;radiusX,&#x00A0;<font color="red">double&#x00A0;radiusY,</font>&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;bool&#x00A0;isLargeArc,&#x00A0;bool&#x00A0;isCounterclockwise,&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;double&#x00A0;tolerance)<br />{<br /><font color="red">&#x00A0;&#x00A0;&#x00A0;&#x00A0;//&#x00A0;Adjust&#x00A0;for&#x00A0;different&#x00A0;radii<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;Matrix&#x00A0;matx&#x00A0;=&#x00A0;new&#x00A0;Matrix();<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;matx.Scale(radiusY&#x00A0;/&#x00A0;radiusX,&#x00A0;1);<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;pt1&#x00A0;=&#x00A0;matx.Transform(pt1);<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;pt2&#x00A0;=&#x00A0;matx.Transform(pt2);<br /></font><br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;//&#x00A0;Get&#x00A0;info&#x00A0;about&#x00A0;chord&#x00A0;that&#x00A0;connects&#x00A0;both&#x00A0;points<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;Point&#x00A0;midPoint&#x00A0;=&#x00A0;new&#x00A0;Point((pt1.X&#x00A0;+&#x00A0;pt2.X)&#x00A0;/&#x00A0;2,&#x00A0;(pt1.Y&#x00A0;+&#x00A0;pt2.Y)&#x00A0;/&#x00A0;2);<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;Vector&#x00A0;vect&#x00A0;=&#x00A0;pt2&#x00A0;-&#x00A0;pt1;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;double&#x00A0;halfChord&#x00A0;=&#x00A0;vect.Length&#x00A0;/&#x00A0;2;<br /><br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;//&#x00A0;Get&#x00A0;vector&#x00A0;from&#x00A0;chord&#x00A0;to&#x00A0;center<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;Vector&#x00A0;vectRotated;<br /><br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;//&#x00A0;(comparing&#x00A0;two&#x00A0;Booleans&#x00A0;here!)<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;if&#x00A0;(isLargeArc&#x00A0;==&#x00A0;isCounterclockwise)<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;vectRotated&#x00A0;=&#x00A0;new&#x00A0;Vector(-vect.Y,&#x00A0;vect.X);<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;else<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;vectRotated&#x00A0;=&#x00A0;new&#x00A0;Vector(vect.Y,&#x00A0;-vect.X);<br /><br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;vectRotated.Normalize();<br /><br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;//&#x00A0;Distance&#x00A0;from&#x00A0;chord&#x00A0;to&#x00A0;center&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;double&#x00A0;centerDistance&#x00A0;=&#x00A0;Math.Sqrt(radiusY&#x00A0;*&#x00A0;radiusY&#x00A0;-&#x00A0;halfChord&#x00A0;*&#x00A0;halfChord);<br /><br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;//&#x00A0;Calculate&#x00A0;center&#x00A0;point<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;Point&#x00A0;center&#x00A0;=&#x00A0;midPoint&#x00A0;+&#x00A0;centerDistance&#x00A0;*&#x00A0;vectRotated;<br /><br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;//&#x00A0;Get&#x00A0;angles&#x00A0;from&#x00A0;center&#x00A0;to&#x00A0;the&#x00A0;two&#x00A0;points<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;double&#x00A0;angle1&#x00A0;=&#x00A0;Math.Atan2(pt1.Y&#x00A0;-&#x00A0;center.Y,&#x00A0;pt1.X&#x00A0;-&#x00A0;center.X);<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;double&#x00A0;angle2&#x00A0;=&#x00A0;Math.Atan2(pt2.Y&#x00A0;-&#x00A0;center.Y,&#x00A0;pt2.X&#x00A0;-&#x00A0;center.X);<br /><br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;//&#x00A0;(another&#x00A0;comparison&#x00A0;of&#x00A0;two&#x00A0;Booleans!)<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;if&#x00A0;(isLargeArc&#x00A0;==&#x00A0;(Math.Abs(angle2&#x00A0;-&#x00A0;angle1)&#x00A0;&lt;&#x00A0;Math.PI))<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;{<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;if&#x00A0;(angle1&#x00A0;&lt;&#x00A0;angle2)<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;angle1&#x00A0;+=&#x00A0;2&#x00A0;*&#x00A0;Math.PI;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;else<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;angle2&#x00A0;+=&#x00A0;2&#x00A0;*&#x00A0;Math.PI;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;}<br /><br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;<font color="red">//&#x00A0;Invert&#x00A0;matrix&#x00A0;for&#x00A0;final&#x00A0;point&#x00A0;calculation<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;matx.Invert();</font><br /><br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;//&#x00A0;Calculate&#x00A0;number&#x00A0;of&#x00A0;points&#x00A0;for&#x00A0;polyline&#x00A0;approximation<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;int&#x00A0;max&#x00A0;=&#x00A0;(int)((4&#x00A0;*&#x00A0;(radiusX&#x00A0;+&#x00A0;radiusY)&#x00A0;*&#x00A0;Math.Abs(angle2&#x00A0;-&#x00A0;angle1)&#x00A0;/&#x00A0;(2&#x00A0;*&#x00A0;Math.PI))&#x00A0;/&#x00A0;tolerance);<br /><br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;//&#x00A0;Loop&#x00A0;through&#x00A0;the&#x00A0;points<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;for&#x00A0;(int&#x00A0;i&#x00A0;=&#x00A0;0;&#x00A0;i&#x00A0;&lt;=&#x00A0;max;&#x00A0;i++)<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;{<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;double&#x00A0;angle&#x00A0;=&#x00A0;((max&#x00A0;-&#x00A0;i)&#x00A0;*&#x00A0;angle1&#x00A0;+&#x00A0;i&#x00A0;*&#x00A0;angle2)&#x00A0;/&#x00A0;max;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;double&#x00A0;x&#x00A0;=&#x00A0;center.X&#x00A0;+&#x00A0;radiusY&#x00A0;*&#x00A0;Math.Cos(angle);<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;double&#x00A0;y&#x00A0;=&#x00A0;center.Y&#x00A0;+&#x00A0;radiusY&#x00A0;*&#x00A0;Math.Sin(angle);<br /><br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;<font color="red">//&#x00A0;Transform&#x00A0;the&#x00A0;point&#x00A0;back<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;Point&#x00A0;pt&#x00A0;=&#x00A0;matx.Transform(new&#x00A0;Point(x,&#x00A0;y));</font><br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;points.Add(pt);<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;}<br />}<br />  </p>  <p>  Why use a <i>Matrix</i> object? Couldn't I just have calculated a scaling factor and performed the scaling explicitly? Certainly, but there's still more work ahead: The <i>ArcSegment</i> class includes a <i>RotationAngle</i> property that indicates the rotation of the ellipse before it is fit to the lines.  Here's an example of four possibilities of <i>ArcSegment</i> with a non-zero <i>RotationAngle</i>:  </p>  <p align="center">  <img src="http://www.charlespetzold.com/blog/2008/01/ArcPossibilities2.png" />  </p>  Again, that's a XAML file from my book:  <p align="center">  <a href="http://www.charlespetzold.com/blog/2008/01/ArcPossibilities2.xaml">ArcPossibilities2.xaml</a>  </p>  <p>  The two axes of the ellipse are no longer parallel to the horizontal and vertical. This seems like an enormously complex monkey wrench to throw into the calculation, but everything has been prepped for the amazing feat of taking account of this rotation angle with the addition of just a single statement:  </p>  <p style='font-family: monospace; font-weight:bold; font-size:smaller; background:#E0E0E0'>  void&#x00A0;FlattenArc(IList&lt;Point&gt;&#x00A0;points,&#x00A0;Point&#x00A0;pt1,&#x00A0;Point&#x00A0;pt2,<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;double&#x00A0;radiusX,&#x00A0;double&#x00A0;radiusY,&#x00A0;<font color="red">double&#x00A0;angleRotation,</font><br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;bool&#x00A0;isLargeArc,&#x00A0;bool&#x00A0;isCounterclockwise,&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;double&#x00A0;tolerance)<br />{<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;//&#x