Wolfram Computation Meets Knowledge

Best of Blog

Best of Blog

Modeling a Pandemic like Ebola with the Wolfram Language

Data is critical for an objective outlook, but bare data is not a forecast. Scientific models are necessary to predict pandemics, terrorist attacks, natural disasters, market crashes, and other complex aspects of our world. One of the tools for combating the ongoing and tragic Ebola outbreak is to make computer models of the virus's possible spread. By understanding where and how quickly the outbreak is likely to appear, policy makers can put into place effective measures to slow transmissions and ultimately bring the epidemic to a halt. Our goal here is to show how to set up a mathematical model that depicts a global spread of a pandemic, using real-world data. The model would apply to any pandemic, but we will sometimes mention and use current Ebola outbreak data to put the simulation into perspective. The results should not be taken as a realistic quantitative projection of current Ebola pandemic.
Best of Blog

Which Is Closer: Local Beer or Local Whiskey?

In today's blog post, we will use some of the new features of the Wolfram Language, such as language processing, geometric regions, map-making capabilities, and deploying forms to analyze and visualize the distribution of beer breweries and whiskey distilleries in the US. In particular, we want to answer the core question: for which fraction of the US is the nearest brewery further away than the nearest distillery? Disclaimer: you may read, carry out, and modify inputs in this blog post independent of your age. Hands-on taste tests might require a certain minimal legal age (check your countries' and states' laws). We start by importing two images from Wikipedia to set the theme; later we will use them on maps.
Best of Blog

Predicting Who Will Win the World Cup with Wolfram Language

Check out Etienne’s updated predictions from Thursday, June 26 here. The FIFA World Cup is underway. From June 12 to July 13, 32 national football teams play against each other to determine the FIFA world champion for the next four years. Who will succeed? Experts and fans all have their opinions, but is it possible to answer this question in a more scientific way? Football is an unpredictable sport: few goals are scored, the supposedly weaker team often manages to win, and referees make mistakes. Nevertheless, by investigating the data of past matches and using the new machine learning functions of the Wolfram Language Predict and Classify, we can attempt to predict the outcome of matches. The first step is to gather data. FIFA results will soon be accessible from Wolfram|Alpha, but for now we have to do it the hard way: scrape the data from the web. Fortunately, many websites gather historical data (www.espn.co.uk, www.rsssf.com, www.11v11.com, etc.) and all the scraping and parsing can be done with Wolfram Language functions. We first stored web pages locally using URLSave and then imported these pages using Import[myfile,"XMLObject"] (and Import[myfile,"Hyperlinks"] for the links). Using XML objects allows us to keep the structure of the page, and the content can be parsed using Part and pattern-matching functions such as Cases. After the scraping, we cleaned and interpreted the data: for example, we had to infer the country from a large number of cities and used Interpreter to do so: From scraping various websites, we obtained a dataset of about 30,000 international matches of 203 teams from 1950 to 2014 and 75,000 players. Loaded into the Wolfram Language, its size is about 200MB of data. Here is a match and a player example stored in a Dataset:
Best of Blog

Using Formulas… for Everything—From a Complex Analysis Class to Political Cartoons to Music Album Covers

In my last blog post, I discussed how to construct closed-form trigonometric formulas for sketches of people’s faces. Using similar techniques, Wolfram|Alpha has recently added a collection of hundreds of such closed-form curves for faces, shapes, animals, logos and signatures. In today’s post, I want to show some of the entertaining things one can do with these parametrized curves. Although these are just simple curves, a large variety of fun images (and animations) can be constructed from them. These can then be used, for example, in political cartoons, talk shows, posters, music album covers or just to spice up an advanced calculus or first-year theoretical mechanics class. I will first discuss the fun applications, and then the more mathematical ones.
Best of Blog

Using Mathematica to Simulate and Visualize Fluid Flow in a Box

The motion of fluid flow has captured the interest of philosophers and scientists for a long time. Leonardo da Vinci made several sketches of the motion of fluid and made a number of observations about how water and air behave. He often observed that water had a swirling motion, sometimes big and sometimes small, as shown in the sketch below. We would now call such swirling motions vortices, and we have a systematic way of understanding the behavior of fluids through the Navier–Stokes equations. Let's first start with understanding these equations.
Best of Blog

Is There Any Point to the 12 Times Table?

My government (I'm in the UK) recently said that children here should learn up to their 12 times table by the age of 9. Now, I always believed that the reason why I learned my 12 times table was because of the money system that the UK used to have---12 pennies in a shilling. Since that madness ended with decimalization the year after I was born, by the late 1970s when I had to learn my 12 times table, it already seemed to be an anachronistic waste of time.
Best of Blog

Data Science of the Facebook World

More than a million people have now used our Wolfram|Alpha Personal Analytics for Facebook. And as part of our latest update, in addition to collecting some anonymized statistics, we launched a Data Donor program that allows people to contribute detailed data to us for research purposes. A few weeks ago we decided to start analyzing […]

Best of Blog

Code Length Measured in 14 Languages

Update: See our latest post on How the Wolfram Language Measures Up. I stumbled upon a nice project called Rosetta Code. Their stated aim is "to present solutions to the same task in as many different languages as possible, to demonstrate how languages are similar and different, and to aid a person with a grounding in one approach to a problem in learning another." After amusing myself by contributing a few solutions (Flood filling, Mean angle, and Sum digits of an integer being some of mine), I realized that the data hidden in the site provided an opportunity to quantify a claim that I have often made over the years—that Mathematica code tends to be shorter than equivalent code in other languages. This is due to both its high-level nature and built-in computational knowledge. Here is what I found. Mathematica code is typically less than a third of the length of the same tasks written in other languages, and often much better.
Best of Blog

Automating xkcd Diagrams: Transforming Serious to Funny

On early Monday morning I noticed an interesting question posted on Mathematica Stack Exchange titled quite innocently "xkcd-style graphs." Due to the popularity of Randall Munroe's xkcd web comic, I expected a bit more than average of about ten or so up-votes, a few bookmarks. Little did I know. Spontaneously emerging viral events are hard to predict, so if you are lucky to catch one, it is fascinating to watch its propagation across the web and the growth of its ranks. In a matter of two days, this post received more than 100,000 views, 200 up-votes, and 150 bookmarks; produced responses and similar posts across other Stack Exchange communities; triggered a small tornado on Twitter; and was discussed on Hacker News and reddit. For convenience, I repeat Amatya's original post and example xkcd image here: "I received an email to which I wanted to respond with a xkcd-style graph, but I couldn't manage it. Everything I drew looked perfect, and I don't have enough command over Plot Legends to have these pieces of text floating around. Any tips on how one can create xkcd-style graphs? Where things look hand-drawn and imprecise. I guess drawing weird curves must be especially hard in Mathematica."