<?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>Wolfram Blog</title>
	<atom:link href="http://blog.wolfram.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.wolfram.com</link>
	<description>News, views, &#38; ideas from the front lines at Wolfram Research</description>
	<lastBuildDate>Wed, 16 May 2012 17:45:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Mathematica Experts Live: Visualization Q&amp;A 2012</title>
		<link>http://blog.wolfram.com/2012/05/16/mathematica-experts-live-visualization-qa-2012/</link>
		<comments>http://blog.wolfram.com/2012/05/16/mathematica-experts-live-visualization-qa-2012/#comments</comments>
		<pubDate>Wed, 16 May 2012 16:48:11 +0000</pubDate>
		<dc:creator>Wolfram Blog Team</dc:creator>
				<category><![CDATA[Wolfram News]]></category>

		<guid isPermaLink="false">http://blog.internal.wolfram.com/?p=10467</guid>
		<description><![CDATA[For the first time, we&#8217;re holding a virtual event in a new talk-show format. We&#8217;ll put Mathematica experts live on camera to answer your questions about visualization. Our host will accept questions in real time and pass them to three of our graphics experts. You can also submit your question when you register for the [...]]]></description>
			<content:encoded><![CDATA[<p>For the first time, we&#8217;re holding a <a href="http://www.wolfram.com/training/special-event/mathematica-experts-live-visualization-2012/">virtual event</a> in a new talk-show format. We&#8217;ll put <a href="http://www.wolfram.com/mathematica" target="_self"><em>Mathematica</em></a> experts live on camera to answer your questions about visualization.</p>
<p>Our host will accept questions in real time and pass them to three of our graphics experts. You can also submit your question when you register for the event.</p>
<p>We will be prepared to address questions on graphics and visualizations, similar to these:</p>
<ul>
<li>How can I add a drop shadow to my plot?</li>
<li>How can I independently color different sides of a surface?</li>
<li>How can I turn several locators on and off on a graphic with a mouse click?</li>
<li>How can I make an <em>x</em>-<em>y</em> scatter plot with auxiliary histograms placed next to the <em>x</em>-<em>y</em> axes?</li>
<li>How can I create an intertwined graphic like the one below?</li>
</ul>
<p>The virtual event will be held Tuesday, May 22, from 11am to noon Eastern Daylight Time (EDT).<span id="more-10467"></span></p>
<p>Virtual seats are limited—see the <a href="http://www.wolfram.com/training/special-event/mathematica-experts-live-visualization-2012/">event schedule</a> and <a href="http://www.wolfram.com/training/special-event/mathematica-experts-live-visualization-2012/register.cgi">register</a> today!</p>
<p><script type="text/javascript" src="http://demonstrations.wolfram.com/javascript/embed.js" ></script><script type="text/javascript" id="DEMO_ParityEntangledLinks">var demoObj = new DEMOEMBED(); demoObj.run("ParityEntangledLinks", "", "479", "405");</script>
<div>&#8220;<a class="demonstrationHyperlink" href="http://demonstrations.wolfram.com/ParityEntangledLinks/" target="_blank">Parity Entangled Links</a>&#8221; from the <a class="demonstrationHyperlink" href="http://demonstrations.wolfram.com/" target="_blank">Wolfram Demonstrations Project</a> by Michael Schreiber</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.wolfram.com/2012/05/16/mathematica-experts-live-visualization-qa-2012/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Announcing Wolfram Finance Platform</title>
		<link>http://blog.wolfram.com/2012/05/15/announcing-wolfram-finance-platform/</link>
		<comments>http://blog.wolfram.com/2012/05/15/announcing-wolfram-finance-platform/#comments</comments>
		<pubDate>Tue, 15 May 2012 21:42:22 +0000</pubDate>
		<dc:creator>Jon McLoone</dc:creator>
				<category><![CDATA[Finance]]></category>

		<guid isPermaLink="false">http://blog.internal.wolfram.com/?p=10439</guid>
		<description><![CDATA[One key project for me recently has been the new Wolfram Finance Platform, which I am pleased to announce today. This is a major new initiative for us to create the ultimate computation environment for finance. It builds on our existing computational technology with extra capabilities and professional support services. As part of this, I [...]]]></description>
			<content:encoded><![CDATA[<p>One key project for me recently has been the new <a href="http://www.wolfram.com/finance-platform/" target="_self">Wolfram <i>Finance Platform</i></a>, which I am pleased to <a href="http://www.wolfram.com/news/wolfram-finance-platform-released.html" target="_self">announce today</a>.</p>
<p>This is a major new initiative for us to create the ultimate computation environment for finance. It builds on our existing computational technology with extra capabilities and professional support services.</p>
<p><a href="http://www.wolfram.com/finance-platform/"><img src="http://blog.wolfram.com/data/uploads/2012/05/blog_02.png" alt="Wolfram Finance Platform—Ultimate Computation Environment: Now for Finance" title="Wolfram Finance Platform—Ultimate Computation Environment: Now for Finance" width="526" height="63" style="border:0px" class="aligncenter size-full wp-image-10463" /></a></p>
<p>As part of this, I spent some time interviewing finance customers in the city of London about what they liked and didn&#8217;t like about <a href="http://www.wolfram.com/mathematica" target="_self"><em>Mathematica</em></a>, what they wanted, and why some of their colleagues didn&#8217;t use it.<span id="more-10439"></span></p>
<p>It turned out to be an exercise in staying open-minded and listening—because while we are naturally most excited about all the great computation that we provide (including <a href="http://www.wolfram.com/mathematica/new-in-8/built-in-financial-computations/" target="_self">&#8220;finance&#8221; functionality</a>), time and again the issues that mattered were the less glamorous workflow improvements.</p>
<p>We have been focused on improving workflows more generally, for example supporting great <a href="http://www.wolfram.com/mathematica/new-in-8/parameter-estimation-and-testing/" target="_self">data analysis</a>, <a href="http://www.wolfram.com/mathematica/new-in-8/parametric-probability-distributions/" target="_self">statistics</a>, and <a href="http://www.wolfram.com/mathematica/new-in-8/financial-visualization/" target="_self">visualization</a> with highly automated <a href="http://www.wolfram.com/mathematica/new-in-8/import-and-export-formats/" target="_self">import and export</a> and <a href="http://www.wolfram.com/cdf/" target="_self">reporting</a>. The flow from data to analysis to <a href="http://www.wolfram.com/cdf">CDF</a> report is now a smooth process.</p>
<p>But looking at the specific needs of one industry segment reveals further optimizations. The new <a href="http://www.wolfram.com/finance-platform/features/real-time-data.html" target="_self">Bloomberg feed link</a> is one such example. Being able to flow live, trading quality data directly into a computation or to create a CDF where the charts update with the market has now become trivial because we took that extra step to make the connection seamless. </p>
<p>Applying one of our our <a href="http://www.wolfram.com/finance-platform/compare-wolfram-finance-platform/" target="_self">core principles</a>—to automate as much as possible—makes this feature particularly powerful. The link includes a <a href="http://www.wolfram.com/broadcast/screencasts/BloombergLink/bloomberglink-intro-3.html" target="_self">parameter discovery interface</a> that automatically generates API code. This means that, armed with a new trading idea, you can prototype fast with our analysis capabilities and just paste in the generated code to call to the live data, and you can be ready to trade your new idea in minutes. Feed that into some of the built-in visualizations, and you can have a live CDF-powered dashboard to watch in just a few more minutes. One message I have been hearing repeatedly is that this kind of &#8220;algorithmic agility&#8221; is a key competitive advantage in finance.</p>
<p>Check out the new <a href="http://www.wolfram.com/finance-platform/" target="_self">Wolfram <i>Finance Platform</i></a>, and watch this space for further improvements to both finance functionality and other optimized workflows that are in Wolfram <i>Finance Platform</i>&#8216;s development pipeline.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.wolfram.com/2012/05/15/announcing-wolfram-finance-platform/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Looking to the Future of A New Kind of Science</title>
		<link>http://blog.wolfram.com/2012/05/14/looking-to-the-future-of-a-new-kind-of-science/</link>
		<comments>http://blog.wolfram.com/2012/05/14/looking-to-the-future-of-a-new-kind-of-science/#comments</comments>
		<pubDate>Mon, 14 May 2012 15:45:10 +0000</pubDate>
		<dc:creator>Stephen Wolfram</dc:creator>
				<category><![CDATA[Wolfram News]]></category>

		<guid isPermaLink="false">http://blog.internal.wolfram.com/?p=10448</guid>
		<description><![CDATA[(This is the third in a series of posts about A New Kind of Science. Previous posts have covered the original reaction to the book and what&#8217;s happened since it was published.) Today ten years have passed since A New Kind of Science (&#8220;the NKS book&#8221;) was published. But in many ways the development that started with [...]]]></description>
			<content:encoded><![CDATA[<p><em>(This is the third in a series of posts about <a href="http://www.wolframscience.com/" target="_self">A New Kind of Science</a>. Previous posts have covered the <a href="http://blog.stephenwolfram.com/2012/05/living-a-paradigm-shift-looking-back-on-reactions-to-a-new-kind-of-science/">original reaction</a> to the book and <a href="http://blog.stephenwolfram.com/2012/05/its-been-10-years-whats-happened-with-a-new-kind-of-science/">what&#8217;s happened</a> since it was published.)</em></p>
<p>Today ten years have passed since <a href="http://www.wolframscience.com/nksonline/toc.html" target="_self"><em>A New Kind of Science</em></a> (&#8220;the NKS book&#8221;) was published. But in many ways the development that started with the book is still only just beginning. And over the next several decades I think its effects will inexorably become ever more obvious and important.</p>
<p>Indeed, even at an everyday level I expect that in time there will be all sorts of visible reminders of NKS all around us. Today we are continually exposed to technology and engineering that is directly descended from the development of the mathematical approach to science that began in earnest three centuries ago. Sometime hence I believe a large portion of our technology will instead come from NKS ideas. It will not be created incrementally from components whose behavior we can analyze with traditional mathematics and related methods. Rather it will in effect be &#8220;mined&#8221; by searching the abstract computational universe of possible simple programs.</p>
<p>And even at a visual level this will have obvious consequences. For today&#8217;s technological systems tend to be full of simple geometrical shapes (like beams and boxes) and simple patterns of behavior that we can readily understand and analyze. But when our technology comes from NKS and from mining the computational universe there will not be such obvious simplicity. Instead, even though the underlying rules will often be quite simple, the overall behavior that we see will often be in a sense irreducibly complex.</p>
<p>So as one small indication of what is to come&#8212;and as part of celebrating the first decade of <em>A New Kind of Science</em>&#8212;starting today, when <a href="http://www.wolframalpha.com" target="_self">Wolfram|Alpha</a> is computing, it will no longer display a simple rotating geometric shape, but will instead run a simple program (currently, a <a href="http://www.wolframscience.com/nksonline/section-5.2">2D cellular automaton</a>) from the computational universe found by searching for a system with the right kind of visually engaging behavior.</p>
<p><a href="http://www.wolframalpha.com/"><img src="http://blog.stephenwolfram.com/data/uploads/2012/05/latency-final.png" alt="What is the fundamental theory of physics?" title="What is the fundamental theory of physics?" width="501" height="226" style="border:0px" class="aligncenter size-full wp-image-3597" /></a><br />
<span id="more-10448"></span><br />
This doesn&#8217;t look like the typical output of an engineering design process. There&#8217;s something much more &#8220;organic&#8221; and &#8220;natural&#8221; about it. And in a sense this is a direct example of what launched my work on <em>A New Kind of Science</em> three decades ago. The traditional mathematical approach to science has had great success in letting us understand systems in nature and elsewhere whose behavior shows a certain regularity and simplicity. But I was interested in finding ways to model the many kinds of systems that we see throughout the natural world whose behavior is much more complex.</p>
<p>And my <a href="http://www.wolframscience.com/nksonline/section-1.1">key realization</a> was that the computational universe of simple programs (such as cellular automata) provides an immensely rich source for such modeling. Traditional intuition would have led us to think that simple programs would always somehow have simple behavior. But my first crucial discovery was that this is not the case, and that in fact even remarkably simple programs can produce extremely complex behavior&#8212;that reproduces all sorts of phenomena we see in nature.</p>
<p><img src="http://blog.stephenwolfram.com/data/uploads/2012/05/1635.png" alt="Rule 1635" title="Rule 1635" width="505" height="252" style="border:0px" class="aligncenter size-full wp-image-3596" /></p>
<p>And it was from this beginning&#8212;over the course of nearly 20 years&#8212;that I developed the ideas and results in <em>A New Kind of Science</em>. The book focused on studying the abstract science of the computational universe&#8212;its phenomena and principles&#8212;and showing how this helps us make progress on a whole variety of problems in science. But from the foundations laid down in the book much else can be built&#8212;not least a new kind of technology.</p>
<p>This is already off to a <a href="http://blog.stephenwolfram.com/2012/05/its-been-10-years-whats-happened-with-a-new-kind-of-science/">good start</a>, and over the next decade or two I expect dramatic progress in the application of NKS to all sorts of technology. In a typical case, one will start from some objective one wants to achieve. Then, either through knowledge of the basic science of the computational universe, or by some kind of explicit search, one will find a system that achieves this objective&#8212;often in ways no human would ever imagine or come up with. We have done this countless times over the years for algorithms used in <a href="http://www.wolfram.com/mathematica" target="_self"><em>Mathematica</em></a> and Wolfram|Alpha. But the same approach applies not just to programs implemented in software, but also to all kinds of other structures and processes.</p>
<p>Today our technological world is full of periodic patterns and other simple forms. But rarely will these ultimately be the best ways to achieve the objectives for which they are intended. And with NKS, by mining the computational universe, we have access to a much broader set of possibilities&#8212;which to us will typically look much more complex and perhaps random.</p>
<p>How does this relate to the kinds of patterns and forms that we see in nature? One of the discoveries of NKS is that nature samples a broader swath of the computational universe than we reach with typical methods of mathematics or engineering. But it too is limited, whether because natural selection tends to favor incremental change, or because some physical process just follows one particular rule. But when we create technology, we are free to sample the whole computational universe&#8212;so in a sense we can greatly generalize the mechanisms that nature uses.</p>
<p>Some of the consequences of this will be readily visible in the actual forms of technological objects we use. But many more will involve internal structures and processes. And here we will often see the consequences of a central discovery of NKS: the <a href="http://www.wolframscience.com/nksonline/chapter-12">Principle of Computational Equivalence</a>&#8212;which implies that even when the underlying rules or components of a system are simple, the behavior of the system can correspond to a computation that is essentially as sophisticated as anything. And one thing this means is that a huge range of systems are capable in effect not just of acting in one particular way, but of being programmed to act in almost arbitrary ways.</p>
<p>Today most mechanical systems we have are built for quite specific purposes. But in the future I have no doubt that with NKS approaches, it will for instance become common to see arbitrarily &#8220;programmable&#8221; mechanical systems. One example I expect will be modular robots consisting of large numbers of fairly simple and probably identical elements, in which almost any mechanical action can be achieved by an appropriate sequence of small-scale motions, typically combined in ways that were found by mining the computational universe.</p>
<p>Similar things will happen at a molecular level too. For example, today we tend to have bulk materials that are either perfect periodic crystals, or have atoms arranged in a random amorphous way. NKS implies that there can also be &#8220;computational materials&#8221; that are grown by simple underlying rules, but which end up with much more elaborate patterns of atoms&#8212;with all sorts of bizarre and potentially extremely useful properties.</p>
<p>When it comes to computing, we might think that to have a system at a molecular scale act as a computer we would need to find microscopic analogs of all the usual elements that exist in today&#8217;s electronic computers. But what NKS shows us is that in fact there can be much simpler elements&#8212;more readily achievable with molecules&#8212;that nevertheless support computation, and for which the effort of compiling from current traditional forms of computation is not even too great.</p>
<p>An important application of these kinds of ideas is in medicine. Biology is essentially the only existing example where something akin to molecular-scale computation already occurs. But existing drugs tend to operate only in very simple ways, for example just binding to a fixed molecular target. But with NKS methods one can expect instead to create &#8220;algorithmic drugs&#8221;, that in effect do a computation to determine how they should act&#8212;and can also be programmable for different cases.</p>
<p>NKS will also no doubt be important in figuring out how to set up synthetic biological organisms. Many processes in existing organisms are probably best understood in terms of simple programs and NKS ideas. And when it comes to creating new biological mechanisms, NKS methods are the obvious way to take underlying molecular biology and find schemes for building sophisticated functionality on the basis of it.</p>
<p>Biology gives us ways to create particular kinds of molecular structures, like proteins. But I suspect that with NKS methods it will finally be possible to build an essentially universal constructor, that can in effect be programmed to make an almost arbitrary structure out of atoms. The form of this universal constructor will no doubt be found by searching the computational universe&#8212;and its operation will likely be nothing close to anything one would recognize from traditional engineering practice.</p>
<p>An important feature of NKS methods is that they dramatically change the economics of invention and creativity. In the past, to create or invent something new and original has always required explicit human effort. But now the computational universe in effect gives us an inexhaustible supply of new, original, material. And one consequence of this is that it makes all sorts of mass customization broadly feasible.</p>
<p>There are many immediate examples of this in art. <a href="http://tones.wolfram.com/">Wolfram<em>Tones</em></a> did it for simple musical pieces. One can also do it for all sorts of visual patterns&#8212;perhaps ever changing, and selected from the computational universe and then grown to fit into particular spatial or other constraints. And then there is architecture. Where one can expect to discover in the computational universe new forms that can be used to create all sorts of structures. And indeed in the future I would not be surprised if at first the most visually obvious everyday examples of NKS were forms of things like buildings, their dynamics, decoration and structure.</p>
<p>Mass production and the legacy of the industrial revolution have led to a certain obvious orderliness to our world today&#8212;with many copies of identical products, precisely repeating processes, and so on. And while this is a convenient way to set things up if one must be guided by traditional mathematics and the like, NKS suggests that things could be much richer. Instead of just carrying out some processes in a precisely repeating way, one computes what to do in each case. And putting together many such pieces of computation the behavior of the system as a whole can be highly complex. And finding the correct rules for each element&#8212;to achieve some set of overall objectives&#8212;is no doubt best done by studying and searching the computational universe of possibilities.</p>
<p>Viewed from the outside, some of the best evidence for the presence of our civilization on Earth comes from the regularities that we have created (straight roads, things happening at definite times, radio carrier signals, satellite orbits, and so on). But in the future, with the help of NKS methods, more and more of these regularities will be optimized out. Vehicles will move in optimized patterns, radio signals will be transferred in complicated sequences of local hops… and even though the underlying rules may be simple, the actual behavior that is seen will look highly complex&#8212;and much more like all sorts of systems in physics and elsewhere that we already see in nature.</p>
<p>There are other&#8212;more abstract&#8212;situations where computation and NKS ideas will no doubt become increasingly important. One example is in commerce. Already there is an increasing trend toward algorithmic pricing. Increasingly commercial terms and contracts of all kinds will be stated in computational terms. And then&#8212;a little like a market of algorithmic traders&#8212;there will be what amounts to an NKS issue of what the overall consequences of many separate transactions will be. And again, finding the appropriate rules for these underlying transactions will involve understanding and searching the computational universe&#8212;and presumably various kinds of mass customization, that eventually make concepts like money as a simple numerical quantity quite obsolete.</p>
<p>Future schemes for such things as auctions and voting may also perhaps be mined from the computational universe, and as a result may be mass customized on demand. And, more speculatively, the same might be true for future corporate or political organizational structures. Or for example for mechanisms for social and other human networks.</p>
<p>In addition to using NKS in &#8220;technology mode&#8221; as a way to create things, one can also use NKS in &#8220;science mode&#8221; as a way to model and understand things. And typically the goal is to find in the computational universe some simple program whose behavior captures the essence of whatever system or phenomenon one is trying to analyze. This was an important focus of the NKS book, and has been a major theme in the past decade of NKS research. In general in science it has been difficult to come up with new models for things. But the computational universe is an unprecedentedly rich source&#8212;and I would expect that before long the rate of new models derived from it will come to far exceed all those from traditional mathematical and other sources.</p>
<p>An important trend in today&#8217;s world is the availability of more and more data, often collected with automated sensors, or in some otherwise automated way. Often&#8212;as we see in many areas of Wolfram|Alpha or in experiments on personal analytics&#8212;there are tantalizing regularities in the data. But the challenge that now exists is to find good models for the data. Sometimes these models are important for basic science; more often they are important for practical purposes of prediction, anomaly detection, pattern matching and so on.</p>
<p>In the past, one might find a model from data by using statistics or machine learning in effect to fit parameters of some formula or algorithm. But NKS suggests that instead one should try to find in the computational universe some set of underlying rules that can be run to simulate the essence of whatever generates the data. At present, the methods we have for finding models in the computational universe are still fairly ad hoc. But in time it will no doubt be possible to streamline this process, and to develop some kind of highly systematic methodology&#8212;a rough analog of the historical progression from calculus to statistics.</p>
<p>There are many areas where it is clear that NKS models will be important&#8212;perhaps because the phenomenon being modeled is too complex for traditional approaches, or perhaps because, as is becoming so common in practice, the underlying system has elements that are specifically set up to be computational.</p>
<p>One area where NKS models seem likely to be particularly important is medicine. In the past, most disorders that medicine successfully addressed were fundamentally either structural or chemical. But today&#8217;s most important challenge areas&#8212;like aging, cancer, immune response and brain functioning&#8212;all seem to be associated more with large-scale systems containing many interacting parts. And it certainly seems plausible that the best models for these systems will be based on simple programs that exist in the computational universe.</p>
<p>In recent times, medicine has slowly been becoming more quantitative. But somehow it is still always based on small collections of numbers, that lead to a small set of possible diagnoses. But between the coming wave of automated data acquisition, and the use of underlying NKS models, I suspect that the future of medicine will be more about dynamic computation than about specific discrete diagnoses. But even given a good predictive model of what is going on in a particular medical situation, it will still often be a challenge to figure out just what intervention to make&#8212;though the character of this problem will no doubt change when algorithmic drugs and computational materials exist.</p>
<p>What would be the most spectacular success for NKS models? Perhaps models that lead to an understanding of aging, or cancer. Perhaps more accurate models for social or economic processes. Or perhaps a final fundamental theory of physics.</p>
<p>In the NKS book, I <a href="http://www.wolframscience.com/nksonline/chapter-9">started looking</a> at what might be involved in finding the underlying rules for our physical universe out in the computational universe. I developed some network-based models that operate in a sense below space and time, and from which I was already able to derive some surprisingly interesting features of physics as we know it. Of course, we have no guarantee that our physical universe has rules that are simple enough to be found, say, by an explicit search in the computational universe. But over the past decade I have slowly been building up the rather large software and analysis capabilities necessary to mount a <a href="http://blog.wolfram.com/2007/09/11/my-hobby-hunting-for-our-universe/">serious search</a>. And if successful, this will certainly be an important piece of validation for the NKS approach&#8212;as well as being an important moment for science in general.</p>
<p>Beyond science and technology, another important consequence of a new worldview like NKS is the effect that it can have on everyday thinking. And certainly the mathematical approach to science has had a profound effect on how we think about all kinds of issues and processes. For today, whether we&#8217;re talking about business or psychology or journalism, we end up using words and ideas&#8212;like &#8220;momentum&#8221; and &#8220;exponential&#8221;&#8212;that come directly from this approach. Already there are analogs from NKS that are increasingly used&#8212;like &#8220;computationally irreducible&#8221; and &#8220;intrinsically random&#8221;. And as such concepts become more widespread they will inform thinking about more and more things&#8212;whether it&#8217;s describing the operation of an organization, or working out what could conceivably be predictable for purposes of liability.</p>
<p>Beyond everyday thinking, the ideas and results of NKS will also no doubt have increasing influence on many areas of <a href="http://blog.stephenwolfram.com/2011/05/talking-about-computing-and-philosophy/">philosophical thinking</a>. In the past, most of the understanding for what science could contribute to philosophy came from the mathematical approach to science. But now the new concepts and results in NKS in a sense provide a large number of new &#8220;raw facts&#8221; from which philosophy can operate.</p>
<p>The principles of NKS are important not only at an intellectual level, but also at a practical level. For they give us ideas about what might be possible, and what might not. For example, the Principle of Computational Equivalence in effect implies that there can be nothing general and abstract that is special about intelligence, and that in effect all its features must just be reflections of computation. And it is this that made me realize soon after the NKS book appeared that my long-term goal of making knowledge broadly computable might be achievable &#8220;just with computation&#8221;&#8212;which is what led me to embark on the Wolfram|Alpha project.</p>
<p>I have talked elsewhere about some of the consequences of the principles of NKS for the long-range <a href="http://www.stephenwolfram.com/publications/recent/hplus2010/">future of the human condition</a>. But suffice it to say here that we can expect an increasing delegation of human intellectual activities to computational systems&#8212;but with ultimate purposes still of necessity defined by humans and the history of human culture and civilization. And perhaps the place where NKS principles will enter most explicitly is in making future legal and other distinctions about what really constitutes responsibility, or a mind, or a memory as opposed to a computation.</p>
<p>As we look at the <a href="http://blog.stephenwolfram.com/2011/10/imagining-the-future-with-a-new-kind-of-science/" target="_self">future of history</a>, there are some inexorable trends, and then there are some wild cards. If we find the fundamental theory of physics, will we be able to hack it to achieve something like instantaneous travel? Will we find some key principle that lets us reverse aging? Will we be able to map memories directly from one brain to another, without the intermediate step of language? Will we find <a href="http://www.wolframscience.com/nksonline/section-12.10" target="_self">extraterrestrial intelligence</a>? About all these questions, NKS has much to say.</p>
<p>If we look back at the mathematical approach to science, one of its societal consequences has been the injection of mathematics into education. To some extent, a knowledge of mathematical principles is necessary to interact with the world as it exists today. It is also an important foundation for understanding fields that have made serious use of the mathematical approach to science. And certainly learning mathematics to at least some level is a convenient way to teach precise structured thinking in general.</p>
<p>But I believe NKS also has much to contribute to education. At an elementary level, it can be viewed as a kind of &#8220;pre-computer science&#8221;, introducing fundamental notions of computation in a direct and often visual way. At a more sophisticated level, NKS provides a conceptual framework for understanding the foundations of many computational fields. And even from what I have seen over the <a href="http://www.wolframscience.com/summerschool/" target="_self">past decade</a>, education about NKS&#8212;a little like physics before it&#8212;seems to provide a powerful springboard for people entering all sorts of modern areas.</p>
<p>What about NKS research? There is much to be done in the many applications of NKS. But there is also much to be done in pure NKS&#8212;studying the basic science of the computational universe. The NKS book&#8212;and the decade of research that has followed it&#8212;has only just begun to scratch the surface in exploring and investigating the vast range of possible simple programs. The situation is in some ways a little like in chemistry&#8212;where there are an infinite variety of possible chemical compounds each with their own features, that can be studied either for their own sake, or for the purpose of inferring general principles, or for diverse potential applications. And where even after a century or more, only a small part of what is possible has been done.</p>
<p>In the computational universe it is quite remarkable how much can be said about almost any simple program with nontrivial behavior. And the more one knows about a given program, the more potential there is to find interesting applications of it, whether for modeling, technology, art or whatever. Sometimes there are features of programs that can be almost arbitrarily difficult to determine. But sometimes they can be important. And so, for example, it will be important to get <a href="http://www.wolframscience.com/prizes/tm23/" target="_self">more evidence</a> for (or against) the <a href="http://www.wolframscience.com/nksonline/chapter-12" target="_self">Principle of Computational Equivalence</a> by trying to establish <a href="http://www.wolframscience.com/nksonline/chapter-11" target="_self">computation universality</a> for a variety of simple programs (rule 30 would be a particularly important achievement).</p>
<p>As more is done in pure NKS, so its methodologies will become more streamlined. And for example there will be ever clearer principles and conventions for what constitutes a good computer experiment, and how the results of investigations on simple programs should be communicated. There are fields other than NKS&#8212;notably mathematics&#8212;where computer experiments also make sense. But my guess is that the kind of exploratory computer experimentation that is a hallmark of pure NKS will always end up largely classified as pure NKS, even if its subject matter is quite mathematical.</p>
<p>If one looks at the future of NKS research, an important issue is how it is structured in the world. Some part of it&#8212;like for mathematics&#8212;may be driven by education. Some part may be driven by applications, and their commercial success. But in the long term just how the pure basic science of NKS should be conducted is not yet clear. Should there be <a href="http://www.wolframscience.com/prizes/tm23/" target="_self">prizes</a>? <a href="http://www.wolframscience.com/summerschool/" target="_self">Institutions</a>? Socially oriented value systems? As a young field NKS has the potential to take some novel approaches.</p>
<p>For an intellectual framework of the magnitude of NKS, a decade is a very short time. And as I write this post, I realize anew just how great the potential of NKS is. I am proud of the part I played in launching NKS, and I look forward to watching and participating in its progress for many years to come.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.wolfram.com/2012/05/14/looking-to-the-future-of-a-new-kind-of-science/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>One Year of Daily Tips from @MathematicaTip</title>
		<link>http://blog.wolfram.com/2012/05/07/one-year-of-daily-tips-from-mathematicatip/</link>
		<comments>http://blog.wolfram.com/2012/05/07/one-year-of-daily-tips-from-mathematicatip/#comments</comments>
		<pubDate>Mon, 07 May 2012 18:01:05 +0000</pubDate>
		<dc:creator>Wolfram Blog Team</dc:creator>
				<category><![CDATA[Mathematica News]]></category>

		<guid isPermaLink="false">http://blog.internal.wolfram.com/?p=10380</guid>
		<description><![CDATA[It&#8217;s been one year since we launched our Twitter feed for bite-sized Mathematica hints and tips! Thousands of people follow @MathematicaTip to get a new tip every day, Monday through Friday, covering everything from keyboard shortcuts: Instead of using % to refer to the most recent output, try Ctrl+Shift+L (Mac: Cmd+Shift+L) to directly insert the [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been one year since we launched our Twitter feed for bite-sized <a href="http://www.wolfram.com/mathematica" target="_self"><i>Mathematica</i></a> hints and tips!</p>
<p><a href="http://twitter.com/#!/mathematicatip" target="_blank"><img src="http://blog.wolfram.com/data/uploads/2012/05/MathematicaTip.png" alt="@MathematicaTip" title="@MathematicaTip" width="500" height="145" style="border:0px" class="aligncenter size-full wp-image-10424" /></a></p>
<p>Thousands of people follow <a href="http://twitter.com/#!/mathematicatip" target="_blank">@MathematicaTip</a> to get a new tip every day, Monday through Friday, covering everything from keyboard shortcuts:</p>
<blockquote class="twitter-tweet"><p>Instead of using % to refer to the most recent output, try Ctrl+Shift+L (Mac: Cmd+Shift+L) to directly insert the output from above.</p>
<p>&mdash; MathematicaTip (@MathematicaTip) <a href="https://twitter.com/MathematicaTip/status/123457305693011968" data-datetime="2011-10-10T17:58:10+00:00">October 10, 2011</a></p></blockquote>
<p><script src="//platform.twitter.com/widgets.js" charset="utf-8"></script><span id="more-10380"></span></p>
<p>To programming:</p>
<blockquote class="twitter-tweet"><p>x /. r applies the rules r to x once. x //. r applies the rules repeatedly: f[a b c] //. f[x_ y_] -&gt; f[x] + f[y]. <a href="http://j.mp/iXIjVE">http://j.mp/iXIjVE</a></p>
<p>&mdash; MathematicaTip (@MathematicaTip) <a href="https://twitter.com/MathematicaTip/status/76637247063076864" data-datetime="2011-06-03T13:11:58+00:00">June 3, 2011</a></p></blockquote>
<p><script src="//platform.twitter.com/widgets.js" charset="utf-8"></script></p>
<p>To graphics, neat examples, and more:</p>
<blockquote class="twitter-tweet"><p>Visualize HSB color space: Graphics3D[{Hue[#], Cuboid[#, # + .1]} &#038; /@ Tuples[Range[0, 1, .2], 3], Lighting-&gt;&#8221;Neutral&#8221;] <a href="http://t.co/ZLM44UEP" title="http://twitter.com/MathematicaTip/status/165450815669141504/photo/1">twitter.com/MathematicaTip…</a></p>
<p>&mdash; MathematicaTip (@MathematicaTip) <a href="https://twitter.com/MathematicaTip/status/165450815669141504" data-datetime="2012-02-03T15:05:23+00:00">February 3, 2012</a></p></blockquote>
<p><script src="//platform.twitter.com/widgets.js" charset="utf-8"></script></p>
<p>Starting this week we&#8217;re counting down the top 10 most popular tips from our first year. Follow along on Twitter at <a href="https://twitter.com/#!/mathematicatip" target="_blank">@MathematicaTip</a>. (You can also follow using an <a href="http://api.twitter.com/1/statuses/user_timeline.rss?screen_name=mathematicatip" target="_blank">RSS feed</a>.) You can view the full archive of <a href="https://twitter.com/#!/mathematicatip" target="_blank">daily <i>Mathematica</i> tips</a> from our Twitter page.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.wolfram.com/2012/05/07/one-year-of-daily-tips-from-mathematicatip/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>From the Wolfram Science Summer School to Wolfram&#124;Alpha Pro</title>
		<link>http://blog.wolfram.com/2012/05/01/from-the-wolfram-science-summer-school-to-wolframalpha-pro/</link>
		<comments>http://blog.wolfram.com/2012/05/01/from-the-wolfram-science-summer-school-to-wolframalpha-pro/#comments</comments>
		<pubDate>Tue, 01 May 2012 18:32:09 +0000</pubDate>
		<dc:creator>Carlo Barbieri</dc:creator>
				<category><![CDATA[Data Analysis and Visualization]]></category>

		<guid isPermaLink="false">http://blog.internal.wolfram.com/?p=9966</guid>
		<description><![CDATA[In spring 2011, while adding the finishing touches to my PhD dissertation, I decided to enroll in the Wolfram Science Summer School (then called the NKS Summer School). I never suspected that my project at the Summer School would lead to a job and my involvement in one of the central features of Wolfram&#124;Alpha Pro. [...]]]></description>
			<content:encoded><![CDATA[<p>In spring 2011, while adding the finishing touches to my PhD dissertation, I decided to enroll in the <a href="https://www.wolframscience.com/summerschool/2012/">Wolfram Science Summer School</a> (then called the NKS Summer School). I never suspected that my project at the Summer School would lead to a job and my involvement in one of the central features of <a href="http://www.wolframalpha.com/pro/">Wolfram|Alpha Pro</a>.</p>
<p>During my years as a graduate student I had the chance to live in three different countries and experience different working environments: other than my native Italy, I lived in Paris, where my PhD was based at ENS, and in Princeton, where I was lucky enough to spend time at the Institute for Advanced Study. However, at the end of my PhD, I felt that most of my interest in what I was doing was gone and that I needed to try something new.</p>
<p>Once at the Summer School, I had the chance to meet and chat with Stephen Wolfram as he helped me come up with a problem to work on. One of the first things I told him was that I was weary of open-ended academic kinds of problems and I was afraid no one was ever going to read my papers. I said that I wanted to deal with intellectual challenges, but I also wanted to tackle something that had a clear beginning and end.</p>
<p>His reply came as a disappointment, since what he suggested I work on was both completely outside my area of expertise and clearly one of those impossibly wide problems that I was now skeptical of. What did he say?<span id="more-9966"></span></p>
<p>Stephen asked me to devise a system to generate a plain English description of a time series. My disappointment vanished quickly when I realized that while a general answer to this kind of question was well beyond the scope of the three weeks I had at the Summer School, there was a combination of neat heuristics and information theory ideas that might do a reasonable job in most cases.</p>
<p>Little did I know that I loved this kind of experimental coding and that it was going to become my full-time job as a Wolfram employee a few months later. My project turned out to be a success, and soon I was encouraged to apply for a job at Wolfram Research, the company that made <em><a href="http://www.wolfram.com/mathematica/">Mathematica</a></em>&#8211;a product my friends and I had long considered a godsend for our work.</p>
<p>In my first four months at the company, I got involved in a very exciting project that has taken Wolfram|Alpha in an entirely new direction. I worked in a small group on what was known internally by the name tabular input (or TI to its friends). Along with image upload, file upload, and data download, TI formed one of the foundations of our subscription service, Wolfram|Alpha Pro.</p>
<p>The idea behind this project was to treat data as if it were language: columns of a single type of data, like numbers, dates, places, or what have you, act as words in a sentence. And just like sentences of human language, groups of these words are more than the sum of their parts. To give a particularly important example, think about a time series, which is a column of dates plus a column of one or more numeric quantities.</p>
<p>We knew we had at our disposal a huge amount of data coming from Wolfram|Alpha as well as the power of the parser to recognize what this data was all about. We could parse dates in any format, various currencies, and units. This made it natural to think along these lines: This column is about currency. It appears alongside a column of dates. We happen to have data about inflation in that country. We can do an inflation adjustment on the currency values!</p>
<p><a href="http://www.wolframalpha.com/input/?i=inflation&amp;examplefile=1&amp;datasetfile=DataInput%2Fdates-currency-2"><img class="alignleft size-full wp-image-9974" style="border: 0pt none" src="http://blog.wolfram.com/data/uploads/2012/03/Inflation.png" alt="Inflation-adjusted plot" width="500" height="278" /></a></p>
<p>So we had the notion of parsing data to determine what kinds of analysis to perform. What about those analyses? How should they look and feel? How should we rank them if many different ones were possible?</p>
<p>Now, along with a small group of smart people coming from wildly different backgrounds&#8211;economics, computational biology, pure math, and statistics, to mention a few&#8211;we started thinking about what this new data language was trying to say. (Interestingly, most of these people were Summer School alumni from several past years.)</p>
<p>A key fact about our group was that, while everyone had the vocabulary of mathematics in common, no single person knew it all. Take me, for example. As a physicist, I am perfectly at ease with nonlinear fits, but I couldn&#8217;t read a regression table to save my life! But to my colleague, an economist, regression tables were second nature.</p>
<p>And in arguing about how to display these results in a way that made sense to a non-expert and an expert both, we got to the crux of each analysis. In fact, this was also how I came up with the idea of spelling out in plain English the key results of our data analysis and, so, funnily enough, this is where my Summer School project came full circle.</p>
<p>For example, one of the sample datasets was the passenger list from the Titanic: age, class, gender, and whether or not they had made it to the lifeboats. Now, a logistic regression is the perfect tool to see if being a woman or a child actually increased the chances of surviving, but can you actually interpret one? As you can see below, we’ve done the job for you! And in case you were wondering what the result is, you had a better chance of survival if you were female, young, and a first-class passenger.</p>
<p><a href="http://www.wolframalpha.com/input/?i=regression&amp;examplefile=1&amp;datasetfile=DataInput%2Fcategories-numbers-genders"><img class="alignleft size-full wp-image-9975" style="border: 0pt none" src="http://blog.wolfram.com/data/uploads/2012/03/Titanic.png" alt="Regression analysis" width="500" height="486" /></a></p>
<p>Each one of us had to think: &#8220;What would I, as an expert in this field, do with this data? How would I visualize it? What kind of analysis would I perform on it?&#8221; It turns out this is one of the key insights of Wolfram|Alpha: to bring expert knowledge to the tips of everybody&#8217;s fingers (or vocal cords, if you happen to use Siri).</p>
<p>What I ended up finding really addictive about this job is that I get to wrap my mind around research-grade problems, but after I understand them, I have to quite quickly turn my ideas into workable features of a website that is used by a lot of people daily. At Wolfram, I get the intellectual challenge I was looking for, and thousands read my research results every day.</p>
<p><a href="http://www.wolframscience.com/summerschool/application.cgi"><img class="aligncenter size-full wp-image-10346" src="http://blog.wolfram.com/data/uploads/2012/04/summer_blog.png" alt="Wolfram Science Summer School 2012—A Unique Educational &amp; Career Opportunity with Stephen Wolfram—Apply Now" width="526" height="160" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.wolfram.com/2012/05/01/from-the-wolfram-science-summer-school-to-wolframalpha-pro/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Add a Wolfram Demonstration to Your Site in One Easy Step</title>
		<link>http://blog.wolfram.com/2012/04/24/add-a-wolfram-demonstration-to-your-site-in-one-easy-step/</link>
		<comments>http://blog.wolfram.com/2012/04/24/add-a-wolfram-demonstration-to-your-site-in-one-easy-step/#comments</comments>
		<pubDate>Tue, 24 Apr 2012 19:01:02 +0000</pubDate>
		<dc:creator>Vitaliy Kaurov</dc:creator>
				<category><![CDATA[Wolfram Demonstrations Project]]></category>

		<guid isPermaLink="false">http://blog.internal.wolfram.com/?p=10330</guid>
		<description><![CDATA[With nearly 8,000 interactive knowledge apps available on a huge variety of topics in the Wolfram Demonstrations Project, you&#8217;re bound to find one—or more—that you want to share. Now you can easily embed any Demonstration you like on your own blog or website in one step. Watch this short video or read on to see [...]]]></description>
			<content:encoded><![CDATA[<p>With nearly 8,000 interactive knowledge apps available on a huge variety of topics in the <a href="http://demonstrations.wolfram.com/" target="_self">Wolfram Demonstrations Project</a>, you&#8217;re bound to find one—or more—that you want to share.</p>
<p>Now you can easily embed any Demonstration you like on your own blog or website in one step. Watch this short video or read on to see how (we recommend viewing the video in full-screen mode):</p>
<p><iframe width="527" height="387" src="http://www.youtube.com/embed/BpNeo0eMKRg?rel=0" frameborder="0" allowfullscreen></iframe><span id="more-10330"></span></p>
<p>Each Demonstration page includes a snippet of JavaScript code in the Share section of the sidebar.</p>
<p><img src="http://blog.wolfram.com/data/uploads/2012/04/Demonstrations-Embed.png" alt="Embed Interactive Demonstration" title="Embed Interactive Demonstration" width="280" height="236" style="border:0px" class="aligncenter size-full wp-image-10354" /></p>
<p>Just copy and paste the code into your website or blog to put the live Demonstration on your site. Anyone who has the <a href="http://demonstrations.wolfram.com/download-cdf-player.html">Wolfram <i>CDF Player</i></a> installed will be able to interact with it, just like this one.</p>
<p><script type="text/javascript" src="http://demonstrations.wolfram.com/javascript/embed.js" ></script><script type="text/javascript" id="DEMO_VoronoiImage">var demoObj = new DEMOEMBED(); demoObj.run("VoronoiImage", "", "511", "411");</script>
<div><a class="demonstrationHyperlink" href="http://demonstrations.wolfram.com/VoronoiImage/" target="_blank">Voronoi Image</a> from the <a class="demonstrationHyperlink" href="http://demonstrations.wolfram.com/" target="_blank">Wolfram Demonstrations Project</a> by Yu-Sung Chang</div>
<p></p>
<p>The embed code also provides the author&#8217;s name and title, as well as convenient links to the Demonstrations site and  the <i>CDF Player</i> download site. If you&#8217;re an author, that greatly increases the visibility of your work on the web and helps promote your ideas.</p>
<p>The Demonstrations Project aims to bring computational exploration to the widest possible audience, and this makes it even easier to broadly share your ideas.</p>
<p>Try it out and let us know what you think. We would love to see what you share, so please leave a comment with a link to your blog or site with live Demonstrations.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.wolfram.com/2012/04/24/add-a-wolfram-demonstration-to-your-site-in-one-easy-step/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How to Make Interactive Apps with CDF</title>
		<link>http://blog.wolfram.com/2012/04/18/how-to-make-interactive-apps-with-cdf/</link>
		<comments>http://blog.wolfram.com/2012/04/18/how-to-make-interactive-apps-with-cdf/#comments</comments>
		<pubDate>Wed, 18 Apr 2012 15:27:18 +0000</pubDate>
		<dc:creator>Vitaliy Kaurov</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://blog.internal.wolfram.com/?p=10256</guid>
		<description><![CDATA[A number of you have written us asking about interface design, Dynamic structures, and general starting tips for creating Wolfram Computable Document Format (CDF) files. I will present three examples of CDF files that will provide some insight into good practices. You should also read the recent Mathematica Q&#038;A Series blog post about delivering CDF [...]]]></description>
			<content:encoded><![CDATA[<p>A number of you have written us asking about interface design, <a href="http://reference.wolfram.com/mathematica/tutorial/AdvancedDynamicFunctionality.html" target="_self"><tt>Dynamic</tt></a> structures, and general starting tips for creating Wolfram Computable Document Format (<a href="http://www.wolfram.com/cdf">CDF</a>) files. I will present three examples of CDF files that will provide some insight into good practices. You should also read the recent <i>Mathematica</i> Q&#038;A Series blog post about <a href="http://blog.wolfram.com/2012/02/22/mathematica-qa-series-cdf-embedding-in-a-nutshell/" target="_self">delivering CDF to your websites and blogs</a> with the help of the <a href="http://reference.wolfram.com/mathematica/howto/CreateAComputableDocumentFormatFile.html" target="_self">CDF Web Deployment Wizard</a>. This enables users to showcase their <i>Mathematica</i> projects online and share them with the global community. Let&#8217;s have a look at some features that make CDF great, rising well above other platforms. For a more extensive list, please see the <a href="http://www.wolfram.com/cdf/compare-cdf/how-cdf-compares.html" target="_self">CDF comparison table</a>.</p>
<p>We will start with a short program that numerically solves the challenging problem of constrained global optimization by finding the minimum on a limited surface region. Think of finding the lowest point of an area of a mountain range. Dragging the 2D slider on the interface below automatically changes the surface geometry, and the CDF engine quickly recomputes the new minimum. This is reflected in the updated positions of the red dot. Drag and rotate the 3D graphics with the mouse to get a different view. Hold Ctrl while dragging to zoom (Command on a Mac) or hold Shift and drag to pan.</p>
<p><img src="http://blog.wolfram.com/data/uploads/2012/04/CDFDeploy-In1.png" alt="Code that numerically solves the challenging problem of constrained global optimization by finding the minimum on a limited surface region" title="Code that numerically solves the challenging problem of constrained global optimization by finding the minimum on a limited surface region" width="499" height="346" style="border:0px" class="alignleft size-full wp-image-10261" /><span id="more-10256"></span></p>
<p><div class="WriCDF">
	<div style="margin: 0 auto; width: 480px;">
		<div id="A96e518fb19462aaeaae3c3173b760a65" style="width:480px; height:530px; border:1px solid #A0A0A0; margin-bottom: 15px; text-align:center; background-color:#E8E8E8; color:#333333">
			<noscript>
			<p style="margin: 0; padding: 10px 10px 0">To view the full content of this page, please enable JavaScript in your browser. 
			Learn more <a href="http://www.wolframalpha.com/jsMac.html">here</a>.</p>
			</noscript>
        
			<p style="margin: 0; padding: 10px">To view this content, please install <em>Wolfram CDF Player</em>. You can install the free <em>CDF Player</em> <a href="http://demonstrations.wolfram.com/download-cdf-player.html" title="Wolfram CDF Player">here</a>.</p>
		</div>
	</div>
	<script type="text/javascript">var cdf = new cdf_plugin(); cdf.addCDFObject("A96e518fb19462aaeaae3c3173b760a65", "http://blog.wolfram.com/data/uploads/2012/04/CDFDeploy-CDF1.cdf", 480, 530);</script>
</div></p>
<p>The code is compact because <i>Mathematica</i>&#8216;s extensive library provides thousands of built-in functions that target a wide scope of tasks. The code is also easily readable because of consistent syntax and meaningful function names. Even a novice user would be able to come up with a similar program in a fairly short time using our extensive documentation full of typical examples. Note that I did not have to program the numerical optimization algorithms packed in the function <a href="http://reference.wolfram.com/mathematica/ref/NMinimize.html" target="_self"><tt>NMinimize</tt></a> or the interface automatically constructed by <a href="http://reference.wolfram.com/mathematica/ref/Manipulate.html?q=Manipulate" target="_self"><tt>Manipulate</tt></a>. While <tt>NMinimize</tt> is highly automated, I also had the freedom to specify the numerical method I prefer, using the option <a href="http://reference.wolfram.com/mathematica/ref/Method.html" target="_self"><tt>Method</tt></a> <tt>&#8594;</tt> <tt>"RandomSearch"</tt>. Most of the styling, such as meshes, ranges, ticks, and so on, is also done automatically. <i>Mathematica</i>&#8216;s interactive 2D and 3D graphics are far superior to what most current publishing platforms can offer. As you change the surface, <tt>Manipulate</tt> forces dynamic updates, constantly running the algorithms of <tt>NMinimize</tt>. All that in just few lines of code.</p>
<p>Next we will see how the ideas behind CDF scale up when the complexity of our goals grows and many parts need to come together in a single, perfectly working whole. As a case study, consider the <a href="http://mathworld.wolfram.com/GameofLife.html" target="_self">Game of Life</a>, which, in addition to its recreational fame, is a powerful scientific example of complex behavior rising from simple rules. (For a deeper insight into this and other simple programs, read Stephen Wolfram&#8217;s book <a href="http://www.wolframscience.com/nksonline/toc.html" target="_self"><i>A New Kind of Science</i></a> and apply for the <a href="http://blog.wolfram.com/2012/02/15/apply-for-the-10th-annual-wolfram-science-summer-school/" target="_self">10th Annual Wolfram Science Summer School</a>.)</p>
<p>Scroll down and click &#8220;run&#8221; to start the simulation.</p>
<p><img src="http://blog.wolfram.com/data/uploads/2012/04/CDFDeploy-In2.png" alt="Code developing an example for the Game of Life" title="Code developing an example for the Game of Life" width="508" height="783" style="border:0px" class="alignleft size-full wp-image-10263" /></p>
<p><div class="WriCDF">
	<div style="margin: 0 auto; width: 480px;">
		<div id="Ac04d170616a0b65ea273ecba0312f208" style="width:480px; height:515px; border:1px solid #A0A0A0; margin-bottom: 15px; text-align:center; background-color:#E8E8E8; color:#333333">
			<noscript>
			<p style="margin: 0; padding: 10px 10px 0">To view the full content of this page, please enable JavaScript in your browser. 
			Learn more <a href="http://www.wolframalpha.com/jsMac.html">here</a>.</p>
			</noscript>
        
			<p style="margin: 0; padding: 10px">To view this content, please install <em>Wolfram CDF Player</em>. You can install the free <em>CDF Player</em> <a href="http://demonstrations.wolfram.com/download-cdf-player.html" title="Wolfram CDF Player">here</a>.</p>
		</div>
	</div>
	<script type="text/javascript">var cdf = new cdf_plugin(); cdf.addCDFObject("Ac04d170616a0b65ea273ecba0312f208", "http://blog.wolfram.com/data/uploads/2012/04/CDFDeploy-CDF2.cdf", 480, 515);</script>
</div></p>
<p>If you are familiar with the Game of Life, you probably recognize immediately that this is not its typical implementation. Only black cells represent the usual evolution, while the colorful background is the 2D Fourier power spectrum computed in real time on the changing patterns of black cells. Notice the dramatic change in the Fourier plot when two moving black configurations come close together. Such signatures in the Fourier space can be used for the detection of collisions and close proximity between structures, leading to significant computational speedup compared to the blunt search in original data space. We may gain many other insights into properties of the driving rules and emerging patterns by using built-in <i>Mathematica</i> <a href="http://reference.wolfram.com/mathematica/guide/SignalProcessing.html" target="_self">signal processing</a> tools. This instructive, simultaneous visualization is possible thanks to the function <a href="http://reference.wolfram.com/mathematica/ref/Overlay.html" target="_self"><tt>Overlay</tt></a>, a useful construct able to overlap all types of expressions and even preserve interactivity by <a href="http://reference.wolfram.com/mathematica/ref/Overlay.html#7669566" target="_self">overlaying controls</a>.</p>
<p>At the end of the code above, there is a nested list of integers representing well-known Game of Life patterns. Simulate them by clicking one of the &#8220;preset&#8221; buttons followed by &#8220;run.&#8221; Using <a href="http://reference.wolfram.com/mathematica/ref/SparseArray.html" target="_self"><tt>SparseArray</tt></a>, I was able to compress the data in these patterns to one third of the original <a href="http://reference.wolfram.com/mathematica/ref/ByteCount.html" target="_self"><tt>ByteCount</tt></a>. The uncompressing function is included at the beginning of the numbers list. This inclusion of custom data in CDF was done with <tt>Manipulate</tt>&#8216;s <a href="http://reference.wolfram.com/mathematica/ref/Initialization.html" target="_self"><tt>Initialization</tt></a> option. Another way to add data to your CDF document is to use <a href="http://reference.wolfram.com/mathematica/guide/ComputableDataOverview.html" target="_self">built-in <i>Mathematica</i> data</a> and calls to the <a href="http://reference.wolfram.com/mathematica/ref/WolframAlpha.html" target="_self"><tt>WolframAlpha</tt></a> function to access more than 10 trillion pieces of data in our constantly updating curated database.</p>
<p>In addition to automated interfaces with the <a href="http://reference.wolfram.com/mathematica/guide/ControlObjects.html" target="_self">standard arsenal</a> of sliders, buttons, menus, and numerous other controls, custom interactivity and dynamics are also supported. This gives a lot of room for improvisation, but does not really require much effort. In the code above, it is achieved with the built-in function <a href="http://reference.wolfram.com/mathematica/ref/EventHandler.html?q=EventHandler" target="_self"><tt>EventHandler</tt></a>, which manages inputs from the keyboard, mouse, and other devices. It is clear from the code that the <a href="http://reference.wolfram.com/mathematica/ref/EventHandler.html#245644340" target="_self"><tt>MouseClicked</tt></a> event is tracked. Go ahead and color in some cells with mouse clicks. Use the button &#8220;random&#8221; to fill many cells together.</p>
<p>The Game of Life evolves according to simple mathematical rules packed in the function <a href="http://reference.wolfram.com/mathematica/ref/CellularAutomaton.html?q=CellularAutomaton" target="_self"><tt>CellularAutomaton</tt></a>. But what makes it run here? There are no &#8220;Do&#8221; or &#8220;For&#8221; loops. The answer is that <tt>Manipulate</tt> is a dynamic function. It automatically updates if any of its tracked variables change. Therefore, if changing <i>x</i> causes <i>x</i> to change (a recursive definition of the type <tt>x=F[x]</tt>), <tt>Manipulate</tt> will continuously update until x settles to a stationary point. This is exactly the case here, as can be seen from the first few lines of code. The stationary point is reached (updating stops) when <tt>x=F[x]</tt> is satisfied. We took advantage of this in the first argument of <a href="http://reference.wolfram.com/mathematica/ref/Switch.html" target="_self"><tt>Switch</tt></a> (literally, <i>x</i>=<i>x</i>), allowing us to &#8220;pause.&#8221; <a href="http://reference.wolfram.com/mathematica/tutorial/AdvancedManipulateFunctionality.html" target="_self">This technique</a> of using simple recursive definitions inside dynamic functions comes in quite handy for long-running <a href="http://demonstrations.wolfram.com/PredatorPreyEcosystemARealTimeAgentBasedSimulation/" target="_self">simulations and animations</a> when you do not want to store all the history of variable values. There are a few other neat tricks in this CDF file. For example, the &#8220;size&#8221; slider is disabled in &#8220;pause&#8221;/&#8221;run&#8221; modes to protect currently evolving configurations. This is reflected with a slightly different visual appearance of the slider, a nice interface element that, again, was not explicitly coded, but purely automated by the option <a href="http://reference.wolfram.com/mathematica/ref/Enabled.html?q=Enabled" target="_self"><tt>Enabled</tt></a>.</p>
<p>This app has plenty of potential for further development. With slight syntax changes to the function <tt>CellularAutomaton</tt>, it is possible to produce the evolution of a huge number of other interesting <a href="http://demonstrations.wolfram.com/2DCellularAutomatonAnimations/" target="_self">algorithms different from the Game of Life</a> and easy to <a href="http://demonstrations.wolfram.com/topic.html?topic=Cellular+Automata&#038;limit=20" target="_self">generalize</a> to spaces other than 2D grids. The same holds for many other built-in <i>Mathematica</i> functions. And what requires a slight change of syntax in <i>Mathematica</i> typically requires writing many more lines of code from scratch in other languages.</p>
<p>Our last example will demonstrate the reusability of <i>Mathematica</i> code. More than 7,800 CDFs available at the <a href="http://demonstrations.wolfram.com/" target="_self">Wolfram Demonstrations Project</a> show the diversity of approaches to authoring ideas with interactive interfaces. The Demonstrations Project is the largest free online electronic publishing system dedicated solely to open-source code, interactive in-browser documents, and illustrations of scientific concepts. It continues to grow with submissions from users like you, providing freely downloadable code for learning and reusing. Below is my version of the elegant <a href="http://demonstrations.wolfram.com/TreeBender/" target="_self">&#8220;Tree Bender&#8221; by Theodore Gray</a>. By injecting randomness into the original, purely deterministic fractal and adding just a touch of styling, we can get quite close to producing artistic illustrations. Download the CDF version of this post below to see the minimal code changes I made to the original. The main difference compared to the original code comes from quite a few <a href="http://reference.wolfram.com/mathematica/ref/RandomReal.html" target="_self"><tt>RandomReal</tt></a> functions in my version. They are pseudorandom number generators and change the appearance of the original regular shapes to random, more natural-looking trees. One million basic random tree samples are controlled by the &#8220;environment&#8221; slider, which uses <a href="http://reference.wolfram.com/mathematica/ref/SeedRandom.html" target="_self"><tt>SeedRandom</tt></a> to reset the pseudorandom generators. Basic trees are further customizable with the rest of the controls, including the small, green, movable circles on the plot. The interface was meant to be self-explanatory, so go ahead and explore. There are more than 300 quintillion trees in one small CDF file!</p>
<p><div class="WriCDF">
	<div style="margin: 0 auto; width: 480px;">
		<div id="Ae9a01105f4c74d8ab0e7103e1b5053b6" style="width:480px; height:530px; border:1px solid #A0A0A0; margin-bottom: 15px; text-align:center; background-color:#E8E8E8; color:#333333">
			<noscript>
			<p style="margin: 0; padding: 10px 10px 0">To view the full content of this page, please enable JavaScript in your browser. 
			Learn more <a href="http://www.wolframalpha.com/jsMac.html">here</a>.</p>
			</noscript>
        
			<p style="margin: 0; padding: 10px">To view this content, please install <em>Wolfram CDF Player</em>. You can install the free <em>CDF Player</em> <a href="http://demonstrations.wolfram.com/download-cdf-player.html" title="Wolfram CDF Player">here</a>.</p>
		</div>
	</div>
	<script type="text/javascript">var cdf = new cdf_plugin(); cdf.addCDFObject("Ae9a01105f4c74d8ab0e7103e1b5053b6", "http://blog.wolfram.com/data/uploads/2012/04/CDFDeploy-CDF3.cdf", 480, 530);</script>
</div></p>
<p>CDF documents run the same computational engine as <i>Mathematica</i>, installed on multitudes of computers in universities, companies, and organizations around the world, the engine that has powered scientific research for more than 20 years.</p>
<p>To learn about the full scope of CDF possibilities from our leading experts and authors, register for the <a href="http://www.wolfram.com/training/special-event/wolfram-cdf-virtual-workshop-2012/" target="_self">Wolfram CDF Virtual Workshop</a>.</p>
<p><a href="http://blog.wolfram.com/data/uploads/2012/04/InteractiveAppsWithCDF.cdf" target="_blank">Download this post as a Computable Document Format (CDF) file</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.wolfram.com/2012/04/18/how-to-make-interactive-apps-with-cdf/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Explore the Computable Document Format: Free Virtual Workshop</title>
		<link>http://blog.wolfram.com/2012/04/09/explore-the-computable-document-format-free-virtual-workshop/</link>
		<comments>http://blog.wolfram.com/2012/04/09/explore-the-computable-document-format-free-virtual-workshop/#comments</comments>
		<pubDate>Mon, 09 Apr 2012 20:54:00 +0000</pubDate>
		<dc:creator>Wolfram Blog Team</dc:creator>
				<category><![CDATA[Wolfram News]]></category>

		<guid isPermaLink="false">http://blog.internal.wolfram.com/?p=10191</guid>
		<description><![CDATA[Ever since we launched the Computable Document Format (CDF) last summer, people have been excited about the ease of deploying interactive documents to their clients and on their websites, and we&#8217;re seeing CDFs used to enhance blogs, textbooks, and other applications in many different areas. Now we&#8217;re holding a virtual workshop where you can hear [...]]]></description>
			<content:encoded><![CDATA[<p>Ever since we launched the Computable Document Format (<a href="http://www.wolfram.com/cdf" target="_self">CDF</a>) last summer, people have been excited about the ease of deploying interactive documents to their clients and on their websites, and we&#8217;re seeing CDFs used to enhance blogs, textbooks, and other applications in many different areas.</p>
<p><img src="http://blog.wolfram.com/data/uploads/2012/04/cdf_promo.png" alt="" title="CDF" width="500" height="235" style="border:0px" class="aligncenter size-full wp-image-10205" /></p>
<p>Now we&#8217;re holding a virtual workshop where you can hear from the author of an award-winning CDF textbook, chat with Wolfram experts in publishing and application development, and learn how to get started with your own projects.</p>
<p>The <a href="http://www.wolfram.com/training/special-event/" target="_self">Wolfram CDF Virtual Workshop</a> will feature a keynote by Conrad Wolfram plus talks and Q&#038;A sessions with Wolfram experts.</p>
<p>The virtual event will be held Tuesday, April 24, at the following times:<br />
* 8am–noon Eastern Daylight Time (EDT); 1pm–5pm British Summer Time (BST)<br />
* Repeat session: 1pm–5pm EDT; 6pm–10pm BST</p>
<p>Virtual seats are limited—see the <a href="http://www.wolfram.com/training/special-event/wolfram-cdf-virtual-workshop-2012/" target="_self">event schedule</a> and <a href="http://www.wolfram.com/training/special-event/wolfram-cdf-virtual-workshop-2012/register.cgi" target="_self">register</a> today!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.wolfram.com/2012/04/09/explore-the-computable-document-format-free-virtual-workshop/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Analyzing Your Email with Mathematica</title>
		<link>http://blog.wolfram.com/2012/04/05/analyzing-your-email-with-mathematica/</link>
		<comments>http://blog.wolfram.com/2012/04/05/analyzing-your-email-with-mathematica/#comments</comments>
		<pubDate>Thu, 05 Apr 2012 14:42:13 +0000</pubDate>
		<dc:creator>Paul-Jean Letourneau</dc:creator>
				<category><![CDATA[Data Analysis and Visualization]]></category>
		<category><![CDATA[Featured]]></category>
		<category><![CDATA[Recreational Computation]]></category>

		<guid isPermaLink="false">http://blog.internal.wolfram.com/?p=10114</guid>
		<description><![CDATA[In Stephen Wolfram&#8217;s recent blog post about personal analytics, he showed a number of plots generated by analyzing his archive of personal data. One of the most common pieces of feedback we received was that people wanted to know how they could perform the same kind of analysis on their own data. So in this [...]]]></description>
			<content:encoded><![CDATA[<p>In Stephen Wolfram&#8217;s <a href="http://blog.stephenwolfram.com/2012/03/the-personal-analytics-of-my-life/" target="_self">recent blog post</a> about personal analytics, he showed a number of plots generated by analyzing his archive of personal data. One of the most common pieces of feedback we received was that people wanted to know how they could perform the same kind of analysis on their own data. So in this blog post I&#8217;m going to show you how to analyze your email the same way Stephen Wolfram did.</p>
<p>Naturally, we did all the data cleaning and analysis for Stephen&#8217;s data in <a href="http://www.wolfram.com/mathematica" target="_self"><em>Mathematica</em></a>, so we&#8217;ll be using <em>Mathematica</em> for everything here as well. All the code can be <a href="http://blog.wolfram.com/data/uploads/2012/04/EmailAnalyticsCode.zip" target="_self">downloaded here</a>.</p>
<p>Let&#8217;s start with that really cool diurnal plot Stephen did of his outgoing email. This plot shows the date and time each email was sent, with years running along the <em>x</em> axis and times of day on the <em>y</em> axis:</p>
<p><img class="aligncenter size-full wp-image-10117" style="border: 0px;" title="Plot showing the date and time each email was sent" src="http://blog.wolfram.com/data/uploads/2012/04/outgoing-mail-diurnal-image.png" alt="Plot showing the date and time each email was sent" width="505" height="314" /><span id="more-10114"></span></p>
<p>To make this plot, we first need to import our email into <em>Mathematica</em>. There are lots of ways to do this, depending on the details of your email server and so on, but for the purposes of this blog post I&#8217;ve written a simple function that imports mail from an <a href="http://en.wikipedia.org/wiki/Internet_Message_Access_Protocol" target="_blank">IMAP mail server</a>:</p>
<p><img class="alignleft size-full wp-image-10120" style="border: 0px;" title="Code to import email into Mathematica" src="http://blog.wolfram.com/data/uploads/2012/04/Email-In3.png" alt="Code to import email into Mathematica" width="481" height="587" /></p>
<p>This function uses <em>J/Link</em> to call the JavaMail library, included in the download, for connecting to your mailbox and downloading emails from it.</p>
<p>You call the function with the name of the IMAP server and the name of the mail folder you want to import mail from. Here I&#8217;m importing the emails from my Sent Mail folder in my Gmail account:</p>
<p><img class="alignleft size-full wp-image-10121" title="sentdates = importemaildates[&quot;imap.gmail.com&quot;, &quot;[Gmail]/Sent Mail&quot;]; Importing email ... please wait ... Finished importing email!" src="http://blog.wolfram.com/data/uploads/2012/04/Email-In4.png" alt="sentdates = importemaildates[&quot;imap.gmail.com&quot;, &quot;[Gmail]/Sent Mail&quot;]; Importing email ... please wait ... Finished importing email!" width="371" height="75" /></p>
<p>When you evaluate this line, a dialog window will pop up that asks you for your email address and password:</p>
<p><img class="alignleft size-full wp-image-10123" title="Dialog window asking you for email address and password" src="http://blog.wolfram.com/data/uploads/2012/04/EmailPassword.png" alt="Dialog window asking you for email address and password" width="351" height="218" /></p>
<p>After entering your email address and password in the input fields, the function will return a list of dates that were parsed from the time stamps on each email:</p>
<p><img class="alignleft size-full wp-image-10124" style="border: 0px;" title="Length@sentdates" src="http://blog.wolfram.com/data/uploads/2012/04/Email-In5.png" alt="Length@sentdates" width="161" height="16" /></p>
<p><img class="alignleft size-full wp-image-10125" style="border: 0px;" title="1694" src="http://blog.wolfram.com/data/uploads/2012/04/Email-Out5.png" alt="1694" width="73" height="17" /></p>
<p><img class="alignleft size-full wp-image-10126" style="border: 0px;" title="sentdates[[1 ;; 10]]" src="http://blog.wolfram.com/data/uploads/2012/04/Email-In6.png" alt="sentdates[[1 ;; 10]]" width="180" height="18" /></p>
<p><img class="alignleft size-full wp-image-10127" style="border: 0px;" title="{{2007, 1, 27, 10, 48, 13},  {2007, 1, 27, 10, 51, 13},  {2007, 1, 27, 10, 55, 48},  {2007, 1, 27, 11, 2, 30},  {2007, 1, 27, 14, 18, 27},  {2007, 1, 27, 14, 19, 46},  {2007, 1, 27, 14, 29, 47},  {2007, 1, 27, 14, 50, 22},  {2007, 1, 27, 15, 22, 19},  {2007, 1, 27, 15, 49, 13}}" src="http://blog.wolfram.com/data/uploads/2012/04/Email-Out6.png" alt="{{2007, 1, 27, 10, 48, 13},  {2007, 1, 27, 10, 51, 13},  {2007, 1, 27, 10, 55, 48},  {2007, 1, 27, 11, 2, 30},  {2007, 1, 27, 14, 18, 27},  {2007, 1, 27, 14, 19, 46},  {2007, 1, 27, 14, 29, 47},  {2007, 1, 27, 14, 50, 22},  {2007, 1, 27, 15, 22, 19},  {2007, 1, 27, 15, 49, 13}}" width="397" height="77" /></p>
<p>I&#8217;ll do the same thing for my incoming mail, this time specifying the folder name Inbox:</p>
<p><img class="alignleft size-full wp-image-10128" title="incomingdates = importemaildates[&quot;imap.gmail.com&quot;, &quot;Inbox&quot;]; Importing email ... please wait ... Finished importing email!" src="http://blog.wolfram.com/data/uploads/2012/04/Email-In7.png" alt="incomingdates = importemaildates[&quot;imap.gmail.com&quot;, &quot;Inbox&quot;]; Importing email ... please wait ... Finished importing email!" width="466" height="60" /></p>
<p><img class="alignleft size-full wp-image-10129" style="border: 0px;" title="Length@incomingdates" src="http://blog.wolfram.com/data/uploads/2012/04/Email-In8.png" alt="Length@incomingdates" width="191" height="17" /></p>
<p><img class="alignleft size-full wp-image-10130" style="border: 0px;" title="7208" src="http://blog.wolfram.com/data/uploads/2012/04/Email-Out8.png" alt="7208" width="74" height="16" /></p>
<p><img class="alignleft size-full wp-image-10131" style="border: 0px;" title="incomingdates[[1 ;; 10]]" src="http://blog.wolfram.com/data/uploads/2012/04/Email-In9.png" alt="incomingdates[[1 ;; 10]]" width="210" height="17" /></p>
<p><img class="alignleft size-full wp-image-10132" style="border: 0px;" title="{{2007, 1, 22, 19, 29, 57}, {2007, 1, 22, 19, 29, 57}, {2007, 1, 22, 19, 33, 21}, {2007, 1, 22, 19, 57, 49}, {2007, 1, 22, 20, 3, 21}, {2007, 1, 24, 12, 22, 42}, {2007, 1, 24, 19, 7, 54}, {2007, 1, 24, 19, 17, 3}, {2007, 1, 24, 22, 16, 51}, {2007, 1, 25, 9, 26, 55}}" src="http://blog.wolfram.com/data/uploads/2012/04/Email-Out9.png" alt="{{2007, 1, 22, 19, 29, 57}, {2007, 1, 22, 19, 29, 57}, {2007, 1, 22, 19, 33, 21}, {2007, 1, 22, 19, 57, 49}, {2007, 1, 22, 20, 3, 21}, {2007, 1, 24, 12, 22, 42}, {2007, 1, 24, 19, 7, 54}, {2007, 1, 24, 19, 17, 3}, {2007, 1, 24, 22, 16, 51}, {2007, 1, 25, 9, 26, 55}}" width="393" height="78" /></p>
<p>Now that we have the email time stamps, we can reproduce almost every single plot in Stephen&#8217;s blog post!</p>
<p>Let&#8217;s start with the diurnal plot. Here&#8217;s a function that takes a list of dates and uses the function <a href="http://reference.wolfram.com/mathematica/ref/DateListPlot.html" target="_self"><tt>DateListPlot</tt></a> to plot a point for each email sent:</p>
<p><img class="alignleft size-full wp-image-10133" style="border: 0px;" title="dayfraction[date : {_Integer, _Integer, _Integer, _Integer, _Integer, _}] :=  {3600, 60, 1}.date[[4 ;; 6]]/3600.;" src="http://blog.wolfram.com/data/uploads/2012/04/Email-In10.png" alt="dayfraction[date : {_Integer, _Integer, _Integer, _Integer, _Integer, _}] :=  {3600, 60, 1}.date[[4 ;; 6]]/3600.;" width="457" height="49" /></p>
<p><img class="alignleft size-full wp-image-10134" style="border: 0px;" title="Mathematica code building a diurnal plot of outgoing email" src="http://blog.wolfram.com/data/uploads/2012/04/Email-In11.png" alt="Mathematica code building a diurnal plot of outgoing email" width="485" height="304" /></p>
<p><img class="alignleft size-full wp-image-10135" style="border: 0px;" title="diurnalplot[sentdates]" src="http://blog.wolfram.com/data/uploads/2012/04/Email-In12.png" alt="diurnalplot[sentdates]" width="202" height="17" /></p>
<p><img class="alignleft size-full wp-image-10136" title="Diurnal plot of every outgoing email" src="http://blog.wolfram.com/data/uploads/2012/04/Email-Out12.png" alt="Diurnal plot of every outgoing email" width="497" height="279" /></p>
<p>Clearly I send a lot less email than Stephen Wolfram does! Still, there are some patterns visible here. The density is clearly higher around 2007–2008, with a rather sharp looking drop-off in mid-2008 (hmm, what happened in mid-2008?). There is a well-defined &#8220;sleep band&#8221; in the plot from around 1am to 9am or so, as I would expect, but I clearly sent less mail after midnight after around 2010. And now that I think about it, that&#8217;s right around when I started going to the gym in the mornings, so that makes sense.</p>
<p>The little burst of emails that are being sent in the middle of the night in mid-2009 aren&#8217;t actually a period of insomnia: I was in Italy lecturing at the 2009 Wolfram Science Summer School, so my time zone was shifted by +7 hours. Since I didn&#8217;t bother to change the time zone in my Gmail settings while I was away, all the emails I sent continued to be stamped with my regular time zone. So if I sent mail at midnight in Italy, the email time stamp said something like 5am local time.</p>
<p>Let&#8217;s see what my incoming mail looks like:</p>
<p><img class="alignleft size-full wp-image-10137" style="border: 0px;" title="diurnalplot[incomingdates]" src="http://blog.wolfram.com/data/uploads/2012/04/Email-In13.png" alt="diurnalplot[incomingdates]" width="231" height="19" /></p>
<p><img class="alignleft size-full wp-image-10138" style="border: 0px;" title="Diurnal plot of every incoming email" src="http://blog.wolfram.com/data/uploads/2012/04/Email-Out13.png" alt="Diurnal plot of every incoming email" width="496" height="278" /></p>
<p>I receive a LOT more email than I send! There are some interesting patterns here as well. One obvious feature is the daily automated emails I received for certain periods of time, which appear as perfectly straight streaks in the diurnal plot, since they get sent automatically at the same time of day each day.</p>
<p>Now I want to compare the number of emails I&#8217;ve sent and received as a function of time. So let&#8217;s use <tt>DateListPlot</tt> again to plot the time series of incoming and outgoing emails superimposed (the code for this plot and all subsequent plots is in the <a href="http://blog.wolfram.com/data/uploads/2012/04/EmailAnalyticsCode.zip" target="_self">attached notebook</a>):</p>
<p><img class="alignleft size-full wp-image-10139" style="border: 0px;" title="monthlytimeseries[incomingdates, sentdates]" src="http://blog.wolfram.com/data/uploads/2012/04/Email-In15.png" alt="monthlytimeseries[incomingdates, sentdates]" width="350" height="17" /></p>
<p><img class="alignleft size-full wp-image-10140" style="border: 0px;" title="Plot comparing incoming and outgoing emails" src="http://blog.wolfram.com/data/uploads/2012/04/Email-Out15.png" alt="Plot comparing incoming and outgoing emails" width="495" height="141" /></p>
<p>There&#8217;s definitely a correlation between the number of incoming and outgoing emails at any given time: when incoming email is high, outgoing tends to be high as well. That&#8217;s probably because when I receive more emails, I send more emails in response (as opposed to me initiating more discussions and causing more incoming replies)—but to find out for sure I&#8217;d need to analyze the email threads in detail.</p>
<p>We can also plot the daily incoming and outgoing mail with the monthly average:</p>
<p><img class="alignleft size-full wp-image-10141" style="border: 0px;" title="timeseriesperday[sentdates]" src="http://blog.wolfram.com/data/uploads/2012/04/Email-In17.png" alt="timeseriesperday[sentdates]" width="236" height="19" /></p>
<p><img class="alignleft size-full wp-image-10142" style="border: 0px;" title="Plot showing daily outgoing email along with the monthly average" src="http://blog.wolfram.com/data/uploads/2012/04/Email-Out17.png" alt="Plot showing daily outgoing email along with the monthly average" width="497" height="177" /></p>
<p><img class="alignleft size-full wp-image-10143" style="border: 0px;" title="timeseriesperday[incomingdates]" src="http://blog.wolfram.com/data/uploads/2012/04/Email-In18.png" alt="timeseriesperday[incomingdates]" width="266" height="16" /></p>
<p><img src="http://blog.wolfram.com/data/uploads/2012/04/Email-Out18.png" alt="Plot showing daily incoming email along with the monthly average" title="Plot showing daily incoming email along with the monthly average" width="496" height="178" style="border:0px" class="alignleft size-full wp-image-10174" /></p>
<p>These time series plots show my emailing behavior on timescales of years, but we can also look at the distribution of emails sent by time of day. Here&#8217;s the daily distribution for my sent mail:</p>
<p><img class="alignleft size-full wp-image-10145" style="border: 0px;" title="dailydistribution[sentdates]" src="http://blog.wolfram.com/data/uploads/2012/04/Email-In20.png" alt="dailydistribution[sentdates]" width="244" height="18" /></p>
<p><img class="alignleft size-full wp-image-10146" style="border: 0px;" title="Daily distribution for outgoing email" src="http://blog.wolfram.com/data/uploads/2012/04/Email-Out20.png" alt="Daily distribution for outgoing email" width="494" height="106" /></p>
<p>It looks like I send the majority of emails between 10pm and midnight, which makes sense because I mainly use Gmail for personal stuff in the evenings. The daily distribution of incoming mail is a lot flatter:</p>
<p><img class="alignleft size-full wp-image-10147" style="border: 0px;" title="dailydistribution[incomingdates]" src="http://blog.wolfram.com/data/uploads/2012/04/Email-In21.png" alt="dailydistribution[incomingdates]" width="274" height="19" /></p>
<p><img class="alignleft size-full wp-image-10148" style="border: 0px;" title="Daily distribution of incoming email" src="http://blog.wolfram.com/data/uploads/2012/04/Email-Out21.png" alt="Daily distribution of incoming email" width="495" height="104" /></p>
<p>There&#8217;s a hint of a dip in the incoming mail around 6pm, where presumably people in my time zone are having their dinner. Then of course there&#8217;s a sharp drop after midnight when most people are asleep.</p>
<p>How many emails do I typically send in a day? I can find out by plotting the distribution of emails sent per day, with the number of emails sent per day on the <em>x</em> axis and the count on the <em>y</em> axis:</p>
<p><img class="alignleft size-full wp-image-10149" style="border: 0px;" title="distributionperday[sentdates]" src="http://blog.wolfram.com/data/uploads/2012/04/Email-In23.png" alt="distributionperday[sentdates]" width="251" height="17" /></p>
<p><img class="alignleft size-full wp-image-10150" style="border: 0px;" title="Distribution of emails sent per day" src="http://blog.wolfram.com/data/uploads/2012/04/Email-Out23.png" alt="Distribution of emails sent per day" width="271" height="156" /></p>
<p>Here&#8217;s the raw data:</p>
<p><img class="alignleft size-full wp-image-10151" style="border: 0px;" title="{startdate, enddate} = Sort[sentdates][[{1, -1}]]; dailycount = Map[DatePlus[startdate, #] &amp;, Range[0, DateDifference[startdate, enddate]]]; dailycount = {#, Count[sentdates, {Sequence @@ #[[;; 3]], __}]} &amp; /@ dailycount;" src="http://blog.wolfram.com/data/uploads/2012/04/Email-In24.png" alt="{startdate, enddate} = Sort[sentdates][[{1, -1}]]; dailycount = Map[DatePlus[startdate, #] &amp;, Range[0, DateDifference[startdate, enddate]]]; dailycount = {#, Count[sentdates, {Sequence @@ #[[;; 3]], __}]} &amp; /@ dailycount;" width="432" height="92" /></p>
<p><img class="alignleft size-full wp-image-10152" style="border: 0px;" title="senttally = SortBy[Tally[dailycount[[All, 2]]], First]" src="http://blog.wolfram.com/data/uploads/2012/04/Email-In27.png" alt="senttally = SortBy[Tally[dailycount[[All, 2]]], First]" width="418" height="16" /></p>
<p><img class="alignleft size-full wp-image-10153" style="border: 0px;" title="{{0, 1183}, {1, 316}, {2, 174}, {3, 95}, {4, 44}, {5, 25}, {6, 17}, {7, 16}, {8, 8}, {9, 4}, {10, 2}, {11, 5}, {12, 1}, {13, 1}, {14, 1}, {15, 1}}" src="http://blog.wolfram.com/data/uploads/2012/04/Email-Out27.png" alt="{{0, 1183}, {1, 316}, {2, 174}, {3, 95}, {4, 44}, {5, 25}, {6, 17}, {7, 16}, {8, 8}, {9, 4}, {10, 2}, {11, 5}, {12, 1}, {13, 1}, {14, 1}, {15, 1}}" width="390" height="46" /></p>
<p>The distribution peaks sharply at zero, which means I most often send no emails in a day (from my Gmail account that is). I&#8217;m a low-frequency emailer apparently! The distribution of incoming mail per day is more interesting looking:</p>
<p><img class="alignleft size-full wp-image-10154" style="border: 0px;" title="distributionperday[incomingdates]" src="http://blog.wolfram.com/data/uploads/2012/04/Email-In28.png" alt="distributionperday[incomingdates]" width="282" height="16" /></p>
<p><img class="alignleft size-full wp-image-10155" style="border: 0px;" title="Distribution of incoming email per day" src="http://blog.wolfram.com/data/uploads/2012/04/Email-Out28.png" alt="Distribution of incoming email per day" width="272" height="155" /></p>
<p>This looks like it could be a <a href="http://reference.wolfram.com/mathematica/ref/NegativeBinomialDistribution.html" target="_self">negative binomial distribution</a>:</p>
<p><img class="alignleft size-full wp-image-10156" style="border: 0px;" title="{startdate, enddate} = Sort[incomingdates][[{1, -1}]]; dailycount = Map[DatePlus[startdate, #] &amp;, Range[0, DateDifference[startdate, enddate]]]; dailycount = {#, Count[incomingdates, {Sequence @@ #[[;; 3]], __}]} &amp; /@ dailycount;" src="http://blog.wolfram.com/data/uploads/2012/04/Email-In29.png" alt="{startdate, enddate} = Sort[incomingdates][[{1, -1}]]; dailycount = Map[DatePlus[startdate, #] &amp;, Range[0, DateDifference[startdate, enddate]]]; dailycount = {#, Count[incomingdates, {Sequence @@ #[[;; 3]], __}]} &amp; /@ dailycount;" width="461" height="94" /></p>
<p><img class="alignleft size-full wp-image-10157" style="border: 0px;" title="incomingtally = SortBy[Tally[dailycount[[All, 2]]], First]" src="http://blog.wolfram.com/data/uploads/2012/04/Email-In32.png" alt="" width="448" height="18" /></p>
<p><img class="alignleft size-full wp-image-10158" style="border: 0px;" title="{{0, 226}, {1, 321}, {2, 301}, {3, 287}, {4, 206}, {5, 124}, {6, 102}, {7, 73}, {8, 60}, {9, 42}, {10, 41}, {11, 32}, {12, 14}, {13, 25}, {14, 11}, {15, 5}, {16, 9}, {17, 7}, {19, 3}, {20, 3}, {21, 3}, {22, 1}, {23, 2}}" src="http://blog.wolfram.com/data/uploads/2012/04/Email-Out32.png" alt="{{0, 226}, {1, 321}, {2, 301}, {3, 287}, {4, 206}, {5, 124}, {6, 102}, {7, 73}, {8, 60}, {9, 42}, {10, 41}, {11, 32}, {12, 14}, {13, 25}, {14, 11}, {15, 5}, {16, 9}, {17, 7}, {19, 3}, {20, 3}, {21, 3}, {22, 1}, {23, 2}}" width="417" height="64" /></p>
<p><img class="alignleft size-full wp-image-10159" style="border: 0px;" title="negbinomial = EstimatedDistribution[dailycount[[All, 2]], NegativeBinomialDistribution[n, p]]" src="http://blog.wolfram.com/data/uploads/2012/04/Email-In33.png" alt="negbinomial = EstimatedDistribution[dailycount[[All, 2]], NegativeBinomialDistribution[n, p]]" width="443" height="31" /></p>
<p><img class="alignleft size-full wp-image-10160" style="border: 0px;" title="NegativeBinomialDistribution[1.73158, 0.313283]" src="http://blog.wolfram.com/data/uploads/2012/04/Email-Out33.png" alt="NegativeBinomialDistribution[1.73158, 0.313283]" width="380" height="17" /></p>
<p><img class="alignleft size-full wp-image-10161" style="border: 0px;" title="fillcolor = RGBColor[0.9196002136263065`, 0.7993438620584421`, 0.19940489814602885`, 0.5`]; edgecolor = RGBColor[0.8442206454566262`, 0.5068284122987716`, 0.13566796368352788`];" src="http://blog.wolfram.com/data/uploads/2012/04/Email-In34.png" alt="fillcolor = RGBColor[0.9196002136263065`, 0.7993438620584421`, 0.19940489814602885`, 0.5`]; edgecolor = RGBColor[0.8442206454566262`, 0.5068284122987716`, 0.13566796368352788`];" width="481" height="61" /></p>
<p><img class="alignleft size-full wp-image-10162" style="border: 0px;" title="Code building a histogram of negative binomial distribution of incoming emails per day" src="http://blog.wolfram.com/data/uploads/2012/04/Email-In35.png" alt="Code building a histogram of negative binomial distribution of incoming emails per day" width="424" height="256" /></p>
<p><img class="alignleft size-full wp-image-10163" style="border: 0px;" title="Histogram of negative binomial distribution of incoming emails per day" src="http://blog.wolfram.com/data/uploads/2012/04/Email-Out35.png" alt="Histogram of negative binomial distribution of incoming emails per day" width="272" height="144" /></p>
<p>It&#8217;s fun to think about what this kind of distribution implies about the underlying process of receiving email. The standard interpretation of the negative binomial distribution <tt>NegativeBinomialDistribution[n,p]</tt> is the probability in a series of <em>n</em> + <em>k</em> trials that <em>k</em> failures happen before <i>n</i> successes occur, where the probability of success for each trial is <em>p</em>. It&#8217;s not immediately clear whether that&#8217;s a good model for the number of emails I receive in a day. What would the individual Bernoulli trials correspond to? (Actually, the fit is a little better to a beta negative binomial distribution, which allows the success probability <em>p</em> to vary over a beta distribution.)</p>
<p>We did all this analysis just using email time stamps! And it&#8217;s just the tip of the iceberg of what it&#8217;s possible to do with your email archive. You could import the email addresses on each email to see whom you email most often and how your most common recipients have changed over time. Or you could correlate sent mail to received mail to track message threads and plot things like thread length distribution or time delay in responding to emails. When you&#8217;re doing your analysis in <em>Mathematica</em>, the possibilities are endless.</p>
<p>You can find all the code I used in this post <a href="http://blog.wolfram.com/data/uploads/2012/04/EmailAnalyticsCode.zip" target="_self">right here</a>. Have fun!</p>
<p><a href="http://blog.wolfram.com/data/uploads/2012/04/EmailAnalyticsBlogPost.cdf" target="_blank">Download this post as a Computable Document Format (CDF) file</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.wolfram.com/2012/04/05/analyzing-your-email-with-mathematica/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Making of the &#8220;Facts of the Moment&#8221; Plaque for the David Cameron Visit</title>
		<link>http://blog.wolfram.com/2012/03/28/making-of-the-facts-of-the-moment-plaque-for-the-david-cameron-visit/</link>
		<comments>http://blog.wolfram.com/2012/03/28/making-of-the-facts-of-the-moment-plaque-for-the-david-cameron-visit/#comments</comments>
		<pubDate>Wed, 28 Mar 2012 18:12:11 +0000</pubDate>
		<dc:creator>Jon McLoone</dc:creator>
				<category><![CDATA[Recreational Computation]]></category>

		<guid isPermaLink="false">http://blog.internal.wolfram.com/?p=10013</guid>
		<description><![CDATA[Several people have asked me to write about the virtual plaque that we made for the official opening of the Wolfram Research Europe office by UK Prime Minister David Cameron. The concept that came out of the short brainstorming meeting was to have a button on an iPad that would trigger a video on our [...]]]></description>
			<content:encoded><![CDATA[<p>Several people have asked me to write about the virtual plaque that we made for the official <a href="http://blog.wolfram.com/2012/02/27/united-kingdom-prime-minister-david-cameron-visits-wolfram-research/">opening of the Wolfram Research Europe office by UK Prime Minister David Cameron</a>.</p>
<p>The concept that came out of the short brainstorming meeting was to have a button on an iPad that would trigger a video on our display board, leading to an image showing facts about the world at the moment of revelation.</p>
<p><img src="http://blog.wolfram.com/data/uploads/2012/03/David-Cameron-Plaque.png" style="border: 0pt none;" alt="David Cameron Plaque" title="David Cameron Plaque" width="500" height="281" class="alignleft size-full wp-image-10014" /></p>
<p>This is the story of how we made it happen.<span id="more-10013"></span></p>
<p>I start with a disclaimer—this is not an example of elegant coding or optimal use of <a href="http://www.wolfram.com/mathematica" target="_self"><i>Mathematica</i></a>, but is a real-life story of implementing an under-specified idea (subject to feature creep) quickly and with no regard for future maintenance—in short, like a lot of software projects.</p>
<p>Jeremy Davis, Wolfram&#8217;s Design Director, quickly produced a mockup in Photoshop of what it might look like while I set about building the data extraction code.</p>
<p>I knew that pulling data from <a href="http://www.wolframalpha.com" target="_self">Wolfram|Alpha</a> and visualizing it would be easy, but what occupied my thoughts were the potential network failures, Wolfram|Alpha failures, local CPU overloads, or other horrors that could transpire to embarrass me in front of the PM!</p>
<p>So I started with a function that would query Wolfram|Alpha with a failure mode that would return a previous query result if no valid answer came within 20 seconds:</p>
<p><img src="http://blog.wolfram.com/data/uploads/2012/03/Plaque-In1.png" alt="safeWAGet[expr___] := Block[{rawdata = TimeConstrained[WolframAlpha[expr], 20, $Failed]}, If[rawdata === $Failed || Head[rawdata] === Missing || rawdata === {}, rawdata = $LastGood[expr], $LastGood[expr] = rawdata]; rawdata]; SetAttributes[safeWAGet, HoldFirst];" title="safeWAGet[expr___] := Block[{rawdata = TimeConstrained[WolframAlpha[expr], 20, $Failed]}, If[rawdata === $Failed || Head[rawdata] === Missing || rawdata === {}, rawdata = $LastGood[expr], $LastGood[expr] = rawdata]; rawdata]; SetAttributes[safeWAGet, HoldFirst];" width="430" height="155" style="border:0px" class="alignleft size-full wp-image-10034" /></p>
<p>Likewise, here is a version of <a href="http://reference.wolfram.com/mathematica/ref/First.html" target="_self"><tt>First</tt></a>, which won&#8217;t complain if there is no first element, but will instead return something invisible.</p>
<p><img src="http://blog.wolfram.com/data/uploads/2012/03/Plaque-In3.png" alt="safeFirst[expr_] := If[Length[expr] === 0, &quot;&quot;, First[expr]]" title="safeFirst[expr_] := If[Length[expr] === 0, &quot;&quot;, First[expr]]" width="449" height="19"  style="border:0px" class="alignleft size-full wp-image-10036" /></p>
<p>Anticipating that the design and color scheme would change repeatedly (though in the end it never did), I separated out the style choices:</p>
<p><img src="http://blog.wolfram.com/data/uploads/2012/03/Plaque-In4.png" alt="backgroundColor = RGBColor[0.3333333, 0.4588235294, 0.611764]; textColor = RGBColor[0.9, 1, 1]; fontOpts =  Apply[Sequence, {FontColor -&gt; textColor, Background -&gt; backgroundColor, FontSize -&gt; 14, FontFamily -&gt; &quot;Arial&quot;}];" title="backgroundColor = RGBColor[0.3333333, 0.4588235294, 0.611764]; textColor = RGBColor[0.9, 1, 1]; fontOpts =  Apply[Sequence, {FontColor -&gt; textColor, Background -&gt; backgroundColor, FontSize -&gt; 14, FontFamily -&gt; &quot;Arial&quot;}];" width="477" height="93" style="border:0px" class="alignleft size-full wp-image-10038" /></p>
<p>To get the right arguments for the <a href="http://reference.wolfram.com/mathematica/ref/WolframAlpha.html" target="_self"><tt>WolframAlpha</tt></a> function, the easiest way is to do a full linguistic query from the notebook by entering == followed by the query. If you then click in the pod corner and select either &#8220;Subpod content&#8221; or &#8220;Computable data&#8221; from the popup menu, you get the API code generated for you automatically. </p>
<p>For example, the parameters for our current local weather are <tt>"weather oxford",{{"InstantaneousWeather:WeatherData",1},"ComputableData"}</tt>. With some styling and text substitution, I end up with this code for generating the final image pod:</p>
<p><img src="http://blog.wolfram.com/data/uploads/2012/03/Plaque-In7.png" alt="weatherPodFinal[] := ImageCrop[Block[{temp, cover, humid, speed, dir}, {temp, cover, humid, speed} = safeWAGet[&quot;weather oxford&quot;, {{&quot;InstantaneousWeather:WeatherData&quot;, 1}, &quot;ComputableData&quot;}][[1, All, 2]]; dir = StringReplace[safeWAGet[&quot;wind direction oxford&quot;, {{&quot;Result&quot;, 1}, &quot;Plaintext&quot;}], {x__ ~~ &quot;&#176; &quot; -&gt; &quot;&quot;, &quot; (&quot; ~~ ___ -&gt; &quot;&quot;}]; Graphics[{Text[Style[Row[{Round[5/9 (temp - 32)], &quot;&#176;C&quot;, Style[&quot;  |  &quot;, RGBColor[0.62, 0.75, 0.89]], cover, Style[&quot;  |  &quot;, RGBColor[0.62, 0.75, 0.89]], &quot;wind: &quot;, dir, &quot; at &quot;, speed, &quot;mph&quot;, Style[&quot;  |  &quot;, RGBColor[0.62, 0.75, 0.89]], &quot;humidity:&quot;, humid, &quot;%&quot;}], fontOpts], {0, 0}]}, Background -&gt; backgroundColor]]];" title="weatherPodFinal[] := ImageCrop[Block[{temp, cover, humid, speed, dir}, {temp, cover, humid, speed} = safeWAGet[&quot;weather oxford&quot;, {{&quot;InstantaneousWeather:WeatherData&quot;, 1}, &quot;ComputableData&quot;}][[1, All, 2]]; dir = StringReplace[safeWAGet[&quot;wind direction oxford&quot;, {{&quot;Result&quot;, 1}, &quot;Plaintext&quot;}], {x__ ~~ &quot;&#176; &quot; -&gt; &quot;&quot;, &quot; (&quot; ~~ ___ -&gt; &quot;&quot;}]; Graphics[{Text[Style[Row[{Round[5/9 (temp - 32)], &quot;&#176;C&quot;, Style[&quot;  |  &quot;, RGBColor[0.62, 0.75, 0.89]], cover, Style[&quot;  |  &quot;, RGBColor[0.62, 0.75, 0.89]], &quot;wind: &quot;, dir, &quot; at &quot;, speed, &quot;mph&quot;, Style[&quot;  |  &quot;, RGBColor[0.62, 0.75, 0.89]], &quot;humidity:&quot;, humid, &quot;%&quot;}], fontOpts], {0, 0}]}, Background -&gt; backgroundColor]]];" width="471" height="321" style="border:0px" class="alignleft size-full wp-image-10040" /></p>
<p><img src="http://blog.wolfram.com/data/uploads/2012/03/Plaque-In8.png" alt="weatherPodFinal[]" title="weatherPodFinal[]" width="166" height="17" style="border:0px" class="alignleft size-full wp-image-10042" /></p>
<p><img src="http://blog.wolfram.com/data/uploads/2012/03/Plaque-Out8.png" alt="18&#176; | clear | wind: E at 6.mph | humidity:28%" title="18&#176; | clear | wind: E at 6.mph | humidity:28%" width="350" height="19" style="border:0px" class="alignleft size-full wp-image-10043" /></p>
<p>The <a href="http://reference.wolfram.com/mathematica/ref/ImageCrop.html" target="_self"><tt>ImageCrop</tt></a> part I will explain in a minute.</p>
<p>Images are a little trickier, as Wolfram|Alpha returns the Computable Document Format (<a href="http://www.wolfram.com/cdf" target="_self">CDF</a>) structure of the image rather than the semantic structure. So I first used <a href="http://reference.wolfram.com/mathematica/ref/ToExpression.html" target="_self"><tt>ToExpression</tt></a> to turn it into a meaningful <a href="http://reference.wolfram.com/mathematica/ref/Graphics.html" target="_self"><tt>Graphics</tt></a> expression, and then used replacement rules to swap out colors and fonts from the Wolfram|Alpha defaults to Jeremy&#8217;s design. I made a function for this:</p>
<p><img src="http://blog.wolfram.com/data/uploads/2012/03/Plaque-In91.png" alt="processPod[pod_, opts___] := Show[ToExpression[pod] /. {RGBColor[___] -&gt; textColor, x_Polygon -&gt; {backgroundColor, x}, x_Line -&gt; {textColor, x}, Inset[str_, coords_, opts2___] -&gt; Inset[Style[str, textColor, Background -&gt; backgroundColor], coords, opts2, Background -&gt; backgroundColor]} /. Style[txt_String, rest___] -&gt; Style[txt, FontColor -&gt; textColor,  Background -&gt; backgroundColor], Background -&gt; backgroundColor,  opts];" title="processPod[pod_, opts___] := Show[ToExpression[pod] /. {RGBColor[___] -&gt; textColor, x_Polygon -&gt; {backgroundColor, x}, x_Line -&gt; {textColor, x}, Inset[str_, coords_, opts2___] -&gt; Inset[Style[str, textColor, Background -&gt; backgroundColor], coords, opts2, Background -&gt; backgroundColor]} /. Style[txt_String, rest___] -&gt; Style[txt, FontColor -&gt; textColor,  Background -&gt; backgroundColor], Background -&gt; backgroundColor,  opts];" width="431" height="200" style="border:0px" class="alignleft size-full wp-image-10045" /></p>
<p>Here is the <tt>skyPod</tt> using that (as it appears today):</p>
<p><img src="http://blog.wolfram.com/data/uploads/2012/03/Plaque-In10.png" alt="skyPodFinal[] := processPod[safeWAGet[&quot;star chart witney&quot;, {{&quot;SkyMap:AstronomicalData&quot;, 1}, &quot;Content&quot;}][[1]], ImageSize -&gt; 344];" title="skyPodFinal[] := processPod[safeWAGet[&quot;star chart witney&quot;, {{&quot;SkyMap:AstronomicalData&quot;, 1}, &quot;Content&quot;}][[1]], ImageSize -&gt; 344];" width="431" height="77" style="border:0px" class="alignleft size-full wp-image-10048" /></p>
<p><img src="http://blog.wolfram.com/data/uploads/2012/03/Plaque-In11.png" alt="skyPodFinal[]" title="skyPodFinal[]" width="137" height="18" style="border:0px" class="alignleft size-full wp-image-10050" /></p>
<p><img src="http://blog.wolfram.com/data/uploads/2012/03/Plaque-Out11.png" alt="Final skyPod result" title="Final skyPod result" width="390" height="348" style="border:0px" class="alignleft size-full wp-image-10051" /></p>
<p>The other pods were variations on these and can be downloaded at the bottom of this post. Happy with this, I sent the code off to Jeremy with a rough <a href="http://reference.wolfram.com/mathematica/ref/Grid.html" target="_self"><tt>Grid</tt></a> structure to put them all together and went home. </p>
<p>Jeremy works in a different time zone and so had final formatted versions ready for me when I came in the next day. But he obviously thinks differently from me, as he took my symbolic graphics expressions, turned them into bitmap images, and used <i>Mathematica</i>&#8216;s image-processing commands to size them and assemble them into a Photoshop-generated background image (this is where the <tt>ImageCrop</tt> I mentioned earlier came from). This is not how I would have done it, but there was no time to argue about programming style!</p>
<p>Now it was time to address the first real problem. All these web queries (over a UK ISP) meant that it took sometimes over 20 seconds to get all the components of the final image. Far too long to keep the Prime Minister waiting. So I split the assembly into three parts: pods that don&#8217;t change much (such as the planet locations), pods that change sometimes (such as the star chart, which changes about once per minute), and pods that change all the time (such as share prices). I also created an error-resistant version of <a href="http://reference.wolfram.com/mathematica/ref/ImageCompose.html" target="_self"><tt>ImageCompose</tt></a> that wouldn&#8217;t fail if one of the images turned out not to be an image.</p>
<p><img src="http://blog.wolfram.com/data/uploads/2012/03/Plaque-In12.png" alt="imageComposeSafe[expr1_Image, expr2_Image, more___] := ImageCompose[expr1, expr2, more]; imageComposeSafe[expr1_, expr2_Image, more___] := expr2; imageComposeSafe[expr1_Image, expr2_, more___] := expr1;" title="imageComposeSafe[expr1_Image, expr2_Image, more___] := ImageCompose[expr1, expr2, more]; imageComposeSafe[expr1_, expr2_Image, more___] := expr2; imageComposeSafe[expr1_Image, expr2_, more___] := expr1;" width="433" height="62" style="border:0px" class="alignleft size-full wp-image-10052" /></p>
<p>Here is the modified version of his code for the slow refresh (most of the code is position and size information):</p>
<p><img src="http://blog.wolfram.com/data/uploads/2012/03/Plaque-In15.png" alt="Code for the slow refresh elements" title="Code for the slow refresh elements" width="454" height="314" style="border:0px" class="alignleft size-full wp-image-10053" /></p>
<p>And then the fast refresh elements added in:</p>
<p><img src="http://blog.wolfram.com/data/uploads/2012/03/Plaque-In16.png" alt="buildFastImage[bimg_Image] := Image[imageComposeSafe[bimg, ftsePodFinal[], {0, 0}, {-22, -30}], ImageSize -&gt; 944];" title="buildFastImage[bimg_Image] := Image[imageComposeSafe[bimg, ftsePodFinal[], {0, 0}, {-22, -30}], ImageSize -&gt; 944];" width="422" height="48" style="border:0px" class="alignleft size-full wp-image-10054" /></p>
<p>And finally, the parts that absolutely had to be real-time:</p>
<p><img src="http://blog.wolfram.com/data/uploads/2012/03/Plaque-In17.png" alt="buildFinalImage[bimg_Image] := buildFinalImage[bimg, AbsoluteTime[]]" title="buildFinalImage[bimg_Image] := buildFinalImage[bimg, AbsoluteTime[]]" width="327" height="33" style="border:0px" class="alignleft size-full wp-image-10055" /></p>
<p><img src="http://blog.wolfram.com/data/uploads/2012/03/Plaque-In18.png" alt="Adding in final elements that need to be real-time" title="Adding in final elements that need to be real-time" width="483" height="611" style="border:0px" class="alignleft size-full wp-image-10056" /></p>
<p>Having done all this, I formatted it as <a href="http://reference.wolfram.com/mathematica/tutorial/SettingUpMathematicaPackages.html" target="_self">a package</a> to be loaded with <b><tt>Needs["Plaque`"]</tt></b>.</p>
<p>You may have noticed that we faked Cameron&#8217;s age. Wolfram|Alpha does compute <a href="http://www.wolframalpha.com/input/?i=age+of+David+Cameron+in+days" target="_self">that data</a>, but that idea was added to the plaque at the very last moment, so there was no time to think about computing it.</p>
<p>The idea of splitting the code was to run the low-refresh parts only every 60 seconds and the medium-refresh parts every 10 seconds and write the latest version to disk. I did that by using <a href="http://reference.wolfram.com/mathematica/ref/CreateScheduledTask.html" target="_self"><tt>CreateScheduledTask</tt></a>. And to avoid the risk of a scheduled task causing the kernel to run slowly when it was called on, I put that into a second compute kernel using <a href="http://reference.wolfram.com/mathematica/ref/ParallelEvaluate.html" target="_self"><tt>ParallelEvaluate</tt></a>. </p>
<p><img src="http://blog.wolfram.com/data/uploads/2012/03/Plaque-In20.png" alt="ParallelEvaluate[Needs[&quot;Plaque`&quot;]; $BackgroundImage = buildSlowImage[]; StartScheduledTask[CreateScheduledTask[$BackgroundImage = buildSlowImage[], 60]]; StartScheduledTask[CreateScheduledTask[Export[&quot;ComponentTemp.jpg&quot;, buildFastImage[$BackgroundImage], &quot;JPEG&quot;, &quot;CompressionLevel&quot; -&gt; 0]; DeleteFile[&quot;Component.jpg&quot;]; RenameFile[&quot;ComponentTemp.jpg&quot;, &quot;Component.jpg&quot;], 10]], 1];" title="ParallelEvaluate[Needs[&quot;Plaque`&quot;]; $BackgroundImage = buildSlowImage[]; StartScheduledTask[CreateScheduledTask[$BackgroundImage = buildSlowImage[], 60]]; StartScheduledTask[CreateScheduledTask[Export[&quot;ComponentTemp.jpg&quot;, buildFastImage[$BackgroundImage], &quot;JPEG&quot;, &quot;CompressionLevel&quot; -&gt; 0]; DeleteFile[&quot;Component.jpg&quot;]; RenameFile[&quot;ComponentTemp.jpg&quot;, &quot;Component.jpg&quot;], 10]], 1];" width="465" height="199" style="border:0px" class="alignleft size-full wp-image-10057" /></p>
<p>That left my control kernel free to generate the final version and write that to disk every two seconds. It also maintained an archive, so I could retrieve the actual displayed image later.</p>
<p><img src="http://blog.wolfram.com/data/uploads/2012/03/Plaque-In21.png" alt="i = 1; While[True, Export[&quot;FactsOfTheMomentTemp.jpg&quot;, buildFinalImage[Import[&quot;Component.jpg&quot;], AbsoluteTime[]], &quot;JPEG&quot;, &quot;CompressionLevel&quot; -&gt; 0]; CopyFile[&quot;FactsOfTheMomentTemp.jpg&quot;, &quot;Archive\\&quot; &lt;&gt; ToString[i++] &lt;&gt; &quot;.jpg&quot;]; DeleteFile[&quot;image1.jpg&quot;]; RenameFile[&quot;FactsOfTheMomentTemp.jpg&quot;, &quot;image1.jpg&quot;];  Pause[2];]" title="i = 1; While[True, Export[&quot;FactsOfTheMomentTemp.jpg&quot;, buildFinalImage[Import[&quot;Component.jpg&quot;], AbsoluteTime[]], &quot;JPEG&quot;, &quot;CompressionLevel&quot; -&gt; 0]; CopyFile[&quot;FactsOfTheMomentTemp.jpg&quot;, &quot;Archive\\&quot; &lt;&gt; ToString[i++] &lt;&gt; &quot;.jpg&quot;]; DeleteFile[&quot;image1.jpg&quot;]; RenameFile[&quot;FactsOfTheMomentTemp.jpg&quot;, &quot;image1.jpg&quot;];  Pause[2];]" width="464" height="167" style="border:0px" class="alignleft size-full wp-image-10058" /></p>
<p>The use of <a href="http://reference.wolfram.com/mathematica/ref/RenameFile.html" target="_self"><tt>RenameFile</tt></a> was to reduce the chance that we tried to access the latest image while it was being written. Renaming is much faster than writing.</p>
<p>So now, thanks to this chain of web service calls to Wolfram|Alpha, symbolic  transformation, image processing, and scheduled tasks, the plaque image is rewritten to disk every two seconds, with no part of it more than 60 seconds old.</p>
<p>The rest was done outside of <i>Mathematica</i>, as we had a Flash video that we wanted to play, and Mathematica can&#8217;t embed Flash. In the end we dropped almost all of the video and could have used a CDF for the button, but the sequence was built by then. The iPad was linked by a horrible hack of remote desktoping to a PC that was in, turn, screen sharing another PC that was driving the display. An HTML button on the final machine called the Flash script, which played the movie and loaded the most recently generated <i>Mathematica</i> image to display when the movie finished.</p>
<p>And here was the moment of truth: I was standing behind the photographer and holding my breath, hoping I had considered and trapped all possible failures:</p>
<p><img src="http://blog.wolfram.com/data/uploads/2012/03/DavidCameronVisit.png" alt="United Kingdom Prime Minister David Cameron and Conrad Wolfram" title="United Kingdom Prime Minister David Cameron and Conrad Wolfram" width="500" height="333" style="border:0px" class="aligncenter size-full wp-image-10059" /></p>
<p><a href="http://blog.wolfram.com/data/uploads/2012/03/DavidCameronPlaque.cdf" target="_blank">Download this post with expanded code as a Computable Document Format (CDF) file</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.wolfram.com/2012/03/28/making-of-the-facts-of-the-moment-plaque-for-the-david-cameron-visit/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

