 # Communications of the ACM

Research highlights

## Technical Perspective: Not Just a Matrix Laboratory Anymore

I never dreamed MATLAB would become what it is now. It began almost 40 years ago as a simple calculator my students could use for matrix operations. Today, extended by dozens of specialized toolboxes and Simulink (a block diagram environment for simulation and model-based design), MATLAB has evolved into a mature programming language supporting a rich technical computing environment. Its use has spread in sometimes surprising ways far beyond the original context of academia to a wide variety of applications in industry and business. So MATLAB has come a long way from being just a "matrix laboratory."

As chief mathematician for MathWorks, I love to see the mathematics that underlies all these applications and ties everything together. The mathematics may be invisible to the user, since one of the objectives of some tools is to hide the math, but it can be found by poking deeply enough.

Mathematics is not difficult to find in Chebfun, the subject of the following paper, which began life in the early 2000s as an extension of MATLAB's operations for discrete vectors and matrices to continuous functions. Before Chebfun, there were two different ways of computing with functions, meaning structures of the form "f (x)."

• Symbolic, exemplified by Mathematica and Maple. A function is represented by a list or a string; think of text.
• Numeric, exemplified by MATLAB. A function is represented by a finite-dimensional vector of floating-point values; think of a table.

The separation between these two representations is not clear-cut, since Mathematica and Maple can do purely numerical computation, and MATLAB has an add-on toolbox for symbolic computation.

Symbolic computation gives answers in the form you came to expect in your calculus class. But it soon suffers from combinatorial explosion in both time and space as the complexity of the representation grows. (A telling example of this appears early in the paper.) And symbolic computation simply cannot solve most scientific and engineering problems because they do not have "closed form" answers. On the other hand, numerical computation suffers from many difficulties that stem from approximating continuous processes by discrete ones.

MATHLAB has evolved into a mature programming language supporting a rich technical computing environment.

Chebfun combines the best of both worlds. It represents a function as a piecewise Chebyshev expansion, allowing Chebfun to appear to be doing (nearly exact) symbolic computation, but with the nimbleness and speed of numerical computation. Chebfun automatically chooses the number of interpolation points so the function is represented to roughly machine precision (IEEE double, approximately 15 decimal digits of relative accuracy). As in MATLAB, the underlying mathematics in Chebfun ties together all of the computations.

If you already know MATLAB, you "know" Chebfun, whose guiding principle is to overload the definition of operations defined in MATLAB for vectors and matrices so they make sense when applied to chebfuns, where a chebfun with a lowercase c denotes an object in the Chebfun system. For example, if `v` is a finite-dimensional vector in MATLAB, then `sum(v)` is the sum of the elements of `v.` Extension of this idea to functions means that, if f is a chebfun, `sum(f)` is the definite integral of f(x) over its specified range of definition. Full details and a host of examples are given at http://www.chebfun.org/about.

The Chebfun project has made enormous progress for the one-dimensional case, when singularities and discontinuities can be detected automatically, intervals can be broken into subintervals, and piecewise expansions are available in which the breakpoints are specified scalar points. But in two dimensions, matters are much more complicated, as Nick Trefethen describes in his paper, and will be the subject of continuing activity by an expanding group of researchers. The success of Chebfun has already inspired further applications. Version 5 of Chebfuna was released in June 2014 and is posted on GitHub.

Chebfun is a remarkable example of what mathematical research combined with software development, supported by systems like MATLAB, can produce.

### Author

Cleve Moler (moler@mathworks.com) is the chief mathematician for MathWorks, Natwick, MA.

### Footnotes

a. The history of Chebfun can be found at http://www.chebfun.org/about/history.html.