Reproduced with permission from NeXT Computer, Inc., USA, NeXT on Campus, Winter 1991. ã 1991 NeXT Computer, Inc., USA

NeXTstep as the platform of choice for Mathematica studies
by Richard E. Crandall
Scientific Computation Group
NeXT Computer, Inc.

In the realms of education and research Mathematica's promise is by now well appreciated. The exciting story that beckons to be told involves the emergence of NeXTstep as the outstanding platform for Mathematica studies. This researcher has looked into dozens of research problems via Mathematica on NeXT computers. Without reservation he claims that if Mathematica were running on the alternative vendors' computers, he may have looked into only a few of these problems. 

How does one justify such a pointed statement, essentially that one "requires" NeXTstep to do the most useful Mathematica work? Such justification is the point of this article. The overall reason for the superiority of the platform is that in NeXTstep, Mathematica runs with unprecedented efficiency within an unprecedented galaxy of disparate modes. This having been said, here is a list of NeXTstep advantages for the Mathematica user: 

· Concurrent window interface: Mathematica runs elegantly along with everything else.

· High-resolution graphics: certain studies require the MegaPixel resolution.

· Superior speed and memory: many problems previously unassailable can now be resolved on NeXT computers.

· Testing, prototyping, and porting: Mathematica can be the starting point for algorithms that are later ported for great speed in C or Objective C.

· Media processing: sounds and images may be acquired via NeXT computers and further analyzed via Mathematica. 

· Interprocess communication: other programs may message Mathematica in order to obtain answers in an automated way.

· Parallelization: multiple Mathematica sessions may be invoked on networks of NeXT machines.

The remainder of this treatment is dedicated to elucidation of these advantages.

Concurrent window interface
The Mathematica application not only has extensive and complete menus, multiple windows, and dialog panels, but all text and graphics follow the standard PostScript imaging model. This means that one may readily paste information between Mathematica windows and other application windows. For example, there is a standard demonstration application called CircuitBuilder that generates explicit circuit equations into a window. These often formidable equations can be immediately pasted into a Mathematica window. When the equations are solved via Mathematica, one then confronts a host of fortuitous options shared by all PostScript-supporting applications. You may graph frequency response curves, or work out circuit parameters numerically and generate tables, or perform statistical analyses, and so on.

Above all, the NeXT user may keep Mathematica activeÐbut "hidden"Ðin the application dock, ready for instant recall. Because of the refined and well-tested efficiency of the Mach UNIX operating system, the application causes virtually no overhead until you call for it.

High-resolution graphics 
The MegaPixel Display affords a distinct advantage in areas such as modern studies of chaotic phenomena. Whether the problem involves bifurcation, fractals, or phase transitions, one generally confronts considerable complexity for the study of which the high-resolution display is an invaluable tool. Color graphics are just as natural as gray-scale graphics, thanks to the existence of the color paradigm as an integral part of the PostScript model.

Superior speed and memory
The claim of superior speed is by no means artificial. The author finds that Mathematica calculations run about an order of magnitude faster on the 68040-based NeXTstation than they will run on a Macintosh IIci. Perhaps equally important for the physical sciences, where huge data storage is often the rule, NeXT computers enjoy superior virtual memory performance.  When you obtain Mathematica with your NeXT computer, you do not have to buy more memory to get the application to run. Furthermore, virtual memory handling is so seamless that, depending on your disk configuration, you can run sessions that require tens, or even hundreds of megabytes of storage. And finally, if you write some erudite Mathematica recursion for which storage runs on to infinity, you will not hurt your computer. NeXT computers are uniquely graceful in the way they handle the exhaustion of resources.

Here is an example of the joys of speed-with-memory. The author was recently presented with a tough problem, communicated by a NeXT Campus Consultant, David Bressler, at CUNY. Evidently, various "alternative" computer configurations had failed to solve a horrendous nonlinear system in ten unknowns, said system arising from a chromatographic model. This problem was solvable symbolically on a NeXTstation running Mathematica. During the successful computations, virtual memory ranged up to 20 megabytes. Most alternative computers would not have provided the required, accurate disk thrashing or the computation speed required for this problem.

Testing, prototyping, and porting
Say you have an algebraic problem whose solution you know will necessitate an eventual expense of billions of floating point operations. You may experience the reasonable fear that if a mistake is present in your code (which could be C or Objective C) then at least the first pass at calculation will amount to "wasted billions."  Often you can test the problem in Mathmatica first. If everything checks out, you can transfer the calculation to the C or Objective C programming environments available on all NeXT computers. 

The author once planned a computation involving gigantic polynomials. These were to be finite series approximations to the function:

f(t) = sin(t) sin(wt) sin(w2t) sin(w3t) sin(w4t) sin(w5t) sin(w6t) sin(w7t) 

where w is an eighth root of unity, w = eip/4. But Mathematica investigation showed that the first few terms of f(t) are:

       16            24                    32
  8   t        1838 t            29039641 t              
-t  + ---- - ------------ + ---------------------- 
      4725   162820783125   3028793579456347828125

This suggests that the function f(t) might be in reality a series in powers of t8. Indeed this is rigorously so, and the testing exercise enabled the author to save a factor of 8 when the problem was ported to C routines.

Media processing
A striking feature of NeXT computers is that they may acquire sounds and images, in some situations on a real-time basis. Furthermore, one may experiment with media processing via Mathematica. Here is a good example: Say you have a sound file and you want to create a spectrogram or a sonogram. Read the sound file into Mathematica, perform the requisite Fast Fourier Transforms (FFTs) using built-in functions Fourier[] and InverseFourier[], then graph the results in meaningful format. For image processing, you can read in an image file, then easily apply two-dimensional FFTs, or antialiasing, or de-blurring routines via Mathematica.

Interprocess communication
The NeXTstep Application Kit allows interprocess communication via a Speaker/Listener paradigm. This means you can write an application that asks deep questions of Mathematica. Furthermore, you can choose whether to interrogate the application Mathematica itself, or its executable kernel. In a previous column of NeXT on Campus, the author described the application GourmetÐan experimental supercalculator (see "Adventures in supercalculator design," fall 1990). Gourmet messages the raw Mathematica kernel, sending problems and displaying the answers in standard ScrollViews. Similarly, RealTimeAlgebraÐa demonstration applicationÐdoes messaging between itself and the Mathematica application.

A striking interprocess example, which signals perhaps a new era in mathematical text processing, is an unreleased application called ExpressionBuilder, by Josh Doenias of NeXT's Scientific Computation Group. ExpressionBuilder allows the user to build PostScript expressions, as would be found in professional monographs, and to send these expressions to Mathematica in the appropriate format.
 
Parallelization
The author previously described a supercomputing network comprised of many NeXT computers (see "Tales of zilla: Adventures in distributed computation," NeXT on Campus, summer 1990). There is now an official demonstration application called Zilla, which provides a window interface for such supercomputing, with available machines appearing as icons within an application window. It is now a straightforward matter to parallelize Mathematica problems via the Zilla application. One may launch many Mathematica kernels with Zilla, each kernel being fed a unique set of seed parameters. In this way, one may multiply the power of Mathematica one-hundred-fold.

Afterword
The author hopes these brief descriptions have gone some distance in support of the idea that NeXTstep running on NeXT computers represents the platform of choice for Mathematica users. For further technical details on scientific applications in general, one might consult the author's texts: Mathematica for the Sciences, released in late 1990, and Scientific Applications for NeXT Computers, due in early 1991, both published by Addison-Wesley.