<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Math-Blog &#187; Applied Math</title>
	<atom:link href="http://math-blog.com/category/applied-math/feed/" rel="self" type="application/rss+xml" />
	<link>http://math-blog.com</link>
	<description>Mathematics is wonderful!</description>
	<lastBuildDate>Fri, 23 Jul 2010 17:30:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>In-Depth Book Review: The Computer as Crucible</title>
		<link>http://math-blog.com/2010/07/23/in-depth-book-review-the-computer-as-crucible/</link>
		<comments>http://math-blog.com/2010/07/23/in-depth-book-review-the-computer-as-crucible/#comments</comments>
		<pubDate>Fri, 23 Jul 2010 17:30:30 +0000</pubDate>
		<dc:creator>Antonio Cangiano</dc:creator>
				<category><![CDATA[Applied Math]]></category>
		<category><![CDATA[Suggested Reading]]></category>
		<category><![CDATA[Unsolved Problems]]></category>

		<guid isPermaLink="false">http://math-blog.com/?p=422</guid>
		<description><![CDATA[Title: The Computer as CrucibleAuthors: Jonathan Borwein and Keith DevlinTrue pp.: 154Publisher: A K Peters LtdPublished on: November 2008ISBN-13: 978-1568813431Rating: 8/10 Jonathan Borwein and Keith Devlin are well-known mathematicians who have a strong appreciation of, and expertise in, experimental mathematics. In this book they provide us with a concise, inviting introduction to the field. The [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://math-blog.com/go/?1568813430"><img src="http://math-blog.com/wp-content/uploads/2010/07/51D-7zyN1kL._SL160_.jpg" style="float: right; border:none;" alt="The Computer as Crucible" title="The Computer as Crucible" /></a><br/>Title: <a href="http://math-blog.com/go/?1568813430"><strong>The Computer as Crucible</strong></a><br/>Authors: <strong>Jonathan Borwein and Keith Devlin</strong><br/>True pp.: <strong>154</strong><br/>Publisher: <strong>A K Peters Ltd</strong><br/>Published on: <strong>November 2008</strong><br/>ISBN-13: <a href="http://math-blog.com/go/?1568813430"><strong>978-1568813431</strong></a><br/>Rating: <strong>8/10</strong></p>
<p><br/></p>
<p>Jonathan Borwein and Keith Devlin are well-known mathematicians who have a strong appreciation of, and expertise in, experimental mathematics. In this book they provide us with a concise, inviting introduction to the field.</p>
<p>The first chapter tries to succinctly explain what experimental mathematics is and why it&#8217;s a fundamental tool for the modern mathematician. The following is their definition: </p>
<blockquote><p>Experimental mathematics is the use of a computer to run computations&mdash;sometimes no more than trial-and-error tests&mdash;to look for patterns, to identify particular numbers and sequences, to gather evidence in support of specific mathematical assertions that may themselves arise by computational means, including search. Like contemporary chemists&mdash;and before them the alchemists of old&mdash;who mix various substances together in a crucible and heat them to a high temperature to see what happens, today&#8217;s experimental mathematician puts a hopefully potent mix of numbers, formulas, and algorithms into a computer in the hope that something of interest emerges.</p></blockquote>
<p>They immediately address some of the possible objections and illustrate how an approach that doesn&#8217;t focus on formal proof, but rather on exploration and experimentation, ultimately leads to hypotheses which can then be, in many cases, proved analytically. The authors argue that in this sense, thanks to the aid of advanced computers, mathematics is becoming more and more similar to other natural sciences.</p>
<p>They also make a case for how great mathematicians like Euler, Gauss, and  Reimann were doing experimental mathematics well before calculators where available. Their calculations on paper were far more limited than what computers afford us these days, yet they served them well when it came to sharpening and verifying their intuitions.</p>
<p>The rest of the book is a continuous series of examples that show the advantages of this approach in practice. The examples are highly interesting (some of them stunning) and tend to focus on calculus, analysis and analytical number theory.</p>
<p>Each chapter is accompanied by a section called &#8220;Explorations&#8221;. I found this section to be particularly valuable. Within it you&#8217;ll find exercises, and further examples and considerations. The answers/solutions to the actual problems are provided in the second to last chapter, just before the brief epilogue.</p>
<p>Chapter 2 discusses how to calculate an arbitrary digit for irrational numbers like <img src='http://math-blog.com/wp-content/latex/pictures/4f08e3dba63dc6d40b22952c7a9dac6d.png' title='\pi' alt='\pi' align=absmiddle>, in certain bases. They illustrate how the so called BBP Formula (Bailey-Borwein-Plouffe formula, co-discovered by Jonathan Borwein’s brother) came to be.</p>
<p align="center"><img src='http://math-blog.com/wp-content/latex/pictures/c3215938e656e6632c4a423edbe62067.png' title='\displaystyle \pi = \sum_{k=0}^\infty\frac{1}{16^k}\left (\frac{4}{8k+1}-\frac{2}{8k+4}-\frac{1}{8k+5}-\frac{1}{8k+6}\right )' alt='\displaystyle \pi = \sum_{k=0}^\infty\frac{1}{16^k}\left (\frac{4}{8k+1}-\frac{2}{8k+4}-\frac{1}{8k+5}-\frac{1}{8k+6}\right )' align=absmiddle></p>
<p>The use of a program which implements the PSQL integer relation algorithm in high-precision, floating-point arithmetic was key to its discovery. The BBP Formula in turn allowed the calculation of the quadrillionth binary digit of <img src='http://math-blog.com/wp-content/latex/pictures/4f08e3dba63dc6d40b22952c7a9dac6d.png' title='\pi' alt='\pi' align=absmiddle> back in 2000.</p>
<p>Chapter 3 focuses on identifying numbers, digits patterns, and sequences once you obtain a numeric result through your calculations and experimentation. They introduce the subject with relatively obvious values like the approximations of <img src='http://math-blog.com/wp-content/latex/pictures/68c93af2e35601165b9bd16182915d6d.png' title='e-2' alt='e-2' align=absmiddle> or <img src='http://math-blog.com/wp-content/latex/pictures/c724586fc4ef6bd0cc825c78c142b592.png' title='\pi +e /2' alt='\pi +e /2' align=absmiddle>, but the chapter quickly escalates to an example where a closed form for a seemingly random sequence needs to be found.</p>
<p>Chapter 4 analyzes the Reimann Zeta function from the eyes of an experimental mathematician, and shows us what kind of insight we can gain from this unique perspective.</p>
<p>In chapter 5 we learn how by numerically evaluating definite integrals, it is sometimes possible to identify the resulting value which will help us to analytically resolve those particular integrals. The examples presented in this chapter originate for the most part from physics and are very challenging if attempted without the aid of experimental methods. To better grasp the kind of integrals discussed in this chapter, here is an example:</p>
<p align="center"><img src='http://math-blog.com/wp-content/latex/pictures/996319d422ae9a4523cf33fed829058b.png' title='\displaystyle C = \int_{0}^{\infty} \int_{y}^{\infty}\frac{(x-2)^2\log{((x+y)/(x-y))}}{x y sinh(x+y)} {\mathrm{d} x}{\mathrm{d} y}' alt='\displaystyle C = \int_{0}^{\infty} \int_{y}^{\infty}\frac{(x-2)^2\log{((x+y)/(x-y))}}{x y sinh(x+y)} {\mathrm{d} x}{\mathrm{d} y}' align=absmiddle></p>
<p>The explorations section provides a few more interesting integrals, including some for which a closed form is not known. The authors even include an integral that intentionally stumps Mathematica 6 and Maple 11.</p>
<p>Chapter 6 is dedicated to serendipitous discoveries (&#8220;proof by serendipity&#8221;) with a few interesting examples of how &#8220;luck&#8221; met preparation, ultimately enriching the body of mathematical knowledge almost by chance.</p>
<p>In chapter 7 the authors go back to talk about <img src='http://math-blog.com/wp-content/latex/pictures/4f08e3dba63dc6d40b22952c7a9dac6d.png' title='\pi' alt='\pi' align=absmiddle>, this time in base 10, to calculate its digits with efficient, fast converging formulas and methods. The chapter wraps up with a discussion about the normality of <img src='http://math-blog.com/wp-content/latex/pictures/4f08e3dba63dc6d40b22952c7a9dac6d.png' title='\pi' alt='\pi' align=absmiddle>, which hasn&#8217;t been proved of course, but appears to be empirically supported by the statistical analysis of the first trillion digits. In the explorations section there is a nice discussion about the implementation of fast arithmetic through the Karatsuba multiplication, and the subject of Montecarlo simulations (a very inefficient method of calculating <img src='http://math-blog.com/wp-content/latex/pictures/4f08e3dba63dc6d40b22952c7a9dac6d.png' title='\pi' alt='\pi' align=absmiddle>, but a great way to show the idea behind Montecarlo simulations).</p>
<p>Chapter 8 has a bold title, &#8220;The computer knows more math than you do&#8221;. This provocative title is quickly diminished to put it in context though. The authors start by approaching a tough problem posed by Donald Knuth (of TeX and <a href="http://math-blog.com/go/?0201485419">The Art of Computer Programming</a> fame) to the readers of the American Mathematical Monthly:</p>
<p align="center"><img src='http://math-blog.com/wp-content/latex/pictures/386b738d308d0589ec1ce4873aeb32e8.png' title='\displaystyle S = \sum_{k=1}^{\infty} \left ( \frac{k^k}{k!e^k}-\frac{1}{\sqrt{2\pi k}} \right )' alt='\displaystyle S = \sum_{k=1}^{\infty} \left ( \frac{k^k}{k!e^k}-\frac{1}{\sqrt{2\pi k}} \right )' align=absmiddle></p>
<p>In an attempt to solve this the authors invite us to go on a journey involving the Lambert W function, the Pochhammer function, and Abel&#8217;s limit theorem. The rest of the chapter illustrates another difficult problem whose solution obtained through the aid of Maple has important implications not only for mathematics, but also for quantum field theory and statistical mechanics.</p>
<p>In chapter 9 a few infinite series are calculated in order to show how CAS systems and experimental methodology can still be useful when dealing with problems that involve infinite sequences, series, and products.</p>
<p>Chapter 10 is dedicated to the limits and the dangers of this approach. Several examples showcase how one can be misled into making assumptions, and how to avoid this from happening. The ad hoc example below is correct to over half a billion digits:</p>
<p align="center"><img src='http://math-blog.com/wp-content/latex/pictures/b8f771c8f5f2234b5f195b3d6ce37911.png' title='\displaystyle \sum_{n=1}^{\infty} \frac{\left \lfloor ne^{\pi\sqrt{163}/3} \right \rfloor}{2^n} = 1280640' alt='\displaystyle \sum_{n=1}^{\infty} \frac{\left \lfloor ne^{\pi\sqrt{163}/3} \right \rfloor}{2^n} = 1280640' align=absmiddle></p>
<p>After having calculated a few hundred digits, it would be natural to assume that the series converges to a natural number, when in reality it&#8217;s an irrational and transcendental number.</p>
<p>In chapter 11, conscious of the selective focus on analysis and analytical number theory throughout the book, Borwein and Devlin introduce other examples such as a topology problem whose proof was reached thanks to a deeper insight gained through computer visualization of a surface, a knot theory problem, the Four Color Theorem, the Robbins Conjecture, the computation of <img src='http://math-blog.com/wp-content/latex/pictures/7407ab734767f138cb335153db720052.png' title='E_{8}' alt='E_{8}' align=absmiddle>, and so on.</p>
<p>In truth, I feel that such a thin book could have used more examples like the ones in chapter 11, in order to make a stronger case for the applicability of experimental mathematics to areas outside of analysis.</p>
<p>The book is well written and the tone is never heavy, despite the advanced mathematical examples within it. The authors include historical background and anecdotes which makes for a more interesting read and provides a human perspective behind the formulas presented. The (at times) funny illustrations and occasional jokes are definitely a pleasant addition.</p>
<p>This book is relatively tool agnostic; Maple and Mathematica are referenced throughout, and so are a few online tools to identify number sequences and known numeric values. Overall though, the emphasis in on the methodology rather than a particular CAS (Computer Algebra System) or programming language. In fact, with the exception of a snippet of Maple code in one of the explorations in the first chapter, the book describe the examples from a mathematical and algorithmic standpoint. You won&#8217;t find source code for the examples illustrated.</p>
<p>The ideal target audience for The Computer as Crucible is graduate students and researchers. A bright, motivated high-school student will get the gist of this book, but a more mature mathematical audience will actually be able to follow the steps within the examples and fully appreciate the insight on how an experimental approach can aid their research.</p>
<p>Despite the numerous examples employed to make their case, the authors start the book by explaining that it is not intended to be comprehensive. It&#8217;s meant to be thought provoking and to whet your appetite as to what is now possible in mathematical research thanks to computers.</p>
<p>As a computer programmer who’s passionate about mathematics, experimental mathematics fascinates me greatly. As such, I hope to work my way through the actual textbooks that are generally suggested as a follow up to this book. Namely, I’ve already started reading <a href="http://math-blog.com/go/?1568814429">Mathematics by Experiment: Plausible Reasoning in the 21st Century (Second Edition)</a>, which is co-authored by Jonathan Borwein himself. Other textbooks referenced in this introduction are <a href="http://math-blog.com/go/?156881271X">Experimental Mathematics in Action</a> and <a href="http://math-blog.com/go/?1568811365">Experimentation in Mathematics: Computational Paths to Discovery</a>.</p>
<p>In conclusion, <a href="http://math-blog.com/go/?1568813430">The Computer as Crucible</a> is a lovely little book which builds a strong case for experimental mathematics. Any practicing mathematician or serious amateur should consider checking out this introduction to a topic that will no doubt transform mathematics.</p>
<p><em>Full disclosure: We received this book for free from the publisher, but we&#8217;re under no obligation to review or endorse it. We routinely receive a fair number of books from several publishers that never make the cut for an actual review. The links have our Amazon referral id which gives us a tiny percentage if you buy a book. In turn this helps support this site.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://math-blog.com/2010/07/23/in-depth-book-review-the-computer-as-crucible/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Kepler&#8217;s New Astronomy</title>
		<link>http://math-blog.com/2009/12/17/keplers-new-astronomy/</link>
		<comments>http://math-blog.com/2009/12/17/keplers-new-astronomy/#comments</comments>
		<pubDate>Thu, 17 Dec 2009 19:36:44 +0000</pubDate>
		<dc:creator>John F. McGowan, Ph.D.</dc:creator>
				<category><![CDATA[Applied Math]]></category>
		<category><![CDATA[History]]></category>

		<guid isPermaLink="false">http://math-blog.com/?p=325</guid>
		<description><![CDATA[This year (2009) is the 400th anniversary of the publication of Johannes Kepler&#8217;s book New Astronomy (Astronomia Nova) announcing the discovery of the elliptical orbit of Mars to the world. The discovery of the elliptical orbit of Mars and the mathematical rule of motion for Mars on its elliptical orbit by Johannes Kepler in 1605 [...]]]></description>
			<content:encoded><![CDATA[<p>This year (2009) is the 400th anniversary of the publication of Johannes Kepler&#8217;s book New Astronomy (Astronomia Nova) announcing the discovery of the elliptical orbit of Mars to the world.  The discovery of the elliptical orbit of Mars and the mathematical rule of motion for Mars on its elliptical orbit by Johannes Kepler in 1605 is one of the most important advances in astronomy, physics, and science.  This discovery transformed the unproven heliocentric theory of Copernicus into a rigorous predictive theory that outperformed the traditional geocentric theory of Claudius Ptolemy and his successors.  The discovery paved the way for Newton&#8217;s theory of gravitation.  It remains one of a small number of cases where a simple mathematical rule for seemingly complex and confusing data has been found.  In many respects, the discovery of the elliptical orbit of Mars and other planets is more important than the better known work of Kepler&#8217;s contemporary Galileo.  In honor of Kepler, NASA has named its recent mission to look for extra-solar planets, especially possible other Earths that might support life or even intelligence, the Kepler mission.</p>
<p>In Kepler&#8217;s time the reigning Ptolemaic theory could predict the position of Mars to within a few degrees, usually less than a one percent error.  How important is such a small error?  Space missions routinely depend on modern orbital dynamics, a lineal descendant of Kepler&#8217;s work, to make far more accurate calculations to succeed.  The Mars Climate Orbiter mission in 1999 failed due to a tiny error.  After traveling about 300 million miles, the Mars Climate Orbiter came in about 90 miles, a tiny fraction of 300 million miles, too low, burning up in the Martian atmosphere rather than aerobreaking successfully into orbit.  Successful space missions, the Global Positioning System (GPS), and other modern applications depend on precision mathematical models similar to and sometimes directly descended from Kepler&#8217;s model of the orbit of Mars.  </p>
<p>Kepler&#8217;s story is very different from the story of Galileo and it offers different lessons for today.  Diverse fields ranging from astronomy and space physics to artificial intelligence are confronted with similarly complex and confusing data.  A mathematical solution to an outstanding problem comparable to Kepler&#8217;s discovery could reveal long suspected connections between gravity and other forces, perhaps enabling new power or propulsion systems, enable computers to recognize objects and spoken words, or solve other problems.  This article will discuss the discovery of the elliptical orbit of Mars in the context of Kepler&#8217;s time.  It will also draw some lessons from Kepler and compare and contrast Kepler&#8217;s process of discovery to modern astronomy, physics, space science and engineering, including a detailed discussion of dark matter and dark energy.</p>
<p>Read the rest of <a href="http://www.scribd.com/doc/24237641/Kepler-s-New-Astronomy">Kepler&#8217;s New Astronomy</a> on Scribd, where you’ll be able to download it in several formats including PDF, or click Fullscreen in the embedded document below.</p>
<p><strong>PDF</strong>: <a href="http://math-blog.com/wp-content/uploads/2009/12/Keplers-New-Astronomy.pdf">Kepler&#8217;s New Astronomy.pdf</a></p>
<p align="center"><object codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" id="doc_481481057687922" name="doc_481481057687922" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" align="middle"	height="650" width="500" ><param name="movie"	value="http://d1.scribdassets.com/ScribdViewer.swf?document_id=24237641&#038;access_key=key-2es88j3k4cbavrsdmqp2&#038;page=1&#038;version=1&#038;viewMode=list"><param name="quality" value="high"><param name="play" value="true"><param name="loop" value="true"><param name="scale" value="showall"><param name="wmode" value="opaque"><param name="devicefont" value="false"><param name="bgcolor" value="#ffffff"><param name="menu" value="true"><param name="allowFullScreen" value="true"><param name="allowScriptAccess" value="always"><param name="salign" value=""><param name="mode" value="list"><embed src="http://d1.scribdassets.com/ScribdViewer.swf?document_id=24237641&#038;access_key=key-2es88j3k4cbavrsdmqp2&#038;page=1&#038;version=1&#038;viewMode=list" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" play="true" loop="true" scale="showall" wmode="opaque" devicefont="false" bgcolor="#ffffff" name="doc_481481057687922_object" menu="true" allowfullscreen="true" allowscriptaccess="always" salign="" type="application/x-shockwave-flash" align="middle" mode="list" height="650" width="500"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://math-blog.com/2009/12/17/keplers-new-astronomy/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Faster, Better, Cheaper Search Engines</title>
		<link>http://math-blog.com/2009/10/25/faster-better-cheaper-search-engines/</link>
		<comments>http://math-blog.com/2009/10/25/faster-better-cheaper-search-engines/#comments</comments>
		<pubDate>Sun, 25 Oct 2009 19:29:52 +0000</pubDate>
		<dc:creator>John F. McGowan, Ph.D.</dc:creator>
				<category><![CDATA[Applied Math]]></category>

		<guid isPermaLink="false">http://math-blog.com/?p=321</guid>
		<description><![CDATA[Searching for documents and other items on the Web or computers is often tedious and time consuming. Time is money. Highly paid professionals spend hours, days, and even longer searching for information on the Web or computers. Most search today is done using key word and phrase matching, often combined with various ranking schemes for [...]]]></description>
			<content:encoded><![CDATA[<p>Searching for documents and other items on the Web or computers is often tedious and time consuming.  Time is money.  Highly paid professionals spend hours, days, and even longer searching for information on the Web or computers.  Most search today is done using key word and phrase matching, often combined with various ranking schemes for the search results.  Occasionally more advanced methods such as logical queries, e.g. search for &#8220;rocket scientist&#8221; and NOT &#8220;space&#8221;, and regular expressions are used. All of these methods have significant limitations and often require lengthy human review and further manual searching of the search results.</p>
<p>The dream search engine would search by topic, by the detailed content of the items searched, ideally finding the desired information immediately.  Actual understanding of text remains a unfulfilled promise of artificial intelligence.  Statistical language processing can achieve a degree of searching by topic.  This article introduces the basic concepts and mathematics of statistical language processing and its applications to search.  It gives a brief introduction and overview of more advanced techniques in statistical language processing as applied to search.  It also includes sample Ruby code illustrating some simple statistical language processing methods.</p>
<p>Read the rest of <a title="View Faster, Better, Cheaper Search Engines on Scribd" href="http://www.scribd.com/doc/21611060/Faster-Better-Cheaper-Search-Engines">Faster, Better, Cheaper Search Engines</a> on Scribd, where you&#8217;ll be able to download it in several formats including PDF, or click Fullscreen in the embedded document below.</p>
<p><strong>Source code</strong>: <a href="http://math-blog.com/wp-content/uploads/2009/10/trigram.zip">trigram.zip</a></p>
<p><strong>PDF</strong>: <a href='http://math-blog.com/wp-content/uploads/2009/10/Faster-Better-Cheaper-Search-Engines.pdf'>Faster-Better-Cheaper-Search-Engines.pdf</a></p>
<p align="center"><object codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" id="doc_883741955071951" name="doc_883741955071951" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" align="middle"	height="500" width="450" ><param name="movie"	value="http://d1.scribdassets.com/ScribdViewer.swf?document_id=21611060&#038;access_key=key-22tm1zu0lmmfqdr02gpm&#038;page=1&#038;version=1&#038;viewMode=list"><param name="quality" value="high"><param name="play" value="true"><param name="loop" value="true"><param name="scale" value="showall"><param name="wmode" value="opaque"><param name="devicefont" value="false"><param name="bgcolor" value="#ffffff"><param name="menu" value="true"><param name="allowFullScreen" value="true"><param name="allowScriptAccess" value="always"><param name="salign" value=""><param name="mode" value="list"><embed src="http://d1.scribdassets.com/ScribdViewer.swf?document_id=21611060&#038;access_key=key-22tm1zu0lmmfqdr02gpm&#038;page=1&#038;version=1&#038;viewMode=list" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" play="true" loop="true" scale="showall" wmode="opaque" devicefont="false" bgcolor="#ffffff" name="doc_883741955071951_object" menu="true" allowfullscreen="true" allowscriptaccess="always" salign="" type="application/x-shockwave-flash" align="middle" mode="list" height="500" width="450"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://math-blog.com/2009/10/25/faster-better-cheaper-search-engines/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Improve your math and programming skills with Project Euler</title>
		<link>http://math-blog.com/2009/08/19/improve-your-math-and-programming-skills-with-project-euler/</link>
		<comments>http://math-blog.com/2009/08/19/improve-your-math-and-programming-skills-with-project-euler/#comments</comments>
		<pubDate>Wed, 19 Aug 2009 05:11:06 +0000</pubDate>
		<dc:creator>Antonio Cangiano</dc:creator>
				<category><![CDATA[Applied Math]]></category>
		<category><![CDATA[Math Websites]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://math-blog.com/?p=312</guid>
		<description><![CDATA[Project Euler can be an addictive site for people who are passionate about mathematics and programming. You don&#8217;t need to be an expert in either of these two disciplines to participate in it&#8217;s challenges, but any such skills you may already possess will be an asset. The author of the site, describes the project as [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://projecteuler.net/">Project Euler</a> can be an addictive site for people who are passionate about mathematics and programming. You don&#8217;t need to be an expert in either of these two disciplines to participate in it&#8217;s challenges, but any such skills you may already possess will be an asset.</p>
<p>The author of the site, describes the project as follows:</p>
<blockquote>
<p>Project Euler is a series of challenging mathematical/computer programming problems that will require more than just mathematical insights to solve. Although mathematics will help you arrive at elegant and efficient methods, the use of a computer and programming skills will be required to solve most problems.</p>
</blockquote>
<p>When you first register, you will be presented with 252 problems available to be solved. This number changes frequently, however, as new problems are routinely created and added to the list. The solutions to some problems veer towards the obvious, while others require advanced mathematics to tackle. Likewise, a few can be solved with paper and pencil and a good dose of insight. Most however, will require the aid of a computer program written in the language of your choice.</p>
<p align="center"><img src="http://math-blog.com/wp-content/uploads/2009/08/euler-problem.gif" alt="A Project Euler problem" title="A sample problem" /><br /><small>A sample problem (187)</small></p>
<p>Each program you execute should output your result within a minute. That&#8217;s part of the challenge, even though there is no way for the site to enforce this rule.</p>
<p>When you think you&#8217;ve found the correct result for a given problem, you can fill in the result field for the problem, and see if you got it right. If you have, your answer will be added to the list of problems you solved and will count towards your overall score, while bumping up your position on the participant scoreboards. There are several scoreboards, depending on what level you are at, which in turn is determined by the number of problems you have solved so far.</p>
<p>More importantly, solving a problem will gain you access to the respective forum (for that problem), where you&#8217;ll be able to see solutions and discussions from other participants, who may have used different languages and solution strategies.</p>
<p>Project Euler is appealing for a variety of reasons. In particular:</p>
<ul>
<li>It allows you to explore areas of math that you might not be familiar with. Solving certain problems may require you do a fair amount of research and in turn help you to learn more about certain branches of mathematics;</li>
<li>If you are a math major who is trying to hone their programming skills, you&#8217;ll find Project Euler to be challenging, fun, and an excellent opportunity for improvement. Having to implement several small programs and being able to compare your style with those of other people in the forum, will definitely end up improving your knowledge of many algorithms and your skills as a programmer;</li>
<li>The site&#8217;s one minute rule has an important consequence. The computational complexity of your programs really ends up mattering. While some simple problems can in fact be brute forced, the majority of them require you to write faster algorithms and take advantage of mathematical insight so as to improve the performance of your program. For certain problems a naive approach  would take more than a lifetime on current PCs;</li>
<li>Finally, if you are a programmer who&#8217;s scoping out a new programming language, be it Python, Ruby, Scala, Haskell or Erlang, you&#8217;ll find a great ally in Project Euler. Having to write hundreds of programs in a given language, will naturally increase your familiarity with that language. And again, comparing your newcomer coding style with those of more experience participants, will no doubt contribute to your advancement within the given language you&#8217;re focusing on.</li>
</ul>
<p>Project Euler truly deserves five stars. I recommend it highly to anyone who is unafraid of writing a few lines of code in order to solve interesting math problems.</p>
]]></content:encoded>
			<wfw:commentRss>http://math-blog.com/2009/08/19/improve-your-math-and-programming-skills-with-project-euler/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Complex Algorithm Research and Development: Harder Than Many Think</title>
		<link>http://math-blog.com/2009/07/20/complex-algorithm-research-and-development-harder-than-many-think/</link>
		<comments>http://math-blog.com/2009/07/20/complex-algorithm-research-and-development-harder-than-many-think/#comments</comments>
		<pubDate>Mon, 20 Jul 2009 17:57:31 +0000</pubDate>
		<dc:creator>John F. McGowan, Ph.D.</dc:creator>
				<category><![CDATA[Applied Math]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://math-blog.com/?p=193</guid>
		<description><![CDATA[An algorithm is a procedure or formula for solving a problem. For the purposes of this article, a complex algorithm is defined as an algorithm that embodies advanced mathematical or logical methods and requires at least one thousand (1000) lines of the C/C++ programming language to implement. The term C/C++ is used intentionally to reflect [...]]]></description>
			<content:encoded><![CDATA[<p>An algorithm is a procedure or formula for solving a problem. For the purposes of this article, a complex algorithm is defined as an algorithm that embodies advanced mathematical or logical methods and requires at least one thousand (1000) lines of the C/C++ programming language to implement. The term C/C++ is used intentionally to reflect the reality that object-oriented methods are of limited use in complex algorithms, although the algorithms are often packaged inside an “object” for easy integration into applications.</p>
<p>Complex algorithms are typically implemented as either computer software or in custom <span class="caps">VLSI</span> chips (e.g. Application Specific Integrated Circuits or ASICs). Research and development of complex algorithms is a specialized area and differs in a number of ways from most software and hardware development. Remarkably, many computer software business and engineering professionals often underestimate or do not understand the difficulties and scope of complex algorithm projects.</p>
<p>Complex algorithms are already in widespread use in commercial applications. Prominent examples include the video compression algorithms that enable BluRay, <span class="caps">DVD</span> Video, YouTube, and many other modern digital video systems. The <span class="caps">US DVD</span> Video market is around $25 billion per year (2007). Although limited, speech recognition such as now frequently encountered in telephone help and customer service systems is another example. Other examples include encryption, seismic modeling used in oil and gas exploration, sophisticated financial models, traffic models, and many others.</p>
<p>Complex algorithms may solve a range of major problems confronting the human race including major diseases such as cancer, the need for more and cheaper energy, and so forth. Molecular modeling may enable the design of drugs or systems of drugs that can selectively target and destroy cancer cells based on the identifying characteristics of cancer cells such as chromosomal anomalies, something currently impossible. Electromagnetic modeling software may enable the successful design and fabrication of working commercial fusion power sources. These are potential trillion-dollar markets. The global annual energy market is over $1 Trillion.</p>
<p><strong>Note:</strong> Since I am a software developer, I will focus primarily on complex algorithms developed and implemented as computer software. Many of my comments apply equally well to hardware implementation. Where I have some knowledge and experience, I will make some comments on specific hardware issues.</p>
<p><strong>Complex Algorithms Are Difficult</strong></p>
<p>Complex algorithms are usually quite difficult to develop and often take longer than experience with other software projects would indicate. Although there are exceptions, complex algorithm projects usually take between four (4) months and several years. True research projects in which new mathematical or logical methods are developed are extremely unpredictable and typically take years. Most major scientific discoveries and inventions have taken at least five (5) years.</p>
<p>Complex algorithms frequently involve a tight coupling between different parts of the algorithm. All parts must work together within tight tolerances for the entire algorithm to work. This is similar to mechanical systems such as automobile engines or mechanical clocks. Indeed, implementations of complex algorithms are often referred to as “engines”, partly for this reason. Complex algorithms are often very unforgiving. Even very small errors, getting a single bit wrong, results in the implementation failing. This occurs frequently with encryption where usually every bit must be correct and video compression where even small errors often result in unacceptable “artifacts” in the decoded video. In practical terms, this means that the amount of time spent per line of working code is often significantly larger for complex algorithm projects than other software projects such as web sites, user interfaces, database reporting systems, and so forth.</p>
<p>Most commercial software projects involve at most mathematics taught in early high school (9th, 10th grade) in the US. Even advanced high school mathematics such as the solution to quadratic equations is uncommon outside of computer graphics. Complex algorithms in widespread use today typically involve mathematics that is taught in the first and second year of college at a good college or university in the US. A few complex algorithms involve more advanced mathematics. For example, the Global Positioning System (GPS) uses General Relativity, advanced undergraduate or graduate level mathematics, to determine the location and time correctly. In the future, more advanced mathematics may be needed for pattern recognition and other advanced tasks. Most commercial software developers do not have much experience with mathematical software at the level found in complex algorithms. Research and development of complex algorithms often requires a range of mathematical and logical skills that are not common.</p>
<p><strong>Return on Investment</strong></p>
<p>The return on investment for a successful complex algorithm project can be very high. Complex algorithm research and development is typically done by small teams or individuals. Small teams are the most common. Even a multi-year project, for example five years, with a ten person team (a large team) has a total cost of about $7.5 million (using a total cost per full time employee of $150K/year). A home run can solve a billion dollar or larger problem, bringing in hundreds of millions or even billions of dollars.</p>
<ul>
<li> Return = $100 M / $7.5 M = 13.3 (small home run)</li>
<li> Return = $1 B / $7.5 M = 133 (big home run)</li>
<li> Return = $1 T / $7.5 M = 133,000 (off the charts)</li>
</ul>
<p>The greatest opportunities and the greatest risks lie in areas that require development of new mathematical or logical methods; that is true research. New complex algorithms can be converted very rapidly to commercial software products, even in a matter of months, as happened with new video compression algorithms in 2003.</p>
<p><strong>Research and Development</strong></p>
<p>The commercial software industry focuses overwhelmingly on “technically feasible” projects. Many venture capital firms explicitly claim to only invest in proven, technically feasible projects. Similar thinking pervades the commercial software industry. Where complex algorithms are concerned, technically feasible means proven algorithms for which working prototypes exist somewhere. The working prototypes are usually computer programs, often slow, that successfully implement the algorithm. These are frequently prototypes in the C or C++ programming languages, although Java is becoming more common (see the discussion of software engineering below). Thus, most commercial projects in the complex algorithms arena involve such tasks as porting algorithms to a different platform (for example, Unix to Windows), optimizing the algorithms for a new platform, integrating the algorithms into an application program such as a media player, converting a prototype into a production system, and so forth. Most research scientists would call these activities “Development” and not “Research” or “Research and Development”.</p>
<p>The commercial software industry follows a widely accepted rule to avoid projects that are not technically feasible, meaning true research projects. Nonetheless, the rhetoric of the commercial software industry, both aimed at unsophisticated investors and customers is the opposite. Terms like research, science, and research and development are used routinely to describe commercial software development activities. Many companies make statements that either explicitly claim or imply that the company has a large R&#38;D group engaged in true research. Note that rhetoric aimed at sophisticated investors such as venture capitalists is often the opposite, which can be quite confusing.</p>
<p>Historically, the commercial software industry has relied heavily on government sponsored research programs such as the Defense Advanced Research Projects Agency (DARPA) and the National Aeronautics and Space Administration (NASA) for the true research in software. Many types of software and specific software products can be traced back to government sponsored research programs. Some well known examples include the Internet, originally a <span class="caps">DARPA</span> project, and the World Wide Web, which grew out of research projects at <span class="caps">CERN</span> and <span class="caps">NCSA</span>. Many other examples exist. Essentially all speech recognition software is derived from research sponsored by <span class="caps">DARPA</span>, especially projects at Carnegie-Mellon University. Nonetheless, industry rhetoric often invokes the image of private inventors in garages, the Wright brothers, and similar images of “free enterprise” and individual initiative. Typically, the putative inventor such as Tim Berners-Lee or Marc Andreessen is emphasized and the relevant government research program ignored or downplayed. Often there is little or no progress in commercial software if the relevant government research program is unable to make progress. This is most evident in pattern recognition and artificial intelligence, where progress has been very slow or non-existent.</p>
<p>Many government research programs are afflicted by a single “right way” that is pursued to the exclusion of all others. If this right way is good, then there is steady progress in the associated commercial software field. <span class="caps">DARPA</span> in particular relies upon periodic contests pitting different methods against one another. This has repeatedly resulted in a single approach that showed early promise taking over a field. A contest of this type during the 1970’s resulted in the so-called Hidden Markov Model (HMM) based speech recognition approach replacing essentially all speech recognition research on a global scale. Essentially all major speech recognition research groups, many directly funded by <span class="caps">DARPA</span>, pursue some variant of the <span class="caps">HMM</span> algorithm. Yet the performance of the <span class="caps">HMM</span> algorithm continues to be quite limited after 30+ years.</p>
<p>Most major commercial opportunities in complex algorithms require a company to fund and undertake genuine research, a difficult task that few companies understand. Artificial intelligence, speech recognition, cures for major diseases such as cancer or working fusion energy sources require substantial research.</p>
<p><strong>Evaluating Technical Feasibility</strong></p>
<p>In complex algorithms, technical feasibility generally means that a working prototype of the complex algorithm exists. In practice, working prototypes are often implemented in computer programming languages such as <span class="caps">ANSI C</span>, C++, or Java. Special algorithm research and development tools such as Matlab and Mathematica are also used. The working prototype may be slow, inefficient, or have other limitations, but it is or should be a proof of concept.</p>
<p>Seemingly, it should be easy to evaluate technical feasibility. Simply acquire and test the working prototype. Nonetheless, there is a long history of ostensibly sophisticated organizations and investors investing in complex algorithm projects that are not technically feasible, often apparently in the belief that the relevant problem had been solved. This has happened repeatedly with pattern recognition and artificial intelligence. It has also happened with various data compression algorithms.</p>
<p>For some reason, some organizations and investors do not even acquire and test the working prototypes. This is absolutely essential. It is often said that one should invest in people, not in ideas. Venture capitalists and other sophisticated investors often quote this platitude. However, the history of complex algorithms is filled with companies and projects with officers, directors, managers, chief scientists, and so forth with gold-plated resumes, impressive credentials, top degrees from top universities, and so forth that have flopped. The bottom line in complex algorithms is that the ideas count. If the complex algorithm doesn’t work, it doesn’t work. The company or project will fail for purely technical reasons. This is the lesson, for example, of the Pen Computing fad of the early 1990’s, GO, and Lernout and Hauspie (see below). This is also one of the lessons of the complex financial models involved in the current global financial crisis (2008). Due diligence requires a thorough, well-considered independent test and evaluation of the working prototype.</p>
<p>It can be difficult to evaluate technology demonstrations of complex algorithms. Often there are subtle and not so subtle ways to manipulate a technology demonstration. For example, in the early days (1995) of <span class="caps">MPEG</span> digital video on personal computers, <span class="caps">MPEG</span> software video player companies gave technology demonstrations on high-end personal computers with high-end video acceleration graphics cards. In pattern recognition, many present-day (2008) pattern recognition algorithms can achieve recognition rates in the range of 80-95% at least under certain controlled conditions. This seems high. In schools, 80-95% is usually a B or an A, a good grade. However, practical real-world pattern recognition often requires a recognition rate of 98 or 99% or even better under field conditions. In both examples, the technology demonstration can be misleading without demonstrably false statements.</p>
<p>Actual fraud can be difficult to detect and difficult to prove. It is important to conduct tests and evaluations of working prototypes independent of the purveyor or other interested parties who may have a reason to perpetrate a fraud. Complex algorithms can involve the potential for very large returns on investment&#8212;as noted above. Consequently, there is considerable motivation for fraud in some cases.</p>
<p><strong>How Does Research Differ from Development?</strong></p>
<p>Commercial software development is usually unpredictable. Software projects frequently involve unexpected problems and usually take substantially longer than planned. Nonetheless, technically feasible commercial software development projects are more predictable than true research projects. Often if one takes a conservative cost and schedule estimate and multiplies this by a factor of three to four, one gets the actual cost and schedule of the project. A common joke with a great deal of truth is: to get the real schedule multiply the official schedule by PI (3.14) for running around in a circle. Because the project is technically feasible it can certainly be completed. Massive cost and schedule overruns (such as factors of ten) can usually be explained by incompetence or severe political problems. True research is extremely unpredictable. Many true research projects simply fail. The researchers are unable to find the solution. For example, to date (2008), essentially all attempts to decipher human speech have failed in close to a century of attempts. Substantial research efforts at Bell Labs, <span class="caps">MIT</span>, and other institutions have failed to determine why certain sound spectra correspond to the different sounds in English and other languages. Even in successful research, estimates are often way off. For example, the mathematician Johannes Kepler made a bet in 1600 that he could determine the orbit of Mars in eight (8) days. His discovery of the elliptical orbit of Mars and other planets, one of the most important and difficult discoveries in scientific history, took five frustrating years in which every attempt to solve the problem failed until he found the answer in just a few days in 1605. This process in which long periods of little or no progress are punctuated by sudden unpredictable leaps forward is typical of true research, especially major scientific discoveries or technological inventions.</p>
<p>True research, especially major scientific discoveries or inventions, usually involves a very large amount of trial and error. Often, after many failures, there is a leap or leaps in which a new approach or concept is tried which unexpectedly solves the problem. Most major scientific discoveries or inventions took somewhere between five (5) and twenty (20) years. This is significantly longer than the time frame of typical commercial software industry and venture capital funded projects. In many cases, one is talking about five to twenty years of failure followed by a “breakthrough”, as in Kepler’s case.</p>
<p>In my experience, people involved in commercial software development are often unaware that they have little or no experience with true research. The misleading rhetoric of the computer software industry often leads people involved in commercial software development to think that they are engaged in the sort of true research conjured up by iconic names like Einstein or the Wright brothers. This undoubtedly leads to many bad decisions and frustrating experiences.</p>
<p><strong>The Importance of Rapid Prototyping</strong></p>
<p>History records many remarkable instances when an individual or small team succeeded in making a major scientific discovery or invention on a very small budget, sometimes beating far better funded competitors. Major scientific discoveries or inventions almost always involve a large amount of trial and error. Discoverers or inventors who managed to make a major discovery or invention on a shoe-string budget usually found a very fast, inexpensive way to perform the many trials and errors required to make a major discovery or invention.</p>
<p>For example, James Watt is remembered for inventing the separate condenser steam engine, a major conceptual leap that turned the steam engine from a niche device used in coal mining to a major driver of the industrial revolution. The Newcomen steam engines of Watt’s time were huge expensive house-sized engines. Watt however built and experimented with tiny scale models built from inexpensive wood, copper, and other materials. This enabled him to perform hundreds of trials and errors that led to the breakthrough concept of the separate condenser that radically improved the Newcomen steam engine.</p>
<p>Octave Chanute and the Wright brothers, his proteges, conducted research and development of gliders constructed of cheap wood and canvas. The gliders were flown at low altitude on soft sand beaches, first in Gary, Indiana near Chicago where Chanute lived, and later at Kitty Hawk in North Carolina. This meant that the inevitable damage from crashes was limited and easily repaired. The pilots did not die from the crashes as was common with other early would-be aviators. By delaying work on the expensive engines until last (they planned to buy a commercial off-the-shelf engine), they avoided the enormous cost involved in repairing or replacing an engine after each crash. This enabled Chanute and the Wright brothers to eventually succeed where better funded efforts such as Hiram Maxim and Samuel Langley failed.</p>
<p>Progress in aviation and rocketry today is quite slow, almost flat-lined since 1970, in part because the cost of a single trial, especially a new high performance engine, has become extremely high, easily in the millions if not billions of dollars per prototype engine and vehicle. In rocketry and other high performance engines, the prototype engine and vehicle are often destroyed during each trial. Internet entrepreneur Elon Musk of PayPal fame encountered this problem with his SpaceX startup as have many other Internet and software entrepreneurs attracted by the dream of space travel.</p>
<p>In algorithm research and development today, rapid prototyping tools such as Matlab and Mathematica (see below) speed up and reduce the cost of the many trials and errors required in true research. This is very important because the number of trials and errors is usually very large.</p>
<p><strong>The Importance of Conceptual Analysis</strong></p>
<p>Most major scientific discoveries and inventions usually involve a large amount of conceptual analysis expressed in words and pictures (often hundreds of thousands of words). It is common to find lengthy verbal discussions of the issues combined with rough sketches or drawings of concepts. For example, Octave Chanute wrote an entire book Progress in Flying Machines containing his lengthy verbal analysis of the problem of flight. This book outlines his successful research plan to develop working powered flight. It contains several rough drawings, as is common in major breakthroughs, and only a few brief calculations. The mathematician Johannes Kepler devoted much of his book, now known as New Astronomy, to a lengthy conceptual analysis of the problem of planetary orbits which was critical to his resolution of the problem.</p>
<p>At some point, these verbal analyses are refined into precise technical drawings in the case of mechanical inventions and specific mathematical expressions in the case of mathematical discoveries like Kepler’s. However, the verbal and visual analysis appears to be critical in many discoveries and inventions and usually comes first. It is likely that this sort of verbal and visual analysis will be essential to solve many problems such as artificial intelligence and pattern recognition.</p>
<p>Historically, this conceptual analysis was considered a part of philosophy. Much of the classical training in Greek philosophy and mathematics probably provided important training in this conceptual analysis. The discovery of new mathematical expressions of practical use strictly by the symbolic manipulation and the highly abstract thought favored by the famous mathematician David Hilbert and his school at the University of Gottingen in the early 20th century seems to be rare. This is specifically mentioned because Hilbert’s extremely abstract approach to higher mathematics has come to dominate mathematics and theoretical physics in the 20th century.</p>
<p><strong>Some Famous Flops</strong></p>
<p>Complex algorithm research and development is a treacherous area. There have been numerous flops and fiascoes over the years. It is easy to misjudge the technical feasibility of projects. There is a long history of exaggerated claims for complex algorithms that emulate aspects of human intelligence such as speech recognition. There has been enormous success in data compression over the last few decades. Nonetheless, there is a long history of exaggerated claims for advanced in data compression. Video and other data compression involves complex algorithms that are difficult to evaluate. <em>Caveat emptor!</em></p>
<p>The Pen computing fad of the early 1990’s is an example of a famous flop. The most prominent of these firms was Jerry Kaplan’s GO, described in his book Startup. GO and similar firms’ business plans hinged on handwriting recognition, an unsolved problem in pattern recognition. Kaplan actually devotes only a few pages of his book to the handwriting recognition problem.</p>
<p>Another notorious example is the speech recognition firm Lernout and Hauspie. Lernout and Hauspie collapsed in a major financial scandal with court cases and allegations of massive fraud. Again, the success of Lernout and Hauspie’s business depended on the solution of the speech recognition problem, which remains largely unsolved even today.</p>
<p>Note that many apparently sophisticated investors invested many millions of dollars in both GO and Lernout and Hauspie, even though a modicum of research would have revealed the poor state of handwriting and speech recognition technology at the time.</p>
<p><strong>Some Famous Successes</strong></p>
<p>Video and audio compression is one of the most successful areas in complex algorithms. Technologies such as VideoCD, <span class="caps">DVD</span>, MP3, and BluRay all incorporate sophisticated audio and video compression algorithms.</p>
<p>A major breakthrough in video compression reached the market in 2003, embodied in H.264, Windows Media 10, Flash Video, and other video standards and products. Prior to 2003 the bitrate for usable, loosely <span class="caps">VHS</span> quality video was about one (1) megabit per second. In 2003, the new video technologies achieved a bit rate of around 275 Kilobits/second, often with close to <span class="caps">DVD</span> quality with proper tuning of the compression. This was a truly major advance, a rare technological leap forward. This enabled YouTube and other forms of Internet/web video over <span class="caps">DSL</span> connections.</p>
<p>The bottom line is that complex algorithm research and development can be done, but it is difficult.</p>
<p><strong>Software Engineering</strong></p>
<p>There are significant differences between software engineering for complex algorithm research and development and mainstream software development. As mentioned above, complex algorithms often involve a tight coupling between parts of the algorithm that makes development more difficult and tedious than most software development.</p>
<p>It is often easier to research and develop complex algorithms using tools such as Matlab, Mathematica, <span class="caps">AXIOM</span>, or Maxima (formerly known as <span class="caps">MACSYMA</span>). These are scripting languages similar to Python or <span class="caps">PHP</span>. They usually have implicit variable declaration and/or conversion. They are usually “weakly typed” languages and break many textbook rules of “good” software engineering. They include comprehensive, well-integrated libraries of mathematical, numerical, and statistical functions. They usually have a data type known variously as a list, vector, or matrix that represents sequences of numerical or symbolic data in a flexible way. These tools are sometimes referred to as computer algebra systems (CAS), although this is really only one subset of their features.</p>
<p><strong>Adding Two Vectors in Mathematica</strong></p>
<pre  class="mathcode">A = {1.0, 2.0, 3.0}; (* A is a Mathematica list *)
B = {1.1, 0.0, 4.0};
C = A + B
Out[1]={2.1, 2.0, 7.0}</pre>
<p><strong>Adding Two Vectors in C/C++</strong></p>
<pre  class="mathcode">#include &lt;iostream.h&gt;
double A[3] = {1.0, 2.0, 3.0}; // A is a C++ array
double B[3] = {1.1, 0.0, 4.0};
double C[3];
int index;

for(index = 0; index &lt;3; index++)
   C[index] = A[index] + B[index];

cout &lt;&lt; “{“ &lt;&lt; C[1] &lt;&lt; “,” &lt;&lt;
C[2] &lt;&lt; “,” &lt;&lt; C[3] &lt;&lt; “}” &lt;&lt;
endl;</pre>
<p>Note that there is a vector class template in the C++ Standard Template Library (STL) with somewhat similar properties to the lists in Mathematica. The above comparison is for illustrative purposes. Even using the <span class="caps">STL</span> classes, it is usually much easier to research, develop, and test algorithms in these tools than using traditional compiled, strongly typed languages such as C/C++, Java, or &lt;insert your favorite programming language here&gt;. However, these tools are slow and require large amounts of memory. This is a significant drawback. Once an algorithm is developed, it is often necessary to convert the algorithm to a fast compiled language for performance reasons. This is easier if the target fast language has good libraries of mathematical, numerical, and statistical functions.</p>
<p>One can also research and develop algorithms directly in a fast programming language such as C/C++ or Java. This avoids conversion costs, speed, and memory issues. However, it is often much easier to do research and development using a tool such as Matlab or Mathematica.</p>
<p>The leading algorithm research and development tools are:</p>
<ul>
<li><strong><span class="caps">MATLAB</span></strong>: <a href="http://www.mathworks.com/">Matlab</a> is widely used in the commercial world, especially in digital signal processing.</li>
<li><strong><span class="caps">MATHEMATICA</span></strong>: <a href="http://www.wolfram.com">Mathematica</a> is widely used in government sponsored research and development and academic research. It has a following in Wall Street finance and economics.</li>
<li><strong><span class="caps">AXIOM</span></strong>: <a href="http://www.axiom-developer.org">Axiom</a> is free, open source, with a Berkeley style license. <span class="caps">AXIOM</span> was started in 1971 and has over 300 man years of work integrated into it.</li>
<li><strong><span class="caps">MAXIMA</span></strong>: <a href="http://maxima.sourceforge.net">Maxima</a> is free, open-source, with a <span class="caps">GNU</span> license.</li>
</ul>
<p>Many fast programming languages have been used for complex algorithms. The most popular are probably:</p>
<ul>
<li><strong><span class="caps">ANSI C</span></strong>: <span class="caps">ANSI C</span> is almost universally available for all processors. It is simple, efficient, with small memory needs and high speed. </li>
<li><strong>C++</strong>: C++ is object-oriented. It often has larger memory needs than C and can be slower. </li>
<li><strong>Java</strong>: Java is compiled to byte-codes, but is approaching C/C++ in speed. It can be slower and less efficient. It can be easier to reverse engineer.</li>
</ul>
<p>The dream algorithm R&#38;D tool would be similar to Matlab or Mathematica but could be compiled to fast, efficient binaries similar to <span class="caps">ANSI C</span> and would be available for all platforms. An integrated <span class="caps">GUI</span> builder similar to Visual Basic and integrated network support would be helpful. The biggest single weakness of all kinds of scripting languages is that they are slow and cannot be compiled. For compute- intensive complex algorithms this can be a very significant problem. Of scripting languages, only Visual Basic 6 appears to have solved the problem of producing a compiler that can produce binary executables with similar performance to C/C++.</p>
<p>These algorithm research and development tools are not, of course, a substitute for thought, creativity, and the extensive conceptual analysis frequently required for major advances. Trial and error alone, without insight, rarely succeeds.</p>
<p><strong>Conclusion</strong></p>
<p>Complex algorithm research and development can be done successfully. Some great successes exist. Nonetheless, it is not easy and many things can go wrong. The project scope is significant. Project feasibility is difficult to assess. Genuine breakthroughs are unpredictable and take time. The return on investment for a home run can be five to thousands of times the original investment. There are great unrealized opportunities, most of which require genuine research.</p>
<p><strong>About the Author</strong></p>
<p>John F. McGowan, Ph.D. is a software developer, research scientist, and consultant. He works primarily in the area of complex algorithms that embody advanced mathematical and logical concepts, including speech recognition and video compression technologies. He has many years of experience developing software in Visual Basic, C++, and many other programming languages and environments. He has a Ph.D. in Physics from the University of Illinois at Urbana-Champaign and a B.S.in Physics from the California Institute of Technology (Caltech). He can be reached at jmcgowan11 (at) earthlink.net.</p>
<p><strong>References</strong></p>
<p><strong>Some Complex Algorithms</strong></p>
<ul>
<li><span class="caps">MPEG</span> compression, one of the great success stories: <a href="http://www.chiariglione.org/mpeg/">http://www.chiariglione.org/mpeg/</a></li>
<li>x264 is a free, opensource h.264 video encoder: <a href="http://www.videolan.org/developers/x264.html">http://www.videolan.org/developers/x264.html</a></li>
<li>The Carnegie Mellon Sphinx Project, an open-source speech recognition engine: <a href="http://cmusphinx.sourceforge.net">http://cmusphinx.sourceforge.net</a></li>
<li>National Library of Medicine Insight Image Registration and Segmentation Toolkit: <a href="http://www.itk.org">http://www.itk.org</a></li>
</ul>
<p><strong>Books and Articles</strong></p>
<ol>
<li><a href="http://www.amazon.com/gp/product/0140257314?ie=UTF8&amp;tag=antoniocangia-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=0140257314">Startup: A Silicon Valley Adventure</a>, by Jerry Kaplan, Houghton Mifflin Co, Boston, 1995, ISBN 0-140-25731-4</li>
<li>“<a href="http://www.tomcoyner.com/how_high.htm">How High-Tech Dream Shattered in Scandal at Lernout &#38; Hauspie</a>”, by Mark Maremont, Jesse Eisinger, and John Carreyrou, Wall Street Journal, December 7, 2000</li>
<li>New Astronomy (Nova Astronomia), by Johannes Kepler, Translated from the Latin original by William H. Donahue, Cambridge University Press, Cambridge, UK, 1992, ISBN 0-521-30131-9</li>
</ol>
<p><em>This article was written by John F. McGowan, PhD. If you’d like to write for Math-Blog.com, please email us at submissions (at) math-blog.com.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://math-blog.com/2009/07/20/complex-algorithm-research-and-development-harder-than-many-think/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>A New Kind of Search</title>
		<link>http://math-blog.com/2009/03/10/a-new-kind-of-search/</link>
		<comments>http://math-blog.com/2009/03/10/a-new-kind-of-search/#comments</comments>
		<pubDate>Tue, 10 Mar 2009 20:29:32 +0000</pubDate>
		<dc:creator>Antonio Cangiano</dc:creator>
				<category><![CDATA[Applied Math]]></category>
		<category><![CDATA[Math News]]></category>
		<category><![CDATA[Math Websites]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://math-blog.com/?p=172</guid>
		<description><![CDATA[Seven years ago Stephen Wolfram published A New Kind of Science. I remember the hype surrounding this book. Journalists jumped at the chance to praise a heavy tome that was too complex for most of them to fully understand, but that shipped with an ambitious title and the implicit guarantee that comes from a genius [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.amazon.com/gp/product/1579550088?ie=UTF8&#038;tag=antoniocangia-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=1579550088"><img src="http://math-blog.com/images/nks.jpg" alt="A New Kind of Science" align="right" /></a>Seven years ago Stephen Wolfram published <a href="http://www.amazon.com/gp/product/1579550088?ie=UTF8&#038;tag=antoniocangia-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=1579550088">A New Kind of Science</a>. I remember the hype surrounding this book. Journalists jumped at the chance to praise a heavy tome that was too complex for most of them to fully understand, but that shipped with an ambitious title and the implicit guarantee that comes from a genius like <a href="http://en.wikipedia.org/wiki/Stephen_Wolfram">Wolfram</a>.</p>
<p>It was &#8220;buzz worthy&#8221; for sure, and all the attention quickly attracted the interest of numerous scientists from many disciplines. As soon as the mathematicians, and particularly computer scientists, managed to get through its 1000+ pages, the first negative reviews began to pour in. Though, in all fairness, a few scientists had a little too much fun with this book and managed to showcase their comedic abilities by writing <a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&#038;location=http%3A%2F%2Fwww.amazon.com%2Freview%2FR6B8KO2M32P8G%3Fie%3DUTF8%26ref%255F%3Dcm%255Fcr%255Frdp%255Fperm&#038;tag=antoniocangia-20&#038;linkCode=ur2&#038;camp=1789&#038;creative=390957">some of the most hilarious reviews</a> known to humankind.</p>
<p>In this controversial best-seller, Stephen Wolfram primarily dissects the subject of cellular automata and its relevance to other scientific disciplines, in a systematic manner. It&#8217;s a book that covers a lot of ground and is arguably a remarkable piece of writing. Yet, the scientific community greeted the book with a fair dose of criticism.</p>
<p>So what went wrong? The main problem with <em>A New Kind of Science</em> is that it set very high expectations due to its author, title, and the numerous reminders of how important this material is, throughout the book.</p>
<p>The main accusations ranged from the book being called a display of Wolfram&#8217;s ego, to having very little &#8220;new&#8221; content, all the way to the more severe claims of not crediting other people&#8217;s work. For example, the idea of the universe as a cellular automaton was first presented by Konrad Zuse, so Wolfram&#8217;s &#8220;new&#8221; idea of a discrete, computable universe was anything but groundbreaking. On top of that, the most remarkable technical achievement revealed in this book was arguably the proof that the rule 110 cellular automaton is Turing complete. While this was conjectured by Wolfram, it was actually proven by his assistant Matthew Cook, who was refrained from publishing his results elsewhere by Wolfram&#8217;s lawyers.</p>
<p>It&#8217;s important to understand that, while perhaps not accepted as the breakthrough that Wolfram had hoped for, this book &#8211; and the methods for studying computational systems illustrated within it &#8211; is far from gibberish. Wolfram&#8217;s ambitious project failed in the eyes of the community due to the extremely high expectations that were set for this book. When you claim to have something radically new, you must be able to back that claim up in a convincing enough manner or else you&#8217;re bound to end up with egg on your face.</p>
<p>To be fair to Wolfram (for the few who are not familiar with his work) NKS is a controversial project, but he was already famous for having created the excellent program Mathematica (whose 7th version was recently released), one of the world&#8217;s most complete and advanced mathematical software.</p>
<p>Now Wolfram is at it again. According to his <a href="http://blog.wolfram.com/2009/03/05/wolframalpha-is-coming/">recent announcement</a>, he is about to unleash something called <a href="http://www.wolframalpha.com/">WolframAlpha</a> to the world, which combines both his work with Mathematica and NKS. In Wolfram&#8217;s own words:</p>
<blockquote><p>I had two crucial ingredients: Mathematica and NKS. With Mathematica, I had a symbolic language to represent anything—as well as the algorithmic power to do any kind of computation. And with NKS, I had a paradigm for understanding how all sorts of complexity could arise from simple rules.</p></blockquote>
<p>The project has been kept on the down-low for the past few years, while some of the brightest mathematicians and engineers employed by Wolfram Research, Inc. worked on it. It&#8217;s currently in private beta, but will go live in May of this year. From an initial glance, it would seem to be just another search engine a la Google.com. But is it? Not quite. It&#8217;s labeled as a &#8220;computational knowledge engine&#8221;, whose aim is to compute answers from the human knowledge available on the web. Whereas on Google you can search for strings and the results will be a series of relevant links, WolframAlpha will supposedly be able to parse and &#8220;understand&#8221; a query that&#8217;s inputted in English, and compute an answer based on the extensive knowledge stored in its system (assuming that a univocal answer exists). Conceptually speaking, it&#8217;s leaps and bounds more complex to get right than Google, which simply looks for matching strings and orders the results based on the popularity of the given keywords (For more information about the mathematics behind Google, read <a href="http://www.amazon.com/gp/product/0691122024?ie=UTF8&#038;tag=antoniocangia-20&#038;linkCode=as2&#038;camp=1789&#038;creative=390957&#038;creativeASIN=0691122024">this book</a>).</p>
<p align="center"><img src="http://math-blog.com/images/wolframalpha.png" alt="WolframAlpha" /></p>
<p><a href="http://www.twine.com/item/122mz8lz9-4c/wolfram-alpha-is-coming-and-it-could-be-as-important-as-google">According to Nova Spivack</a>, who had a chance to try out WolframAlpha, the service is able to compute factual answers to questions such as &#8220;What is the location of Timbuktu?&#8221;, &#8220;How many protons are in a hydrogen atom?,&#8221; &#8220;What was the average rainfall in Boston last year?,&#8221; &#8220;What is the 307th digit of Pi?,&#8221; &#8220;where is the ISS?&#8221; or &#8220;When was GOOG worth more than $300?&#8221;. This project has the potential to change the world as we know it, just like Google did. Several years ago Altavista was fine for most people&#8217;s search needs &#8211; or so we thought. It took Google to show us how much better off we could be search-wise, how much we needed Google, and ultimately how inadequate Altavista was. Unlike the case of Google and Altavista though, WolframAlpha would not replace Google, since the two services cover complimentary needs. Having access to a service that&#8217;s able to compute answers out of the chaos of the factual information that&#8217;s available to man would be a major breakthrough for humanity and computer science. And if an API (Application Programming Interface) were to become available, other developers would be able to tap into that with their applications.</p>
<p>Bold claims, high expectations. You understand why, two months away from experiencing something so potentially revolutionary, there is a lot of hype surrounding this project &#8211; but also major skepticism. For many this is <em>A New Kind of Science</em> all over again, especially since natural language processing and &#8220;computing knowledge&#8221; are extremely ambitious challenges in a realm where many have failed before. Pulling this one off would be a major accomplishment (that would dwarf Wolfram&#8217;s past achievements, including Mathematica), and, at long last, it would be the hard earned, practical validation of some of the methods and philosophies expressed in NKS by Wolfram.</p>
<p>I fully expect people to find bugs and have many simple questions, for which we will see bizarre answers. We&#8217;ll read blog posts about the whole thing and perhaps have a good laugh. But what interests me the most is whether, as Google did in the past, this new engine will be able to be practical and useful on an everyday level. Bugs are fair play and expected, but what we&#8217;re looking for here is a spark of true innovation thanks to the mathematical modelling of human knowledge.</p>
<p>I suspect that this engine will either have us in awe like Mathematica did, or leave us with mixed feelings &#8211; if not downright disappointment, like <em>A New Kind of Science</em> did for many. I can&#8217;t help but hope for the former, as I wait for my chance to try it out.</p>
]]></content:encoded>
			<wfw:commentRss>http://math-blog.com/2009/03/10/a-new-kind-of-search/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>13 Useful Math Cheat Sheets</title>
		<link>http://math-blog.com/2008/09/20/13-useful-math-cheat-sheets/</link>
		<comments>http://math-blog.com/2008/09/20/13-useful-math-cheat-sheets/#comments</comments>
		<pubDate>Sat, 20 Sep 2008 16:42:20 +0000</pubDate>
		<dc:creator>Antonio Cangiano</dc:creator>
				<category><![CDATA[Applied Math]]></category>
		<category><![CDATA[Math Education]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://math-blog.com/?p=55</guid>
		<description><![CDATA[Cheat sheets can be very useful and make for great posters around your room. The following is a collection of 13 cheat sheets for several mathematical topics and programs: General Math Cheat Sheet (iPaper and other formats) Elementary Algebra Cheat Sheet (PDF) Trigonometry Cheat Sheet (PDF) Calculus Cheat Sheet (PDF) Derivatives and Integrals Cheat Sheet [...]]]></description>
			<content:encoded><![CDATA[<p>Cheat sheets can be very useful and make for great posters around your room. The following is a collection of 13 cheat sheets for several mathematical topics and programs:</p>
<ol>
<li><a href="http://www.scribd.com/doc/4549/Math-cheat-sheet-by-Dr-Seiden">General Math Cheat Sheet</a> (iPaper and other formats)</li>
<li><a href="http://tutorial.math.lamar.edu/pdf/Algebra_Cheat_Sheet.pdf">Elementary Algebra Cheat Sheet</a> (PDF)</li>
<li><a href="http://tutorial.math.lamar.edu/pdf/Trig_Cheat_Sheet.pdf">Trigonometry Cheat Sheet</a> (PDF)</li>
<li><a href="http://tutorial.math.lamar.edu/pdf/Calculus_Cheat_Sheet_All.pdf">Calculus Cheat Sheet</a> (PDF)</li>
<li><a href="http://tutorial.math.lamar.edu/pdf/Common_Derivatives_Integrals.pdf">Derivatives and Integrals Cheat Sheet</a> (PDF)</li>
<li><a href="http://tutorial.math.lamar.edu/pdf/Laplace_Table.pdf">Laplace Transforms Cheat Sheet</a> (PDF)</li>
<li><a href="http://www.glump.net/content/abstract_algebra_cheat">Abstract Algebra Cheat Sheet</a> (PDF)</li>
<li><a href="http://kom.aau.dk/project/sipcom/SIPCom06/semester7/FP7-5/prob-cheat-sheet.pdf">Probability Theory Cheat Sheet</a> (PDF)</li>
<li><a href="http://web.mit.edu/18.06/www/MATLAB/matlab-cheatsheet.pdf">Matlab Cheat Sheet</a> (PDF)</li>
<li><a href="http://www.uoregon.edu/~joe/mathematica-cheat-sheet.pdf">Mathematica Cheat Sheet</a> (PDF)</li>
<li><a href="http://math.mtsac.edu/resources/maple11_cheatsheet1.pdf">Maple Cheat Sheet</a> (PDF)</li>
<li><a href="http://math-blog.com/2007/06/04/a-10-minute-tutorial-for-solving-math-problems-with-maxima/">Maxima Cheat Sheet</a> (HTML web page)</li>
<li><a href="http://stdout.org/~winston/latex/">LaTeX Cheat Sheet</a> (several formats)</li>
</ol>
<p>And since most of us like to show our math pride off when out and about as well, Amazon sells this awesome <a href="http://math-blog.com/go/?B000QHGDSU">Math Cheat Sheet T-shirt</a><img src="http://www.assoc-amazon.com/e/ir?t=antoniocangia-20&#038;l=as2&#038;o=1&#038;a=B000QHGDSU" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /> with formulas on both sides (Also available for <a href="http://math-blog.com/go/?B000QHEPL2">Science</a> and <a href="http://math-blog.com/go/?B001CP5UGG">Engineering</a>). How awesome is this? <img src='http://math-blog.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p align="center"><a href="http://math-blog.com/go/?B000QHGDSU"><img src="http://math-blog.com/wp-content/uploads/2008/09/math-t-shirt.jpg" alt="Math Cheat Sheet T-shirt" title="How awesome is this?" border="0" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://math-blog.com/2008/09/20/13-useful-math-cheat-sheets/feed/</wfw:commentRss>
		<slash:comments>33</slash:comments>
		</item>
		<item>
		<title>Getting started with gnuplot</title>
		<link>http://math-blog.com/2008/06/08/getting-started-with-gnuplot/</link>
		<comments>http://math-blog.com/2008/06/08/getting-started-with-gnuplot/#comments</comments>
		<pubDate>Sun, 08 Jun 2008 14:24:02 +0000</pubDate>
		<dc:creator>Antonio Cangiano</dc:creator>
				<category><![CDATA[Applied Math]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Suggested Reading]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[gnuplot]]></category>
		<category><![CDATA[plotting]]></category>

		<guid isPermaLink="false">http://math-blog.com/2008/06/08/getting-started-with-gnuplot/</guid>
		<description><![CDATA[gnuplot is an excellent scientific package for visualizing data and plotting functions. Despite its name, it has nothing to do with the GNU project, even though it&#8217;s Open Source and entirely free. This tool is very handy whenever you need to produce production quality graphics from a given data-set (or function). It is no wonder [...]]]></description>
			<content:encoded><![CDATA[<p>gnuplot is an excellent scientific package for visualizing data and plotting functions. Despite its name, it has nothing to do with the <span class="caps">GNU</span> project, even though it&#8217;s Open Source and entirely free. This tool is very handy whenever you need to produce production quality graphics from a given data-set (or function). It is no wonder that in its 20+ years of existence, it&#8217;s been employed in all sorts of industries.</p>
<p>Flexible, powerful, and easy to use, gnuplot is not only handy as a stand-alone program but can be used successfully by a variety of programming languages, including but not limited to Ruby, Python and Perl. It has also been adopted as a plotting engine by Open Source programs like Maxima and <span class="caps">GNU</span> Octave. The minimal effort required to learn gnuplot is therefore a very worthwhile endeavor. Being able to visualize things as you analyze data and explore mathematics, is a very useful aid.</p>
<p>gnuplot is cross-platform, and you can <a href="http://sourceforge.net/project/showfiles.php?group_id=2055&#38;package_id=1996&#38;release_id=582819">download it</a> from SourceForge.</p>
<p>Once you have installed gnuplot, you can start the tool by simply running <code>gnuplot</code> from the shell. Getting started with the program is straightforward, given that the most basic functionalities are fairly intuitive. For example, if you wanted to plot the sin(x) function, you could run:</p>
<pre class="mathcode">
gnuplot&gt; plot sin(x)
</pre>
<p align="center"><img src='http://math-blog.com/wp-content/uploads/2008/06/gnuplot1.png' alt='gnuplot1.png' /></p>
<p>gnuplot will automatically decide for you what portions of the function should be visualized (in our case between -10 and 10 on the x axis). If you want to overwrite this, you can specify otherwise, as shown below:</p>
<pre class="mathcode">
gnuplot&gt; plot [-pi:pi] sin(x)
</pre>
<p align="center"><img src='http://math-blog.com/wp-content/uploads/2008/06/gnuplot2.png' alt='gnuplot2.png' /></p>
<p>Similarly, you can customize the plotting, by specifying a range on the y axis:</p>
<pre class="mathcode">
gnuplot&gt; plot [] [-0.5:0.5] sin(x)
</pre>
<p align="center"><img src='http://math-blog.com/wp-content/uploads/2008/06/gnuplot3.png' alt='gnuplot3.png' /></p>
<p>It is also possible to plot several functions at once:</p>
<pre class="mathcode">
gnuplot&gt; plot [-2:2] x, x**2, x**3
</pre>
<p align="center"><img src='http://math-blog.com/wp-content/uploads/2008/06/gnuplot4.png' alt='gnuplot4.png' /></p>
<p>gnuplot can draw all sorts of functions and graphics. For example, the following plots two surfaces:</p>
<pre class="mathcode">
gnuplot&gt; splot x**2+y**2, x**2-y**2
</pre>
<p align="center"><img src='http://math-blog.com/wp-content/uploads/2008/06/gnuplot5.png' alt='gnuplot5.png' /></p>
<p>What you see plotted above, is based on a sensible set of defaults, but gnuplot offers countless options to customize the appearance of your graphics.</p>
<p>gnuplot isn&#8217;t just useful for plotting mathematical functions. I often use it for plotting data that is stored in tabular format in simple text formats. For example, assume that you have collected the following data on Deaths by Major Causes in the US, from a website:</p>
<h3 align="center"><a href='http://math-blog.com/wp-content/uploads/2008/06/stats.txt' title='stats.txt'>stats.txt</a></h3>
<p>That&#8217;s a big chunk of data, but it&#8217;s not very easy to analyze. It&#8217;d be nice to be able to visualize it. Assuming you saved it in a <code>stats.txt</code> file (you can include or remove the first few lines of comments) from gnuplot you can run the following:</p>
<pre class="mathcode">
gnuplot&gt; plot "stats.txt"
</pre>
<p align="center"><img src='http://math-blog.com/wp-content/uploads/2008/06/gnuplot6.png' alt='gnuplot6.png' /></p>
<p>That&#8217;s a meaningless mess. But gnuplot is very flexible, so we can easily do much better. Let&#8217;s use the first column for x values, and each of the remaining columns as a curve of its own by running:</p>
<pre class="mathcode">

gnuplot&gt; plot "stats.txt" using 1:2 title "Heart disease" with lines, "stats.txt" using 1:3 title "Cancer" with lines, "stats.txt" using 1:4 title "Cerebro-vascular diseases" with lines, "stats.txt" using 1:5 title "Lower respiratory diseases" with lines, "stats.txt" using 1:6 title "Diabetes mellitus" with lines, "stats.txt" using 1:7 title "Influenza and pneumonia" with lines, "stats.txt" using 1:8 title "Chronic liver disease" with lines, "stats.txt" using 1:9 title "Accidents" with lines, "stats.txt" using 1:10 title "Suicide" with lines, "stats.txt" using 1:11 title "Homicide" with lines
</pre>
<p>Or it&#8217;s abbreviated version:</p>
<pre class="mathcode">
gnuplot&gt; plot "stats.txt" u 1:2 title "Heart disease" w l, "" u 1:3 title "Cancer" w l, "" u 1:4 title "Cerebro-vascular diseases" w l, "" u 1:5 title "Lower respiratory diseases" w l, "" u 1:6 title "Diabetes mellitus" w l, "" u 1:7 title "Influenza and pneumonia" w l, "" u 1:8 title "Chronic liver disease" w l, "" u 1:9 title "Accidents" w l, "" u 1:10 title "Suicide" w l, "" u 1:11 title "Homicide" w l
</pre>
<p align="center"><img src='http://math-blog.com/wp-content/uploads/2008/06/gnuplot7.png' alt='gnuplot7.png' /></p>
<p>Much better! Of course, the command above has a bit of repetition in it, but it&#8217;s justified by the flexibility of being able to pull data from different files if required, and plot some data with lines and others without (or in different styles) if we want to. To improve the appearance and legibility of the chart, let&#8217;s add a grid:</p>
<pre class="mathcode">
gnuplot&gt; set grid
gnuplot&gt; replot
</pre>
<p align="center"><img src='http://math-blog.com/wp-content/uploads/2008/06/gnuplot8.png' alt='gnuplot8.png' /></p>
<p>Nice! And notice how the <code>replot</code> command runs the last plotting directive for us, saving us some typing (or scrolling through the previous commands). To improve this further, we can also set the labels for the axis and a title for the whole chart:</p>
<pre class="mathcode">
gnuplot&gt; set xlabel "Years"
gnuplot&gt; set ylabel "Death rates per 100,000 people"
gnuplot&gt; set title "Deaths by Major Causes, 1960–2005"
gnuplot&gt; replot
</pre>
<p align="center"><img src='http://math-blog.com/wp-content/uploads/2008/06/gnuplot9.png' alt='gnuplot9.png' /><br/>(Click <a href='http://math-blog.com/wp-content/uploads/2008/06/gnuplot10.png' alt='gnuplot10.png'>here</a> for a larger version)</p>
<p>Effortlessly, we went from having some data in a text file, to a meaningful, and professional looking chart that could be used in an article or a book. Not bad. You can save it in your favorite format, by setting the output file name and the terminal type. In the example below, I specify the font type, size and its location on my Mac <span class="caps">OS X</span> system, but it&#8217;s entirely optional. If missing, the default fonts apply.</p>
<pre class="mathcode">
gnuplot&gt; set output "mychart.png"
gnuplot&gt; set terminal png font "/Library/Fonts/Times New Roman.ttf, 11"
gnuplot&gt; replot
</pre>
<p>This very short introduction should you give you a glimpse into what gnuplot can do for you, and even get you started with the tool. But gnuplot is much more than this and infinitely customizable, so you really may want to consider learning more about it. Unfortunately, despite being widely used for more than a decade, gnuplot has never had a book published about it.</p>
<p><a href="http://www.amazon.com/gp/product/1933988398?ie=UTF8&#38;tag=antoniocangia-20&#38;linkCode=as2&#38;camp=1789&#38;creative=9325&#38;creativeASIN=1933988398"><img src='http://math-blog.com/wp-content/uploads/2008/06/gnuplot.jpg' alt='gnuplot.jpg' align="right" /></a>Thankfully, <a href="http://www.manning.com/affiliate/idevaffiliate.php?id=980_0_3_14">Manning Publications</a> will be putting out a book called <a href="http://www.amazon.com/gp/product/1933988398?ie=UTF8&#38;tag=antoniocangia-20&#38;linkCode=as2&#38;camp=1789&#38;creative=9325&#38;creativeASIN=1933988398">Gnuplot in Action</a> in October. The good news is that you don&#8217;t have to wait for the dead tree version, you can <a href="http://manning.com/janert/">purchase it today</a> through the Manning Early Access Program (MEAP). 12 out of the 15 chapters are already available, so the book is pretty much complete. If you&#8217;re interested in making the best out of gnuplot, this book is a must have. You don&#8217;t have to be a mathematician or a programmer to follow along, and it&#8217;s so much more than a bunch of options for customizing your graphics. The book guides you through the best techniques for taking advantage of the tool in several common scenarios. By reading, this easy to follow book, you&#8217;ll be able to generate colorful, nifty plots and have good mastery of the tool in a very short amount of time.</p>
]]></content:encoded>
			<wfw:commentRss>http://math-blog.com/2008/06/08/getting-started-with-gnuplot/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Polynomial Root-finding with the Jenkins-Traub Algorithm</title>
		<link>http://math-blog.com/2008/03/06/polynomial-root-finding-with-the-jenkins-traub-algorithm/</link>
		<comments>http://math-blog.com/2008/03/06/polynomial-root-finding-with-the-jenkins-traub-algorithm/#comments</comments>
		<pubDate>Thu, 06 Mar 2008 12:25:26 +0000</pubDate>
		<dc:creator>David Binner</dc:creator>
				<category><![CDATA[Applied Math]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://math-blog.com/2008/03/06/polynomial-root-finding-with-the-jenkins-traub-algorithm/</guid>
		<description><![CDATA[The Jenkins-Traub Algorithm is a standard in the field of numerical computation of polynomial roots, fundamentally developed as a numerical algorithm specifically for the task of computing polynomial roots. In other words, (i) because it was planned from the outset for numerical purposes rather than being simply an adaptation of an analytic formula, it is [...]]]></description>
			<content:encoded><![CDATA[<p>The Jenkins-Traub Algorithm is a standard in the field of numerical computation of polynomial roots, fundamentally developed as a numerical algorithm specifically for the task of computing polynomial roots. In other words, (i) because it was planned from the outset for numerical purposes rather than being simply an adaptation of an analytic formula, it is extremely robust, effectively minimizing the effects of computer round-off error, while (ii) also being extremely efficient compared to more general methods <em>not</em> written specifically for the task of computing polynomial roots; in fact, the algorithm converges to polynomial roots at a rate better than quadratic. Furthermore, since being introduced over thirty years ago, the algorithm has had time to be rigorously tested and has successfully proven its quality; as a result, it has gained a wide distribution as evidenced by its incorporation in commercial software products and the posting on the NETLIB website of source code for programs based on the algorithm.</p>
<h3>An Introduction to the Field of Root-finding</h3>
<p>Given a function which is defined in terms of one or more independent variables, the roots (also called zeros) of the equation are the values of the independent variable(s) for which the function equals <img src='http://math-blog.com/wp-content/latex/pictures/cfcd208495d565ef66e7dff9f98764da.png' title='0' alt='0' align=absmiddle>:</p>
<p align="center"><img src='http://math-blog.com/wp-content/latex/pictures/2b804bc8cc579fff69a79ed72e5ecbbf.png' title='\displaystyle f(z1, z2, z3, z4, z5, . . . ) = 0' alt='\displaystyle f(z1, z2, z3, z4, z5, . . . ) = 0' align=absmiddle></p>
<p>Note that, in general, the z values are complex numbers, comprised of real and imaginary components (indicated by the <img src='http://math-blog.com/wp-content/latex/pictures/865c0c0b4ab0e063e5caa3387c1a8741.png' title='i' alt='i' align=absmiddle>): <img src='http://math-blog.com/wp-content/latex/pictures/b727a8c635e22f761f8c2f2860382285.png' title='z = x + iy' alt='z = x + iy' align=absmiddle>.</p>
<p>Consider the following equation:</p>
<p align="center"><img src='http://math-blog.com/wp-content/latex/pictures/cc5893767180f79d786943b95ab4a6f1.png' title='\displaystyle 2z_{1} + 0.5z_{2}z_{3} + 3.14z_{4}^{2}+1.414\ln(z_{5})=23' alt='\displaystyle 2z_{1} + 0.5z_{2}z_{3} + 3.14z_{4}^{2}+1.414\ln(z_{5})=23' align=absmiddle></p>
<p>The values of <img src='http://math-blog.com/wp-content/latex/pictures/f48108908e4ffd156fa7e01b11ef6abf.png' title='z_{1}, z_{2}, z_{3}, z_{4}' alt='z_{1}, z_{2}, z_{3}, z_{4}' align=absmiddle> and <img src='http://math-blog.com/wp-content/latex/pictures/346b9511eb97f9d0bb57f679b6579ce3.png' title='z_{5}' alt='z_{5}' align=absmiddle> which satisfy this equation may not be possible by analytical methods, so the equation would be rearranged into the following form:</p>
<p align="center"><img src='http://math-blog.com/wp-content/latex/pictures/8083fd03025f3a1c7c91ff097935a51e.png' title='\displaystyle 2z_{1} + 0.5z_{2}z_{3} + 3.14z_{4}^{2}+1.414\ln(z_{5}) &amp;#8211; 23 = 0' alt='\displaystyle 2z_{1} + 0.5z_{2}z_{3} + 3.14z_{4}^{2}+1.414\ln(z_{5}) &amp;#8211; 23 = 0' align=absmiddle></p>
<p>which is of the form</p>
<p align="center"><img src='http://math-blog.com/wp-content/latex/pictures/6dd9f4528959b0b076d1c0a04ff9033f.png' title='\displaystyle f(z1, z2, z3, z4, z5) = 0' alt='\displaystyle f(z1, z2, z3, z4, z5) = 0' align=absmiddle></p>
<p>Once in this form (the standard form), solving the original equation becomes a matter of finding the <img src='http://math-blog.com/wp-content/latex/pictures/f48108908e4ffd156fa7e01b11ef6abf.png' title='z_{1}, z_{2}, z_{3}, z_{4}' alt='z_{1}, z_{2}, z_{3}, z_{4}' align=absmiddle> and <img src='http://math-blog.com/wp-content/latex/pictures/346b9511eb97f9d0bb57f679b6579ce3.png' title='z_{5}' alt='z_{5}' align=absmiddle> values for which f equals <img src='http://math-blog.com/wp-content/latex/pictures/cfcd208495d565ef66e7dff9f98764da.png' title='0' alt='0' align=absmiddle>, and well-developed fields of mathematics and computer science provide several root-finding techniques for solving such a problem. Note that since the theme of this article is polynomial root-finding, further examples will focus on single-variable equations, specifically, polynomials.</p>
<h3>Analytical Root-finding Techniques</h3>
<p>Consider the following quadratic equation:</p>
<p align="center"><img src='http://math-blog.com/wp-content/latex/pictures/b9b78a6e79ea0de4886f22f259ce67e9.png' title='\displaystyle f(z) = z^{2} + z &amp;#8211; 2' alt='\displaystyle f(z) = z^{2} + z &amp;#8211; 2' align=absmiddle></p>
<p>This equation is a second-degree polynomial–the highest power applied to the independent variable is 2. Consequently, this equation has two roots; an n-degree polynomial equation has n roots.</p>
<p>Because the equation is a simple polynomial, a first approach to finding its zeros might be to put the equation into the form <img src='http://math-blog.com/wp-content/latex/pictures/9e4f61c0a413b8b4f9d4aa56cdfb32c9.png' title='(z &amp;#8211; \alpha_{1})(z &amp;#8211; \alpha_{2})' alt='(z &amp;#8211; \alpha_{1})(z &amp;#8211; \alpha_{2})' align=absmiddle> and make a few educated guesses; a person could quickly determine that <img src='http://math-blog.com/wp-content/latex/pictures/ccc03b346b44565b8b1f6642caee2b62.png' title='\alpha_{1} = 1' alt='\alpha_{1} = 1' align=absmiddle> (a strictly real result) is one root of this equation. This root could then be divided out of the original polynomial</p>
<p align="center"><img src='http://math-blog.com/wp-content/latex/pictures/a37a42e471e3d8ececc490761dc1c044.png' title='\displaystyle \frac{(z^{2} + z -2)}{(z-1)} = (z+2) ' alt='\displaystyle \frac{(z^{2} + z -2)}{(z-1)} = (z+2) ' align=absmiddle></p>
<p>to yield the second root: <img src='http://math-blog.com/wp-content/latex/pictures/734fab7699f5c3a97bca37c543be7268.png' title='\alpha_{2} = -2' alt='\alpha_{2} = -2' align=absmiddle>.</p>
<p>In this simple example, the two roots were found easily; the second root was found immediately after the first one was known. However, in most real-world problems the roots of a quadratic are not found so easily. Furthermore, in problems where the original polynomial is of degree greater than two, when one root is found, the other roots do not follow immediately &#8212; more sophisticated techniques are required. </p>
<p>Among the techniques available are analytical ones, in other words, techniques that yield explicit, algebraic results. For example, in the case of a quadratic equation, explicit expressions for the two roots are possible via the Quadratic Formula: once a quadratic equation is arranged into the standard form</p>
<p align="center"><img src='http://math-blog.com/wp-content/latex/pictures/89ac0d991f93510c4e7fbba280082a98.png' title='\displaystyle \bold{a}z^{2} + \bold{b}z + \bold{c} = 0' alt='\displaystyle \bold{a}z^{2} + \bold{b}z + \bold{c} = 0' align=absmiddle></p>
<p>(<strong>a</strong>, <strong>b</strong> and <strong>c</strong> are known constants), the two roots are found via the Quadratic Formula:</p>
<p align="center"><img src='http://math-blog.com/wp-content/latex/pictures/82241ed6257a1a3939f33b8d9e92f71c.png' title='\displaystyle \alpha = \frac{{ &amp;#8211; b \pm \sqrt {b^2 &amp;#8211; 4ac} }}{{2a}}' alt='\displaystyle \alpha = \frac{{ &amp;#8211; b \pm \sqrt {b^2 &amp;#8211; 4ac} }}{{2a}}' align=absmiddle></p>
<p>The quantity within the square root sign <img src='http://math-blog.com/wp-content/latex/pictures/97c82e3b28c485dd963572b7d61f93d8.png' title='(b^2 &amp;#8211; 4ac)' alt='(b^2 &amp;#8211; 4ac)' align=absmiddle> is called the discriminant and determines whether the solution is complex or strictly real. If the discriminant is less than <img src='http://math-blog.com/wp-content/latex/pictures/cfcd208495d565ef66e7dff9f98764da.png' title='0' alt='0' align=absmiddle>, the numerator contains an imaginary component and the roots are, therefore, complex. If the discriminant is greater than or equal to <img src='http://math-blog.com/wp-content/latex/pictures/cfcd208495d565ef66e7dff9f98764da.png' title='0' alt='0' align=absmiddle>, the solutions are real. In fact, if the discriminant is <img src='http://math-blog.com/wp-content/latex/pictures/cfcd208495d565ef66e7dff9f98764da.png' title='0' alt='0' align=absmiddle>, the two roots are real and equal:</p>
<p align="center"><img src='http://math-blog.com/wp-content/latex/pictures/11098b603eb9b58104dc3a7b6a0229d4.png' title='\displaystyle \alpha_{1} = \frac{{ &amp;#8211; b + \sqrt {0} }}{{2a}} = \frac{-b}{2a}' alt='\displaystyle \alpha_{1} = \frac{{ &amp;#8211; b + \sqrt {0} }}{{2a}} = \frac{-b}{2a}' align=absmiddle></p>
<p align="center"><img src='http://math-blog.com/wp-content/latex/pictures/564dc61e8cedca34e66db4b4b756f337.png' title='\displaystyle \alpha_{2} = \frac{{ &amp;#8211; b &amp;#8211; \sqrt {0} }}{{2a}} = \frac{-b}{2a}' alt='\displaystyle \alpha_{2} = \frac{{ &amp;#8211; b &amp;#8211; \sqrt {0} }}{{2a}} = \frac{-b}{2a}' align=absmiddle></p>
<p>In addition to the Quadratic Formula for quadratic equations, analogous formulae exist for polynomials of degree three and four. However, for polynomials of degree five and higher, analytical solutions are not possible (except in special cases), only numerical solutions are possible.</p>
<h3>Numerical Root-finding Techniques</h3>
<p>For the multitude of real-world problems that are not amenable to an analytical solution, numerical root-finding is a well-developed field offering a wide variety of tools from which to choose; many computer programs written for the computation of roots are based on algorithms that make them applicable to the computation of roots of functions in addition to polynomials, and virtually all of them employ an iterative approach that terminates once the desired degree of tolerance has been achieved. For example, the bisection method is a simple and reliable method for computing roots of a function <em>when they are known ahead of time to be real only</em>. The algorithm starts with the assumption that a zero is somewhere on a user-supplied interval [a,b]. In other words, the function value f(a) is of the opposite sign of f(b) – in going from a to b, f either goes from being positive to being negative, or it goes from being negative to being positive. A point, m, in the middle of the interval [a,b] is then selected. The function is evaluated at point m: f(m). If the sign of f(m) is the same as the sign of f(a), the desired zero is not in the interval [a,m]. In this case, the interval is cut in half and the new interval becomes [m,b]. On the other hand, if the sign of f(m) is not the same as the sign of f(a), the desired zero is in the interval [a,m]. In this case, the interval is cut in half and the new interval becomes [a,m]. This process is repeated until either the interval converges to a desired tolerance or a value of f is found that is within an acceptable tolerance, in which case the value of z at this point is the value returned by the program as the root.</p>
<p>In addition to the bisection method, more elegant–and faster converging–techniques are available: the False Position method, Brent’s method, the Newton-Raphson method, the secant method, and others. The Newton-Raphson method uses the function and its derivative to quickly converge to a solution. This method is good for situations in which the derivatives are either known or can be calculated with a low computational cost. In other situations, the cost of computing derivatives may be too high. The secant method, by comparison, does not require the use of derivatives, but the calculation of each iterate requires the use of the <em>two previous iterates</em> and does not converge to a solution as quickly as the Newton-Raphson method. In some situations, this method, too, may be deemed impractical. Usually, when some thought is given to a problem, a particular technique can be applied to it that is more appropriate than another. In fact, for some problems, one technique may fail to find a solution at all, whereas another technique will succeed. For other problems, several techniques may, indeed, be able to solve the problem and the numerical analyst may select the one that is simply more computationally efficient.</p>
<h3>The Jenkins-Traub Algorithm</h3>
<p>The field of numerical root-finding is so well-developed that the use of a good-quality numerical program is recommended &#8212; when numerical results are sought &#8212; even when an analytical solution to a problem is known. In other words, even though an analytical solution to, say, the quartic equation exists, writing a computer program that simply implements the textbook formula is not recommended; computer round-off errors often render results of such programs meaningless. The use of a robust numerical program, based upon sound theory and an excellent algorithm, and coded to thoroughly deal with computer round-off errors, is the recommended action. The Jenkins-Traub Algorithm is such an algorithm; it is a three-stage, extremely effective, globally convergent algorithm designed specifically for computing the roots of polynomials.</p>
<p>Stage One is the “No Shift” stage; the main purpose of this stage is to accentuate the smaller zeros. The search for a zero is started by taking an initial guess of <img src='http://math-blog.com/wp-content/latex/pictures/cfcd208495d565ef66e7dff9f98764da.png' title='0' alt='0' align=absmiddle> for a fixed number, M, of iterations (M is usually assigned the value 5 on the basis of numerical experience<sup>(1)</sup>).</p>
<p>Stage Two is the “Fixed Shift” stage, the purpose of this stage is to separate zeros of equal or almost equal magnitude. As a starting point in this stage, the following value is used:</p>
<p align="center"><img src='http://math-blog.com/wp-content/latex/pictures/a17d4817f819d2516528794f29116712.png' title='\displaystyle s = \beta e^{i\theta}' alt='\displaystyle s = \beta e^{i\theta}' align=absmiddle></p>
<p><img src='http://math-blog.com/wp-content/latex/pictures/b0603860fcffe94e5b8eec59ed813421.png' title='\beta' alt='\beta' align=absmiddle> is a lower bound on the magnitudes of the probable zeros in the cluster. <img src='http://math-blog.com/wp-content/latex/pictures/2554a2bb846cffd697389e5dc8912759.png' title='\theta' alt='\theta' align=absmiddle> could be taken at random, since the cluster could be anywhere in the complex plane; however, in practice <img src='http://math-blog.com/wp-content/latex/pictures/2554a2bb846cffd697389e5dc8912759.png' title='\theta' alt='\theta' align=absmiddle> is usually initialized to 49°, putting s near the middle of the first quadrant of the complex plane. After a certain number of iterations, if s does not converge to a root, s is assigned a new value by increasing <img src='http://math-blog.com/wp-content/latex/pictures/2554a2bb846cffd697389e5dc8912759.png' title='\theta' alt='\theta' align=absmiddle> by 94°. Repeated attempts would have the search for a root start with points in all four quadrants of the complex plane until the search is returned to the first quadrant. Should the search, indeed, return to the first quadrant, successive cycles start at points 16° away from the starting point of the preceding cycle.</p>
<p>Stage Three is the “Variable Shift” stage, which is terminated when the computed value of the polynomial at a possible zero is less than or equal to a specified bound.</p>
<p>In addition to the three fundamental stages around which it was developed, the Jenkins-Traub Algorithm incorporates several other techniques for making it as effective as possible. One of those techniques is deflation of the polynomial by synthetic division each time a root is found. Consider the following monic polynomial:</p>
<p align="center"><img src='http://math-blog.com/wp-content/latex/pictures/d78b69de13e52f23f28ed8ab7dd43b80.png' title='\displaystyle z^n + \bold{a_{n-1}}z^{n-1}+ \bold{a_{n-2}}z^{n-2}+\bold{a_{n-3}}z^{n-3} + \ldots + \bold{a_{1}}z + \bold{a_0} = 0' alt='\displaystyle z^n + \bold{a_{n-1}}z^{n-1}+ \bold{a_{n-2}}z^{n-2}+\bold{a_{n-3}}z^{n-3} + \ldots + \bold{a_{1}}z + \bold{a_0} = 0' align=absmiddle></p>
<p>The <img src='http://math-blog.com/wp-content/latex/pictures/9dc419bbb9a662a4678c1a090acd668c.png' title='\bold{a_i}' alt='\bold{a_i}' align=absmiddle> are known constants and, in general, are complex. Now say the root <img src='http://math-blog.com/wp-content/latex/pictures/e6fd76724530625061d5edb4b37fe257.png' title='z_1' alt='z_1' align=absmiddle> (<img src='http://math-blog.com/wp-content/latex/pictures/b044195a617bae36d2ea389baf6ad1b3.png' title='z_1 = x + iy' alt='z_1 = x + iy' align=absmiddle>) has been found. Synthetic division would be employed to divide that root out of the original polynomial:</p>
<p align="center"><img src='http://math-blog.com/wp-content/latex/pictures/90adf190f9f943d12e34c6cfafebc608.png' title='\displaystyle \frac{z^n + \bold{a_{n-1}}z^{n-1}+ \bold{a_{n-2}}z^{n-2}+\bold{a_{n-3}}z^{n-3} + \ldots + \bold{a_0}}{z-z_1}' alt='\displaystyle \frac{z^n + \bold{a_{n-1}}z^{n-1}+ \bold{a_{n-2}}z^{n-2}+\bold{a_{n-3}}z^{n-3} + \ldots + \bold{a_0}}{z-z_1}' align=absmiddle></p>
<p>to yield</p>
<p align="center"><img src='http://math-blog.com/wp-content/latex/pictures/ebe14e56a45d07eb50e18649cac4a5b0.png' title='\displaystyle \bold{b_{n-1}}z^{n-1}+ \bold{b_{n-2}}z^{n-2}+\bold{a_{b-3}}z^{n-3} + \ldots + \bold{b_0}' alt='\displaystyle \bold{b_{n-1}}z^{n-1}+ \bold{b_{n-2}}z^{n-2}+\bold{a_{b-3}}z^{n-3} + \ldots + \bold{b_0}' align=absmiddle></p>
<p>The <img src='http://math-blog.com/wp-content/latex/pictures/958c9df940865912aa44359f510d0bcb.png' title='\bold{b_i}' alt='\bold{b_i}' align=absmiddle> are new constants. The root-finding process is then repeated on this new–simpler–polynomial. As each root is found, the polynomial becomes successively simpler and each successive iteration of the algorithm involves, in general, fewer computations.</p>
<p>For polynomials whose coefficients are real only, when a complex root is found (<img src='http://math-blog.com/wp-content/latex/pictures/b044195a617bae36d2ea389baf6ad1b3.png' title='z_1 = x + iy' alt='z_1 = x + iy' align=absmiddle>), an additional benefit arises: that root’s complex conjugate is also a root (<img src='http://math-blog.com/wp-content/latex/pictures/6bf0ab67689444dad49d73a309081cd8.png' title='z_2 = x &amp;#8211; iy' alt='z_2 = x &amp;#8211; iy' align=absmiddle>). In other words, two roots are computed &#8212; and the polynomial can be deflated by two degrees &#8212; in a single iteration of the algorithm. Furthermore, this deflation involves real only, rather than complex, operations; the product of these two roots is a real quadratic equation:</p>
<p align="center"><img src='http://math-blog.com/wp-content/latex/pictures/6dfd03f78475370818be38162000298c.png' title='\displaystyle (z-z_1)(z &amp;#8211; z_2) = z^2 &amp;#8211; 2xz + (x^2 + y^2)' alt='\displaystyle (z-z_1)(z &amp;#8211; z_2) = z^2 &amp;#8211; 2xz + (x^2 + y^2)' align=absmiddle></p>
<p>In this case, synthetic division is employed on the polynomial as follows:</p>
<p align="center"><img src='http://math-blog.com/wp-content/latex/pictures/90b918315bc65445b66052e03352413f.png' title='\displaystyle \frac{z^n + \bold{a_{n-1}}z^{n-1}+ \bold{a_{n-2}}z^{n-2}+\bold{a_{n-3}}z^{n-3} + \ldots + \bold{a_0}}{z^2 &amp;#8211; 2xz + (x^2 + y^2)}' alt='\displaystyle \frac{z^n + \bold{a_{n-1}}z^{n-1}+ \bold{a_{n-2}}z^{n-2}+\bold{a_{n-3}}z^{n-3} + \ldots + \bold{a_0}}{z^2 &amp;#8211; 2xz + (x^2 + y^2)}' align=absmiddle></p>
<p>In fact, for computing roots of polynomials which have only real coefficients, a modified version of the Jenkins-Traub Algorithm has been written which incorporates several features that take advantage of the characteristics of real-only polynomials to yield significant decreases in program execution time; “If the complex and real algorithms are applied to the same real polynomial, the real algorithm is about four times as fast.”<sup>(4)</sup> </p>
<p>The Jenkins-Traub Algorithm not only deflates the polynomial as roots are computed, it computes the roots roughly in order of increasing magnitude. This approach is taken because deflation of a polynomial can be unstable unless done by factors in order of increasing magnitude. By starting the search for roots with an initial guess of <img src='http://math-blog.com/wp-content/latex/pictures/cfcd208495d565ef66e7dff9f98764da.png' title='0' alt='0' align=absmiddle>, as is done in Stage One, roots are, indeed, computed roughly in order of increasing magnitude, the factors by which the polynomial is successively deflated are roughly in order of increasing magnitude &#8212; the deflation of the polynomial is made quite stable.</p>
<p>As a quick check of the effectiveness of the Jenkins-Traub Algorithm, consider a contrived numerical example:</p>
<p align="center"><img src='http://math-blog.com/wp-content/latex/pictures/ccb185ab0562e4fedfd871097ff2e89f.png' title='\displaystyle f(z) = (z &amp;#8211; 1.001)(z &amp;#8211; 0.998)(z &amp;#8211; 1.00002)(z &amp;#8211; 0.99999)' alt='\displaystyle f(z) = (z &amp;#8211; 1.001)(z &amp;#8211; 0.998)(z &amp;#8211; 1.00002)(z &amp;#8211; 0.99999)' align=absmiddle></p>
<p>The roots of this polynomial are very close and should test how effectively the algorithm discerns near-multiple roots:</p>
<p align="center">1.001<br /> 0.998<br /> 1.00002<br /> 0.99999</p>
<p>In addition, the polynomial is real-only so that readers may confirm the results with a free, ready-to-use, online Javascript program (URL given below).</p>
<p>Expanded, the test polynomial becomes</p>
<p align="center"><img src='http://math-blog.com/wp-content/latex/pictures/0e6ab8ff4166250a1de4d9a74ed7a00d.png' title='\displaystyle \displaystyle z^{4} &amp;#8211; 3.99901z^{3} + 5.9970279898z^{2} &amp;#8211; 3.9970259795802z +   ' alt='\displaystyle \displaystyle z^{4} &amp;#8211; 3.99901z^{3} + 5.9970279898z^{2} &amp;#8211; 3.9970259795802z +   ' align=absmiddle> <img src='http://math-blog.com/wp-content/latex/pictures/4286687d3ee45b514f43572025d3ff3d.png' title='0.9990079897802004' alt='0.9990079897802004' align=absmiddle></p>
<p>and the solutions computed by the Javascript root-finder follow:</p>
<p align="center">0.9980051486669109<br /> 0.9998618452719573<br /> 1.0001539207016332<br /> 1.0009890853594987</p>
<p>The program, in fact, did a very good job:
<ol>
<li>no errors were returned,</li>
<li>no erroneous imaginary components were found,</li>
<li>four distinct roots were computed, and</li>
<li>the computed roots are extremely close to the exact roots (round-off errors are unavoidable).</li>
</ol>
<h3>Conclusion</h3>
<p>Since its introduction in 1969 (in Michael Jenkins’ PhD thesis) the Jenkins-Traub Algorithm has been rigorously tested and has proven itself as an excellent algorithm for the computation of the roots of polynomials. It is extremely robust, is globally convergent for any distribution of zeros, and converges at a better than quadratic rate. Attesting to its high quality is the fact that source code for programs (written in FORTRAN) based on the algorithm have been posted on the NETLIB site, a repository of high-quality numerical programs; the complex coefficient version is posted as CPOLY (<a href="http://www.netlib.org/toms/419">http://www.netlib.org/toms/419</a>) and a real coefficient only version has been posted as RPOLY (<a href="http://www.netlib.org/toms/493">http://www.netlib.org/toms/493</a>). Translations into C++ and Javascript are also available; for example, Polynomial Root-finder (<a href="http://www.akiti.ca/PolyRootRe.html">http://www.akiti.ca/PolyRootRe.html</a>) is a Javascript translation of RPOLY and has been successfully tested with data published in Jenkins’ PhD thesis. In addition, the algorithm is incorporated in commercial software products (i.e. Mathematica). The proven effectiveness of the Jenkins-Traub Algorithm and its wide-spread distribution make it an extremely important tool in the toolbox of numerical analysts.</p>
<h3>References</h3>
<ol>
<li><a href="http://www.amazon.com/gp/product/048641454X?ie=UTF8&amp;tag=antoniocangia-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=048641454X">&#8220;A First Course in Numerical Analysis: Second Edition&#8221;</a><img src="http://www.assoc-amazon.com/e/ir?t=antoniocangia-20&amp;l=as2&amp;o=1&amp;a=048641454X" width="1" height="1" border="0" alt="" /><br /> Anthony Ralston and Philip Rabinowitz<br /> McGraw-Hill Book Company<br /> New York<br /> 1978</li>
<li> “Numerical Methods and Software”<br /> David Kahaner, Cleve Moler, Stephen Nash<br /> Prentice-Hall, Inc.<br /> Englewood Cliffs, New Jersey<br /> 1989 </li>
<li> “Numerical Recipes. The Art of Scientific Computing.”<br /> William H. Press, Brian P. Flannery, Saul A. Teukolsky, and William T. Vetterling<br /> Cambridge University Press<br /> New York<br /> 1986<br />(<a href="http://www.amazon.com/gp/product/0521880688?ie=UTF8&amp;tag=antoniocangia-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=0521880688">3rd edition now available.</a><img src="http://www.assoc-amazon.com/e/ir?t=antoniocangia-20&amp;l=as2&amp;o=1&amp;a=0521880688" width="1" height="1" border="0" alt="" />)</li>
<li>Wikipedia<br /> <a href="http://en.wikipedia.org/wiki/Jenkins-Traub_Algorithm_for_Polynomial_Zeros">Jenkins-Traub Algorithm for Polynomial Zeros</a></li>
<li>Jenkins, M.A. Three-stage variable-shift iterations for the solution of polynomial equations with a posteriori error bounds for the zeros. Diss., Rep. CS 138, Comput. Sci.<br /> Dep., Stanford U., Stanford, Cal., 1969.</li>
</ol>
<p><em>This article was written by David Binner. You can visit his math site at <a href="http://akiti.ca/">http://akiti.ca</a>. If you&#8217;d like to <a href="http://math-blog.com/write-for-us/">write for Math-Blog.com</a>, please email us at <img src='http://math-blog.com/wp-content/latex/pictures/f5af898ddd3b6c56e859cf0444db773c.png' title='submissions@math-blog.com' alt='submissions@math-blog.com' align=absmiddle>.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://math-blog.com/2008/03/06/polynomial-root-finding-with-the-jenkins-traub-algorithm/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
