Академический Документы
Профессиональный Документы
Культура Документы
Cleve’s Corner
Experiments with MATLAB is a free, online book for educators and high school students looking for material that goes
beyond their standard courses. College students early in their careers will also find value in the materials and exercises.
2 Reprinted
2 Reprinted TheMathWorks
from from News&Notes
TheMathWorks News&Notes
| 2 0 0| 82 0 0 8 w w ww. w
mwa t. hmwaot hr kwso. cr ko sm. c o m w w w. m a t h w o r k s .c o m Reprinted from TheMathWorks News&Notes | 2 0 0 8 3
TheMathWorks
TheMathWorksNews&Notes
News&Notes
2 Reprinted
2 Reprinted TheMathWorks
from from News&Notes
TheMathWorks News&Notes
| 2 0 0| 82 0 0 8 w w ww. w
mwa t. hmwaot hr kwso. cr ko sm. c o m w w w. m a t h w o r k s .c o m Reprinted from TheMathWorks News&Notes | 2 0 0 8 3
TheMathWorks News&Notes
rule: A live cell with two live neighbors, or The statements Because all populations follow this rule,
any cell with three live neighbors, is alive at n = size(X,1); the initial population configuration deter-
the next step. p = [n 1:n-1]; mines how the game of life plays out. In Bill
This deceptively simple rule leads to an q = [2:n 1]; Gosper’s initial population, known as the
incredible variety of patterns, puzzles, and Y = X(:,p)+X(:,q)+X(p,:)+X(q,:)+... glider gun (Figure 6), the central portion of
unsolved mathematical problems. X(p,p)+X(q,q)+X(p,q)+X(q,p); the gun oscillates, emitting an infinite stream
The “Game of Life” MATLAB program of gliders that pass out of view and into the
discussed in Experiments with MATLAB is generate another sparse matrix Y with ele- void. Gosper’s configuration was the first to
a beautiful example of the use of the sparse ments between 0 and 8 that count the num- create an unbounded population.
matrix data structure. The universe is a ber of live neighbors. The rule of “Life” is
sparse matrix X with a finite number of 1s then implemented in a single MATLAB Further Experimentation
marking the live cells. The size of X grows to statement: Reading about the exercises in Experiments
accommodate any expanding population. with MATLAB is not nearly as fun—or as
X = (X & (Y == 2)) | (Y == 3); educational—as running them yourself. So
if you find them interesting, or if you know
students who would be interested, please
take a look at Experiments with MATLAB.
Then run, discuss, and improve the ex-
periments together. Programs, especially
MATLAB programs, are vehicles of dis-
course with people, and not simply ways to
send commands to a machine. ■
Resources
© 2008 The MathWorks, Inc. MATLAB and Simulink are registered trademarks of The MathWorks, Inc. See
4 www.mathworks.com/trademarks for a list of additional trademarks. Other product or brand names may be 91610v0010/08
0000v00 10/08
trademarks or registered trademarks of their respective holders.