WOLFRAM

Data Analysis and Visualization

Computation & Analysis

Going Inside the Interface with Mathematica

Turning data into intelligence—that's the challenge for Joel Drouillard, a research analyst at BondDesk Group LLC, and he's tackling it with Mathematica. Using Mathematica's powerful data handling and data visualization capabilities, Drouillard is gaining a deeper understanding and more accurate picture of how clients are using BondDesk's platform to search for fixed income securities. In this video, he describes how Mathematica helps him go deeper inside the interface, resulting in richer insights at a more efficient rate than ever before.
Computation & Analysis

Planning a Trip? Ask Mathematica for the Itinerary.

With all the new aspects of Mathematica in Versions 6 and 7, I've enjoyed visiting universities to talk about how to use Mathematica in even more courses and research projects. Universities enjoy this, too! I am not, however, very good at thinking about the locations of universities or schools in terms of geography. Planning a trip was a seemingly endless task of cross-referencing maps and lists and notes and more lists---I'm sure you see a pattern forming here. The solution, as is often the case with me, was to use Mathematica. After finding a list of 7,000+ universities and colleges in the United States, I wrote a Mathematica program to create a list of all such schools near a particular city, complete with rough mileage and a map to use for my work.
Computation & Analysis

Interactive Angle Measurement with Mathematica

Consider the typical infographics found on the internet, many of which are only slightly less silly than this one by Jamie Schimley: If you want to regenerate a chart such as this in Mathematica using the PieChart function, you need hard data: the relative areas of the slices. You could eyeball the values and get an approximation, but since I deal with user interfaces I was immediately interested in creating one that would allow me to measure the angle of each sector of a pie chart. The following code creates locators that can be positioned to calculate the angle of any sector. Buttons let you record the angles as you measure them, and reproduce the chart at the end. (This could be done with less code, but I wanted a more complete interface with finishing touches like disabling the Print Chart button if you haven’t measured any angles yet, and showing the current angle with a tooltip.)
Computation & Analysis

Visualizing Weather Patterns in Mathematica 7

Weather visualizations are very interesting—there are television channels that thrive by showing nothing else. Online, there are several sources for specific maps of current weather conditions. Generally these are produced and maintained by government agencies or other large organizations. But with Mathematica 7, you can easily produce completely customizable weather visualizations on your own computer. As usual, this is made possible by Mathematica’s tight integration of several areas of functionality. Two new features that enable this particular application are powerful new vector visualization functions and built-in weather data. Vector visualization has been present in Mathematica since Version 2. In Mathematica 7 it has been dramatically improved, adding modern techniques in vector data visualization and new algorithms developed at Wolfram Research. Traditional arrow-based vector plots, new methods based on automatic streamline placement, support for vector glyphs and high-resolution images produced using line integral convolutions are all now supported.
Computation & Analysis

Mathematica for Web Analytics

Recent versions of Mathematica introduced an innovative way to interact with data. Computable data functions, such as CountryData and WeatherData, provide programmatic access to curated data in a form ready for computation. The idea of computable data has been so useful in Mathematica at large that we’ve been using it internally as well. We’ve packaged some of our internal data as in-house computable data functions, so that all of our colleagues can bring a quantitative edge to their work. I work on one such function: WebsiteData. We host several popular websites at Wolfram Research, so we collect a large volume of web server log data. WebsiteData provides access to our corpus of logs, which we can use to study how visitors interact with our websites. Here’s an example of WebsiteData in action. Let’s find the most popular demonstration from the Wolfram Demonstrations Project this past month: Whenever a visitor surfs to one of our webpages, our webservers (like all webservers) record the page requested, the time of the request, the URL of the page that had linked to our webpage (we call that the referrer) and the value of the visiter’s browser cookie and other incidentals. We’ve built up a rich interface in WebsiteData to provide statistics about these fundamental events aggregated in a variety of ways.
Computation & Analysis

Visualizing the Recent Yellowstone Earthquakes

A couple of days ago I read about an unusual “swarm” of earthquakes at Yellowstone National Park. After reading up on this topic a bit (and determining that my home state of Illinois would not be obliterated immediately by a supervolcano outburst), I decided to make an animation about it in Mathematica. First I searched for “yellowstone map sdts” on Google and downloaded this geological map of Yellowstone from the U.S. Geological Survey website. After uncompressing the zip file, I simply pointed Import to the top directory containing the SDTS files: The resulting graphic contains a lot of distracting detail, so I decided to extract just the polygons and give them a muted gray background color. What remains are the outline polygons for each geological layer as observed by the USGS. Also, I set the image size to 1280x720, which makes it suitable for a 720p high-definition video stream:
Computation & Analysis

Visualizing Integrals

Calculus II is one of my favorite classes to teach, and the course I’ve probably taught more than any other. One reason for its special place in my heart is that it begins on the first day of class with a straightforward, easily stated, yet mathematically rich question: what is the area of a curved region? Triangles and rectangles—figures with straight sides—have simple area formulas whose derivation is clear. More complicated polygons can be carved up into pieces that are triangles and rectangles. But how does one go about finding the area of a blob?

After simplifying the blob to be a rectangle whose top side has been replaced with a curve, the stage is set for one of the classic constructions in calculus. The area of our simplified blob, reinterpreted as the area under the graph of a function is approximated using a series of rectangles. The approximation is obtained by partitioning the x axis, thus slicing the region into narrow strips, then approximating each strip with a rectangle and summing all the resulting approximations to produce a Riemann sum. Taking a limit of this process by using more and narrower rectangles produces the Riemann integral that forms the centerpiece of Calculus II. Several Demonstrations from the Wolfram Demonstrations Project, including "Riemann Sums" by Ed Pegg Jr, "Common Methods of Estimating the Area under a Curve" by Scott Liao and "Riemann Sums: A Simple Illustration" by Phil Ramsden show that this construction and images like the one below from "Riemann Sums" are part of the iconography of calculus.
Best of Blog

Stock Market Returns by Presidential Party

The New York Times recently published an “Op-Chart” by Tommy McCall on its Opinion page showing what your returns would have been had you started with $10,000 in 1929 and invested it in the stock market, but only during the administrations of either Democratic or Republican presidents. His calculations showed that if you had invested only during Republican administrations you would now have $11,733 while if you had invested only during Democratic administrations you would now have $300,671. Twenty-five times as much!

That’s a pretty dramatic difference, but does it stand up to a closer look? Is it even mathematically plausible that you could have essentially no return on your investment at all over nearly 80 years, just by choosing to invest only during Republican administrations?

To answer these questions, I of course turned to Mathematica.

And the answer is that yes, it is mathematically plausible, using the assumptions made by McCall. My analysis using historical Dow Jones Industrial Average data available in Mathematica’s FinancialData function roughly matches the figures in the Times, which used Standard & Poor’s data. (I used the Dow because it’s more convenient, not because I think it’s a better measure.)

But the fact that they are correct doesn’t mean the figures are even remotely meaningful. Here are some problems with the New York Times’ Op-Chart:
Computation & Analysis

Analyzing US 2008 Elections with Mathematica

The 2008 United States presidential election is arguably the most interesting US presidential election in my lifetime.

Already, millions of Americans have registered to vote for the first time in their lives.

Regardless of the outcome, America is going to elect either its first black president or its first female vice president.

America will elect a sitting US senator to the highest office in the land—which, until now, has only occurred twice in US history (Warren Harding and John F. Kennedy were US senators).

Both presidential candidates were born outside of the continental United States.

If elected, John McCain will be the oldest sitting US president upon ascension to the presidency.

Never before in US history has there been such a large disparity in age between the two presidential candidates, either.

It’s also the first election you can analyze using Mathematica 6.