|
This tutorial introduces useful Mathematica idioms and utilities primarily for numeric array processing. When treated in the serial, looping manner of traditional programming languages, Mathematica can appear slow and cumbersome; however, elegant and speedy performance can be recovered by using a holistic, parallel, array-based approach. Whereas some Mathematica texts discuss the application of the basic operators to one- or perhaps two-dimensional problems, very often a problem will demand three, four, five, or higher dimensions, leaving the would-be solver floundering in unfamiliar territory and perhaps ultimately resorting to awkward looping constructs. Mathematica's operator set is shown to be fully scalable to higher dimensions in a straightforward way. The goal is to catalyze the formation of a "matrix mindset" in the Mathematica practitioner, enabling the practitioner to decompose a problem into its natural fundamental constituents, and then to swiftly and confidently dispose of each in a few elegant, easily debugged lines of code.
The tutorial will first lightly cover the basics: Map, Apply, MapThread, generalized Transpose, etc. It will then introduce some useful idioms by posing a few problems, breaking each into sections, and solving each section with an idiom. The specific functionality addressed will include: idioms for concatenating multidimensional arrays along various dimensions, reducing values from arrays along specific dimensions, robust and efficient ways of replacing nonconformable chunks of arrays, optimum numeric Boolean operators, masking and treating only elements satisfying a mask along the lines of Fortran's WHERE utility, and others as time permits. Wherever possible, a packed array implementation will be contrasted with the traditional approach.
|
|