Good Times in MATLAB: How to Typeset the Multiplication Symbol

The MATLAB output

>> A = rand(2); whos
  Name      Size            Bytes  Class     Attributes

  A         2x2                32  double

will be familiar to seasoned users. Consider this, however, from MATLAB R2016b:

>> s = string({'One','Two'})

s = 
  1×2 string array
    "One"    "Two"

At first sight, you might not spot anything unusual, other than the new string datatype. But there are two differences. First, MATLAB prints a header giving the type and size of the array. It does so for arrays of type other than double precision and char. Second, the times symbol is no longer an “x” but is now a multiplication symbol: “×”.

The new “times” certainly looks better. There are still remnants of “x”, for example in whos s for the example above, but I presume that all occurrences of “x” will be changed to the new symbol in the next release

However, there is a catch: the “×” symbol is a Unicode character, so it will not print correctly when you include the output in LaTeX (at least with the version provided in TeX Live 2016). Moreover, it may not even save correctly if your editor is not set up for Unicode characters.

Here is how we dealt with the problem in the third edition (published in January 2017) of MATLAB Guide. We put the code

\usepackage[utf8x]{inputenc}
\DeclareUnicodeCharacter{0215}{\ensuremath{\times}}

in the preamble of the master TeX file, do.tex. We also told our editor, Emacs, to use a UTF-8 coding, by putting the following code at the end of each included .tex file (we have one file per chapter):

%%% Local Variables:
%%% coding: utf-8
%%% mode: latex
%%% TeX-master: "do"
%%% End:

With this setup we can cut and paste output including “×” into our .tex files and it appears as expected in the LaTeX output.

Hyphenation of Compound Words

Compound words are common in mathematical writing and it can be hard to remember how to hyphenate them. Unfortunately, there are no hard and fast rules. In this article I give some guidance and illustrative examples. The principle to keep in mind is that hyphenation should help to avoid ambiguity.

In phrases of the form “adjective noun noun” or “noun adjective/participle noun” a hyphen is usually used: closed-form solution, nineteenth-century mathematics, error-correcting code. But if the adjective follows the noun then no hyphen is needed: solution in closed form, mathematics of the nineteenth century, code that is error correcting. Here are some other examples:

  • nearest-neighbor interpolation,
  • higher-dimensional discrete Fourier transforms,
  • large-scale optimization problem,
  • minimum-norm solution but solution of minimum norm,
  • first-order differential equation but differential equation of first order,
  • the parameter-dependent ODE but the ODE is parameter dependent,
  • rank-1 matrix but the matrix has rank 1.

In examples such as finite-difference method and finite-element method it is a matter of convention and taste whether to hyphenate. Some authors do and some don’t. Most authors do not hyphenate singular value decomposition.

Compounds beginning with adverbs ending in ly are not hyphenated, since they are usually unambiguous. Examples: slowly converging sequence, highly oscillatory integrand, continuously differentiable function, numerically oriented examples.

An important special case is compounds beginning with ill, well, little, much, and best, the first two of which are particularly common in mathematical writing. Here, a hyphen is used for a compound of two words used adjectivally, but if the compound itself is modified then no hyphen is used. Examples (these also apply with ill replaced by well):

  • This is an ill-conditioned problem.
  • This is a very ill conditioned problem.
  • The problem is ill conditioned.
  • This problem is very ill conditioned.

If the first example were to be written as This is an ill conditioned problem then it could be read as if ill were an adjective modifying the compound conditioned problem. Confusion is unlikely in this instance, but in ill-prepared contestant the hyphen is needed unless we are talking about a contestant who is prepared but not well.

Here are two further examples that are complete sentences.

  • MATLAB allows a two-dimensional array to be subscripted as though it were one dimensional.
  • This approach is particularly well-suited to high-precision computation.

The hyphen in well-suited in the last example is not essential, but is rather a matter of taste.

I know from personal experience that it is hard to achieve good, consistent hyphenation when you are concentrating on all the other aspects of writing. This is where having the services of a copy editor is extremely valuable. To benefit, you need to publish with a journal or book publisher that takes copy editing seriously (SIAM, PUP, CUP, OUP, …).

I give the final word to an Oxford University Press style manual, as quoted in the Economist Style Guide:

If you take hyphens seriously, you will surely go mad.

I am indebted to Sam Clark of T&T Productions for checking this post (and for saving me from many hyphenation blunders in my last two books).

MATLAB Guide, Third Edition (2017)

The third edition of MATLAB Guide, which I co-wrote with Des Higham, has just been published by SIAM. It is a major update of the second edition (2005) to reflect the many changes in MATLAB over the last twelve years, and is 25 percent longer. There are new sections and chapters, and almost every page has changed.

170106-1123-14-5528.jpg

170104-1243-13-5487.jpg

The new chapters are

  • Object-Oriented Programming: presents an introduction to object-oriented programming in MATLAB through two examples of classes.
  • Graphs: describes the new MATLAB classes graph and digraph for representing and manipulating undirected graphs and directed graphs.
  • Large Data Sets: describes MATLAB features for handling data sets so large that they do not fit into the memory of the computer.
  • The Parallel Computing Toolbox: describes this widely used and increasingly important toolbox.

The chapter The Symbolic Math Toolbox has been revised to reflect the change of the underlying symbolic engine from Maple (at the time of the second edition) to MuPAD.

New sections include Empty Matrices, Matrix Properties, Argument Checking and Parsing, Fine Tuning the Display of Arrays, Live Editor, Unit Tests, String Arrays, Categorical Arrays, Tables and Timetables, and Timing Code.

Two other big changes are that figures are now printed in color and there are thirteen “Asides”, highlighted in gray boxes, which contain discussions of MATLAB-related topics, such as anonymous functions, reproducibility, and color maps.

The book was launched with a reception hosted by The Mathworks and SIAM at the SIAM booth at the Joint Mathematics Meetings in Atlanta on January 6, 2017. Jim Rundquist (Senior Education Technical Evangelist) represented MathWorks, and several SIAM staff, including SIAM Publisher David Marshall, were present.

Two delicious cakes, one containing a representation of the cover of the book, were enjoyed by reception attendees. Inspired by MATLAB, the cakes were served using slice, deal, and input, and an occasional reshape or rotate, with a pool of workers consuming them asynchronously.

170106-1547-18-5574-Edit.jpg
Elizabeth Greenspan (Executive Editor, SIAM), Jim Rundquist (Senior Education Technical Evangelist, The MathWorks), Nick Higham (University of Manchester), Bruce Bailey (Book Marketing Associate, SIAM), and David Marshall (SIAM Publisher).

Taking Up the SIAM Presidency

I am honored to be taking over the reins from Pam Cook as president of the Society for Industrial and Applied Mathematics (SIAM) for the next two years, starting January 1, 2017. Pam remains as past-president during 2017. I look forward to helping to address the challenges facing SIAM and to working with the excellent SIAM officers and staff.

160420-0859-44-4096-Edit.jpg
SIAM headquarters, Philadelphia.

Eighteen months ago I wrote a “candidate statement” for the fall 2015 SIAM elections. The comments I made then remain valid and so I thought it would be worth reproducing the statement here.

The January/February 2017 issue of SIAM News will contain my first From the SIAM President column, in which I give further thoughts on SIAM’s future.

I am happy to receive comments from SIAM members or potential members, either in the box below or by email.

Candidate Statement: SIAM is the leading international organization for applied mathematics and has been an important part of my professional life since I joined as a PhD student, 31 years ago. SIAM is the first place that many people turn to for publications, conferences, and news about applied mathematics and it represents the profession nationally and internationally.

I have been fortunate to be involved in the leadership for many years, having spent six years on the Council, eight years on the Board, and having recently served two terms as Vice President At Large (2010-2013).

SIAM faces a number of challenges that, if elected as President, I relish helping to address, working with SIAM members, SIAM officers, and the excellent SIAM staff.

SIAM’s publications remain strong, but are vulnerable to changes in the way scholarly journals operate (open access, article processing charges, etc.). SIAM needs to monitor the situation and respond appropriately, while striving to provide an even greater service to authors, referees and editors, for example by better use of web tools.

SIAM’s membership is also healthy, but SIAM must continue to enhance membership benefits and work hard to attract and retain student members, who are the future of the society, and to provide value for its members in industry.

Book sales are declining globally and in academic publishing it is becoming harder to find authors with the time to write a book. Nevertheless, the SIAM book program is in a strong position and the 2015 review of the program that I chaired has produced a list of recommendations that should help it to thrive.

SIAM conferences are a terrific place to learn about the latest developments in the subject, meet SIAM staff, browse SIAM books, and attend a business meeting. Attendances continue to grow (the SIAM CSE meeting in Salt Lake City last March was the largest ever SIAM meeting, with over 1700 attendees), but in any given year, the majority of SIAM’s 14,000 members do not attend a SIAM conference. Audio and slide captures of selected lectures are made available on SIAM Presents, but we need to do more to help members engage in virtual participation.

The SIAM web site has provided sterling service for a number of years, but is in need of a major redesign, which is underway. This is an excellent opportunity to integrate better the many services (conferences, journals, books, membership, activity groups, chapters, sections, etc.) in a responsive design. Beyond the core website, SIAM has a strong social media presence, posts a wide variety of videos on its YouTube channel, hosts SIAM Blogs (which I was involved in setting up in 2013), has recently made SIAM News available online, and has SIAM Connect and SIAM Unwrapped as further outlets. Optimizing the use of all these communication tools will be an ongoing effort.

These are just some of the challenges facing SIAM in the future as it continues to play a global leadership role for applied mathematics.

July 2015