March Madness in Mathematica
It’s that time again when many of us begin to explore the pseudo-science of bracketology as the United States eagerly approaches the NCAA Men’s Basketball Tournament—March Madness. It’s a frenzied few weeks where statistical analysis and mathematical algorithms make a sudden leap from the desktops of professionals to the homes of millions of sports fans. As a sports fan and as an account manager working with Mathematica and Mathematica Home Edition, a wild idea occurred to me. Could someone with no professional programming training or mathematical degrees, like me, use Mathematica to create something of value, like a March Madness bracket, for someone else?
While I frequently support and work with some of the brightest engineers, scientists, and statisticians in the commercial world, my personal use of Mathematica has been fairly simplistic. What could I do?
I decided to find out.
My first challenge was to replicate the “look and feel” of the typical NCAA tournament bracket. These brackets are usually separated into the South, Midwest, East, and West regions, with a Finals region reserved for the Final Four teams. Using the Panel and Grid functions, I was able to quickly lay out my work space and simulate the bracket format.
Mathematica‘s symbolic nature allowed me to easily represent objects that contained graphical, textual, and numeric components. Here’s an example of how each team is represented on the brackets, with its school logo, school name, and seeding contained within the object.
My second task was to create an interface that was intuitive and easy to use. This was accomplished by using many of the new dynamic functions, such as Mouseover, PopupMenu, ActionMenu, and Button. These all operate seamlessly behind the scenes to react to the mouse clicks and movements we’ve all become so accustomed to when navigating tools and applications.
Here’s an example of two PopupMenus that, with other code, will allow users to compare any two teams in a given bracket. Each of the graphics is actually representing lists of data that have been scraped directly from a web page using the Import function, and I’ve used the PopupWindow function to provide a summary of each team’s statistics during the regular season.
My final challenge was to create an automated bracket scoring system, because one of the biggest headaches related to handwritten brackets is the scoring. And if you’re anything like I am, you’re not content with simply completing one bracket. There’s your home-team bracket (Go Illini!), your analytical bracket, your gut-feeling bracket, and maybe an upset bracket.
Armed with nothing more than a highlighter and pen, this can be a daunting task. However, knowing that Mathematica can easily import over 130 formats, I decided to use an Excel spreadsheet to update all of the winners as the NCAA Tournament progresses. Clicking the Mathematica application’s “Update Bracket Score” button will actually make a live connection to the Excel spreadsheet and update your bracket’s score automatically.
Now that my program is complete, I can sit back and watch how the tournament unfolds—simply clicking a button to update my bracket score. It was interesting to note that the majority of the code for this application took only about 10 Mathematica functions. With the power of Mathematica Home Edition, I can really look forward to enjoying the progress of the NCAA Men’s Basketball Tournament.
You can enjoy the NCAA Men’s Basketball Tournament too by using the completely mouse-driven application to complete your brackets, compare team stats, and score your brackets throughout the tournament. If you have a current copy of Mathematica or Mathematica Home Edition, you can download a copy of the application notebook here. Go team!
Disclaimer: This material is written and provided strictly for entertainment purposes and may not be used in connection with any form of gambling. Logos of these organizations are protected by copyright and/or trademark. All team logos were obtained from the SportsLogos.Net website. We believe that the limited use of small, low-resolution images of logos for certain identification purposes that are not competitive with the rights-holder qualify as fair use under United States copyright law.