OR/MS Today - December 2009



Software Review


Mathematica 7

Presentation features, parallel computing capability and graphs add up to impressive upgrade for versatile, venerable product from Wolfram Research.

By ManMohan S. Sodhi


I have reviewed different versions of Mathematica in OR/MS Today from different viewpoints. The present review focuses on presentation features, parallel computing given the multi-core chips that modern desktops have, and displaying graphs.

Previous Versions


Going back to previous versions of the software, in the December 2003 issue, I reviewed Mathematica 5 from operations research professionals' viewpoint [1]. I wrote how version 5 is compelling for O.R. professionals who may have been intrigued by Mathematica software in the past but did not consider it useful for their profession over the numerical and statistical packages they already use. Version 5 introduced advanced numerical analysis, linear programming — interior point as well as simplex method variants — and sparse matrix manipulation with fast algorithms that compete with dedicated numerical software tools.

Subsequently, in the December 2004 issue, I reviewed version 5.1 that had a long list of enhancements for numerical computation, symbolic computation, language system, etc [2]. I focused on the added Internet, GUI and data handling features. The GUIKit allowed a user to create a GUI running on top of Mathematica for other users to do specific things. Mathematica 5.1 gave access to Web services offered by other providers (e.g., Amazon) as a Mathematica function. It also allowed better access to spreadsheets (MS Excel) and databases.

Following that, in the October 2007 issue, I reviewed version 6.0 (or more specifically, 6.0.1.0). This was a major upgrade to the extent that Mathematica 6 would analyze notebooks files created by older versions to diagnose which function calls need to be modified. New features or enhancements included combinatorial optimization, constrained nonlinear optimization, exploratory data analysis, symbolic statistical computing and extended array operations. My review covered the "manipulate" function; data visualization and the introduction of pre-defined color schemes like PlumColors or Thermometer Colors; and most of all, data sets including financial data sets. I also commented on the limitations of word processing and typesetting using TeX/LaTex, expressing my wish that Mathematica should introduce Publicon's (another Wolfram product that remains in version 1) ease of use in future versions — this seems to have been largely accomplished.

Presentation Features


Mathematica 7 embellishes presentation graphics in a number of ways but one notable one, present usually in high-end presentation graphics software, is the ability to use any symbol, e.g., peanuts to show academic salaries, to make a point. Consider the following example where I used "V" for videos to make a bar chart of number of downloads for a sample of videos on Youtube.

software review

Figure 1: Number of downloads for a sample of videos on Youtube.

To do this, I entered the following command in Mathematica:

BarChart[{11016, 8076, 5277, 2902, 2784, 2764, 2651, 2611, 2507, 2322, 23arrow, 2148, 2066,
1323, 1286, 1263, 1246, 1192, 1121, 1021, 1005, 863, 851, 842, 792}, ChartElements ->
Graphics[Text[Style[  , 10]]] ] 

Then I right-clicked on the graph within Mathematica to get Drawing Tools to add the legend! Instead of the video symbol in the command, you can put any symbol. The widgets in Drawing Tools enable you to "draw" directly on the chart produced so you can highlight whatever it is that you want to emphasize.

Creating a Spreadsheet-Type Data Entry into a Table


When you have a large two-dimension table, it may be easier to enter the data into a tabular form than into a comma-separated string. This is accomplished by TableView and a "blank" space called Placeholder. To enter data into a blank 3x5 table, we do the following

Table[Placeholder["?"], {i, 1, 3}, {j, 1, 5}] // TableView 

to obtain a table as shown in Figure 2. Then you can type in each cell followed by a <shift><return> to accept the new values.

software review

Figure 2: Blank table for data entry.

The benefit of doing so is limited to two-dimension tables — for higher dimension tables, each cell becomes a list so for a 3-D table, each cell would be a pair.

Note that TableView is actually an undocumented feature intended for version 8 and therefore the functionality is not yet fully defined. I hope that the next version allows users to cut-and-paste data from Excel into a table in Mathematica using TableView. Likewise, I could not copy-and-paste data from Mathematica's TableView into Excel but I hope future versions of Mathematica will provide this.

There are other ways of getting data from Excel, though. One is purchasing an Excel link software that allows dynamic calls either way and copy-and-paste. Another way is using the "Import" command such as

data=Import ["myfile.xls"]
. One can also drag an .XLS file onto a Mathematica notebook, and it will import it and paste the result into the selection in Mathematica notation. MS Excel 2007 format .xlsx will be supported only in version 8 so you have to convert your .xlsx files to .xls before importing into Mathematica 7.

Parallel Computing


While parallel computing is not important for many of us, Mathematica 7 shows what is possible, not just those with a two-processor quad-core Apple desktop that has effectively eight processors but also the rest of us whose desktops are dual core and therefore have two processors. A simple illustration would be using whatever number of processors we have on our machine to get faster results with simulation.

My laptop has a dual-core processor, hence two processors. I can evaluate an expression, say, getting a random number between 0 and 1, in parallel on both of these as follows:

ParallelEvaluate[RandomReal[]] 

and obtain something like

{0.391231,0.10254} 

as a result. If I had one of those fancy Apple desktops, I would get eight random numbers as a result. Of course, the expression that is a parameter of ParallelEvaluate can be as complicated a program as you want, so you would be running the program in parallel on both processors.

Supposing I wanted two different sums of 20 million random numbers, each between 0 and 1, I can do the following on a single processor machine:

Total[RandomReal[1, 20000000]] // Timing 

to obtain the results that may look like this

{0.765, 1.00011*10^7} 

This means the computation took 0.765 seconds. Then I have to do it again to get the second sum. Or, if I have a two-processor machine, then I can do

ParallelEvaluate Total[RandomReal[1, 20000000]] // Timing] 

to obtain results that may look like this

{{0.953, 1.00004*10^7}, {1.016, 9.99883*10^6}} 

with the processors taking 0.953 and 1.016 seconds, respectively, but in parallel.

I have not explored this feature much, but at least you can see what is possible even with a normal laptop using Mathematica 7.

Graphs


Suppose I had an undirected random graph G. A node-node representation would be a random matrix with 0 or 1 entries that I can get in Mathematica as

R = RandomInteger[1,{10,10}]

This gives a 10x10 matrix where each cell has a 50-50 chance of being a 0 or a 1. Then a pictorial depiction of the graph can be obtained as follows

GraphPlot[R, VertexLabeling -> True]

with the results as in Figure 3.

software review

Figure 3: A random 10-node graph.

Wish List


In the version 6 review, there were two items on my wish list: (1) extending the ease of use and functionality of wordprocessing/typesetting within Mathematica, and (2) being able to use the features it already has to create linear programming problems as with languages like AMPL or OPL. With version 7, it seems that the first is pretty much there. The second can be achieved with manipulation using the Mathematica programming language, but AMPL or OPL programs would be much more readable.

Now what I wish sometimes, only half-jokingly, is to wean myself away from MS Office and move to Mathematica 7 lock, stock and barrel. Recently, I had to make some frequency charts from some data in Excel and I found it was easier to create them in Mathematica. Of course there are deterrents: the learning curve, the not-so-seamless process of getting data from a spreadsheet into Mathematica, and the problem of sharing output files with others who are non-Mathematica users. Mathematica does not claim to compete against MS Office.

More seriously, my wish list would include a series of tutorials on different features of Mathematica so I don't have to read any of the tomes available in bookstores. There are tutorials now but you have to know what you are looking for. Copying-and-pasting data from and to Excel would be wonderful. I should also mention Wolfram's "computational" search engine — Wolfram Alpha — that I tried but found to be quite different and non-intuitive relative to other search engines so tutorials would also be needed for that. According to Wolfram, there is already a "virtual book" (third item on the help menu, or accessible via the book icon in the Documentation Center) comprising an organized collection of all of the tutorials in the documentation, organized for sequential or structured reading. The same material is available as PDF downloads or purchasable in printed form from http:// www.wolfram.com/learningcenter/tutorialcollection/.

With data sets within Mathematica growing by the day, it would be useful to have some idea of how to cite the data source. For instance, I found that the population of Delhi is 10.5 million from within Mathematica (using

CityData["Delhi", "Population"]
) but if I were using this number in an article, what would I describe as the source? Again, according to my Wolfram source, any data from Mathematica mixes a number of sources. To ensure data is from the Mathematica data sets, one should ask for and cite using a Mathematica tag, as in "Mathematica City Data" together with the access date as you would with a Web-based source. The Wolfram Alpha search engine can be given the same command if you want specific data sources because you can make the same query "population delhi" and then click on "Source information" link at the bottom.

Regardless of these wishes, Mathematica 7 is an impressive upgrade upon an already impressive version 6.

Product Information

Mathematica is as multi-platform as software can get. Wolfram's Web site sells it for a number of 32-bit and 64-bit platforms for Windows (up to Vista), MacOS 10.4 Intel and PowerPC, the latter for 32 bit only, Linux and various flavors of Unix (e.g., HP-UX, Solaris, and IBM AIX).

Mathematica 5.1 is distributed by Wolfram Research through academic bookstores and through its Web site, http://www.wolfram.com. There are different prices for commercial, academic and student users and these prices are listed on the Web site. Under a Premier Subscription, if you buy a version for work, you can also get another one at home at no cost even if you have a different platform at home. "Semester" and "annual" downloadable student versions are also available for limited time periods at low cost.

Pricing:
United States:
U.S. Commercial Professional including 1 year Premier Service: $2,495
U.S. Academic List Price including 1 year Premier Service: $1,095
Student Version: $139.95
Semester and Annual downloadable student version start from $44.95

United Kingdom:
U.K. Commercial Professional, including 1 year Premier Service: £2035
U.K. Academic List Price, including 1 year Premier Service: £860
Student Version: £80
Semester and Annual downloadable student version start from £20

Academic Pricing and Programs:
Wolfram offers the Educational Unlimited Program for schools, community colleges and universities. It offers unlimited access to any eligible Wolfram Research products for an annual fee. Benefits include automatic upgrades, free faculty home-use access, multiple student-use options, free webMathematica Amateur and technical support. Starting this year, there is also a "Home Edition" for $295 (U.S. version) or £195 (U.K. version) that is a full feature version but is licensed only for non-professional use.

Software Reviewers, Vendors Wanted

Vendors interested in having their software reviewed, or independent individuals interested in reviewing software, should contact OR/MS Today Editor Peter Horner at horner@lionhrtpub.com or 1-770-587-3172.




ManMohan S. Sodhi (m.sodhi@city.ac.uk) heads the operations and supply chain management group at Cass Business School, City University London.

References


  1. Sodhi, M., "Mathematica 5," OR/MS Today, December 2003, www.lionhrtpub.com/orms/orms-12-03/frswr.html.
  2. Sodhi, M., "Mathematica 5.1," OR/MS Today, December 2004, www.lionhrtpub.com/orms/orms-12-04/frswr.html.
  3. Sodhi, M. "Mathematica 6," OR/MS Today, October 2007, www.lionhrtpub.com/orms/orms-10-07/swr.html.





  • Table of Contents
  • OR/MS Today Home Page


    OR/MS Today copyright © 2009 by the Institute for Operations Research and the Management Sciences. All rights reserved.


    Lionheart Publishing, Inc.
    506 Roswell Rd., Suite 220, Marietta, GA 30060 USA
    Phone: 770-431-0867 | Fax: 770-432-6969
    E-mail: lpi@lionhrtpub.com
    URL: http://www.lionhrtpub.com


    Web Site © Copyright 2009 by Lionheart Publishing, Inc. All rights reserved.