Mathematica Journal
Volume 9, Issue 1


In This Issue
Tricks of the Trade
In and Out
Trott's Corner
New Products
New Publications
News Bulletins
New Resources

Download This Issue 

About the journal
Editorial Policy
Back Issues
Contact Information

Mathematica 4.2: A Technical Review
Lars Hohmuth

New and Enhanced Packages

Global Optimization

Mathematica 4.2 introduced two new functions NMinimize and NMaximize, for solving global optimization problems. These functions are flexible enough to handle functions that are not differentiable or continuous. You can specify one of four different methods for doing the optimization:

  • differential evolution (genetic programming)
  • Nelder–Mead (nonlinear simplex algorithm)
  • simulated annealing
  • random search

This loads the package.

This minimizes a quadratic function over a polyhedron.

This is the corresponding exact minimization.

Below are four examples that demonstrate how NMinimize handles some problems better than previous versions of Mathematica.

FindMinimum Example

This defines a function with a lot of local minima.

Here is a plot of the function.

This function cannot be easily handled using FindMinimum. If we start FindMinimum away from the global minimum, it gets trapped by a local minimum.

However, NMinimize finds the global minimum, with similar starting points.

Constrained Minimization Example

NMinimize can solve problems including constraints in the case .

Solve Example

Mathematica’s standard Solve cannot find a solution for this system of equations.

NMinimize can solve this problem easily if given a constant objective function and the equations to be solved as constraints.

NonlinearFit Example

In this example, we generate a data set with random perturbations.

We first use NonlinearFit to try to fit a model to this data set.

As we see below, NonlinearFit gets trapped by a local minimum.

We can get a more accurate model by creating a sum of squares by hand and using NMinimize to find the minimum with the DifferentialEvolution method.

This approach creates a much better fit.

Statistical Analysis

ANOVA is a statistical test for heterogeneity of means by analysis of group variances. The Statistics`ANOVA` package extends Mathematica’s already rich statistical functionality to include support for analysis of variance. ANOVA was developed as a way of optimizing crop yields, but is widely used for quality assurance and biomedical experiments and in many other fields.

This loads the package.

This creates a simple univariate data set.

This computes the ANOVA table for the above data.

Here is another example data set.

Here is a plot for visualizing the data.

Here is the ANOVA table for the data.


Mathematica 4.2 includes a completely new and expanded implementation of DiscreteMath`Combinatorica`. Apart from new functions—covering topics such as Polya enumeration theory, used for enumerating isomers in chemistry—the package offers substantial speed and graphics enhancements. The new version of Combinatorica is described exhaustively in Computational Discrete Mathematics: Combinatorics and Graph Theory with Mathematica, by Steven Skiena and Sriram Pemmaraju, to be published by Cambridge University Press. Let us look at some examples of the new functionality.

This loads the package.

You can use the package to generate a variety of graphs that are of interest in graph theory. For example, GridGraph[,] constructs an grid graph, the product of paths on and vertices.

The girth of a graph is the length of its shortest cycle. A cage is the smallest possible regular graph that has a prescribed girth. Here, we plot several cage graphs of degree 4. ShowGraphArray permits the display of multiple graphs in one window.

Here are some cage graphs of degree 5.

FiniteGraphs produces a list of all the interesting, finite, parameterless graphs built into Combinatorica.


The new AuthorTools package makes it easy to process notebooks for print or online publication. Using AuthorTools you can quickly create a table of contents or index from one or more notebooks. You can also set a variety of printing options, extract all cells of a specific type from a notebook, or create bilaterally formatted cells.

AuthorTools consists of about sixty functions and ten palettes. The palettes provide a point-and-click interface for most common tasks. You can access the various palettes using the OpenAuthorTools palette listed under the File > Palettes menu.

For more advanced functions and greater customizability, you can also evaluate the package functions directly. For more details on using the package, see “AuthorTools: A Package for Document Processing,” in our next issue.

About Mathematica  Download Mathematica Player
Copyright © Wolfram Media, Inc. All rights reserved.