Introducing Cleve’s Laboratory
By Cleve Moler, MathWorks
In this Cleve’s Corner I want to give you a sneak preview of the experiments in “Cleve’s Laboratory.” I launched the laboratory to collect much of the work I have done over the last several years in one place. The experiments come from my two ebooks, my blog, Cleve’s Corner columns in MathWorks News & Notes, and new work.
Each experiment centers on an interactive “app” that allows experimenters to try out the ideas for themselves. Several of the experiments, including
biorhythms, are designed to introduce newcomers to MATLAB®. The code for Cleve’s Laboratory is an app available for download.
The figure below shows snapshots of the graphical entry pages. Even these are live pages driven by MATLAB. The wave in the first icon moves every time you open the page. The clock reads the correct time. The Sudoku puzzle changes. The double pendulum swings.
logo_wave. The MathWorks logo is the solution to the wave equation, a foundation of mathematical physics. MathWorks is the only company in the world whose logo is the solution to a partial differential equation. This program demonstrates the vibration of a membrane stretched over an L-shaped region.
lifex. This is a version of John Conway's Game of Life. "Life" is a cellular automaton that involves life and death in an infinite rectangular, 2D, cellular universe. The lifex program accesses the Life Lexicon, a historical collection of nearly 500 starting populations available online. It uses sparse matrix operations and an elegant, one-line implementation of Conway’s rules for evolution in this universe. The icon shows Bill Gosper’s glider gun, which emits a continuous stream of 5-element agents that move across the space.
fern.The fern is a self-similar fractal. It was invented by Michael Barnsley, and is described in his book Fractals Everywhere. Each leaf is similar in structure to the larger fern and contains a miniature copy of yet another leaf. The fern program keeps running until the stop button is toggled.
fibonacci. This program is based on Fibonacci's rabbit pen. A man puts a pair of rabbits in a place surrounded on all sides by a wall. How many pairs of rabbits can be produced from that pair in a year if it is supposed that every month each pair begets a new pair that from the second month on becomes productive? Today, the solution to this problem is known as the Fibonacci sequence, or Fibonacci numbers.
pdeapp. This program demonstrates finite difference methods for solving model problems for four partial differential equations involving Laplace’s operator: the Poisson equation, the heat equation, the wave equation, and an eigenvalue equation. The regions are a square, an Lshape, an H-shape, a disc, an annulus, and a pair of isospectral drums.
flame.This is an example of a stiff ordinary differential equation. flame(r0) specifies the initial radius is r0. Default r0 = .02. A ball of fire grows until its radius is just large enough for all the oxygen available through the surface to be consumed by combustion in the interior. The equation for the radius is rdot = r^2 - r^3. The problem becomes stiff as the radius approaches its limiting value.
eigsvdapp. With this program you can watch how MATLAB handles three different matrix eigenvalue problems: the eigenvalues of a nonsymmetric matrix, the eigenvalues of a symmetric matrix, and the singular values of any matrix. Watch the reduction to Hessenberg, tridiagonal, or bidiagonal form, then the QR iteration to obtain Schur or diagonal form.
walker. This model, developed by Nikolaus Troje, is a five-term Fourier series with vector-valued coefficients that are the principal components for data obtained in motion-capture experiments involving subjects wearing reflective markers and walking on a treadmill. The components, also known as “postures” or “eigenwalkers,” correspond to the subject’s movements. The postures are also classified by gender.
waterwave. A 2D shallow water model with reflexive boundary conditions. A random water drop initiates gravity waves. The surface plot displays height colored by momentum. The solution is computed by the Lax-Wendroff finite difference method. The plot title shows simulated time and total variation.
orbits. The orbits program solves Newton’s equations governing the gravitational attraction among several bodies. When the number of bodies is equal to nine, this is the solar system with one sun and eight planets.
censusapp. This experiment is older than MATLAB—it started as an exercise in Computer Methods for Mathematical Computations, by Forsythe, Malcolm and Moler, published in 1977. The data comes from the decennial census of the U.S., 1900–2010. The task is to extrapolate population data beyond 2010. Today’s MATLAB makes it easier to vary the parameters and see the results, but the underlying mathematical principle is unchanged: Using polynomials of even modest degree to predict the future by extrapolating data is a risky business.
mandelbrot. This program invites you to explore the Mandelbrot fractal. You can use the mouse to select a region, zoom in on any region, increase the grid size, increase the iteration depth, and change the color map.
predprey. In this classic model, one species grows exponentially while the other decays exponentially in the absence of the other. The model is nonlinear, but the solutions are periodic. Dragging the red dot changes the equilibrium point. Dragging the blue-green dot changes the initial conditions.
durerperm. The icon shows Durer's magic square. To permute the square, click on two different rows or columns. Is the result still a magic square?
golden_spiral. In this program you can see a continuously expanding sequence of golden rectangles and inscribed quarter circles.
tumbling_box. If you throw a rectangular box in the air with a twist, you can make it tumble stably about its longest or shortest axis. But if three sides of the box are of different lengths, you cannot make it tumble about its middle-sized axis. The Euler differential equations for the angular momenta about the three principal axes have two stable critical points and one unstable critical point.
waves. This program demonstrates the wave equation in 1D and 2D space dimensions. Solutions are expressed as time-varying weighted sums of the first four eigenfunctions. The 1D domain is an interval. The 2D domains include a square, a disc, a three-quarter circular sector, and the L-shaped union of three squares. With polar coordinates, the eigenfunctions of the disc and the sector involve Bessel functions.
tictactoe. This program combines three games that initially appear to be unrelated: Pick15, TicTacToe, and Magic3. In Pick15, the object is to generate a total of 15 using exactly three digits, where each digit can be chosen only once. TicTacToe follows the traditional game, but replaces X’s and O’s with blue and green. The object is to get three in a row, column, or diagonal. Magic3 superimposes a magic square of order three on TicTacToe to show that Pic15 is actually the same game.
t_puzzle. I first saw this wooden T puzzle at Puzzling World in Wanaka, New Zealand. The underlying mathematics involves geometry, trigonometry, and arithmetic with complex numbers. The t_puzzle program demonstrates some useful programming techniques. The four pieces all have the same width but different heights. It turns out that they can be arranged to form a capital “T” as well as an arrow and a rhombus.
Published 2016 - 93044v00