˜, 18, 23 ˜=, 22 `, 74 ,, 74, 162 .*, 69 ..., 10 ./, 69 .ˆ, 69 : all indices, 161

Index
angle between vectors, 330
angle bisector
computation, 248
any, 140
approximation
golden ratio, 56–59
perimeter of an ellipse, 109–117
pi, 29–34, 47–51, 131–136
square root of a number, 97–105
stationary vector, 161
zero of function, 222
arccos, 412
acos, 12
arcsin, 412
asin, 12
arctan, 411
atan, 12
atan2, 248, 253
area
regular polygon, 413
triangle, 413
arithmetic
discrete versus continuous, 87
floating point, 87–90
arithmetic expression, 9
vectorized, 68, 76, 163
array
addressing
one-dimensional (vector), 67–76
two-dimensional (matrix), 157,
161–164
boolean-typed, 136, 140
concatenation, 74
initialization, 67, 72, 74–76, 162
length, 74
print, 164
size, 162
structure, 231, 235
˜, 18, 23
˜=, 22
’, 74
,, 74, 162
.*, 69
..., 10
./, 69
.ˆ, 69
:
all indices, 161
colon notation, 75
;
as separator, 10, 74, 162
to suppress output, 5, 9
<, 22
<=, 22
=, 7, 9
==, 22
>, 22
>=, 22
%, 6, 10
&&, 18, 22
ˆ, 9
||, 18, 22
abort execution, 42
absolute value, 412
abs, 53
abstraction, 95, 124
level of, 115
acos, 12
adaptive piecewise linear interpolation,
354–360
aligning text in plots, 394
all, 140
amino acids, 199
and
logical &&, 18, 22
425
AUTHOR PROOFS. NOT FOR DISTRIBUTION. REPORT ABUSE TO [email protected]
Copyright © by SIAM.
Unauthorized reproduction of this article is prohibited.
426
subarray, 161–162, 175
three-dimensional, 309
transpose, 74
two-dimensional, 283–317
vectorized arithmetic, 68, 76, 163
ASCII code, 217
asin, 12
assignment, 4, 7, 9
atan, 12
atan2, 248, 253
average case analysis, 194
axis
freezing scale, 396
scaling, 390
ticks, 392
axis
equal, 83, 86
ij, 296, 297
manual, 396
off, 83, 86
square, 86
tight, 153
bar graph, 204
bar, 133, 140, 186
base case, 341
base-2 number, 89, 412
benchmarking, 52, 194
best-case analysis, 194
Betsy Ross flag, 119
Big Ben chimes, 321
big-O notation, 53
bilinear interpolation, 293
binary files, 272
and matrices, 274
and vectors, 274
reading from, 274
versus text files, 274, 280
writing to, 275
binary number, 89
binary search, 211–214
and bisection, 224
binomial coefficient, 108, 414
nchoosek, 59
bisection, 219–224
and binary search, 224
approximate zero, 222
Index
bracketing interval, 219
f -evaluations, 221
floating point concerns, 221
blanks, 206
boolean
expression, 17–19, 21
operator, 17–19
operator precedence, 23
variable, 136, 140
vectorized operation, 136, 140
boolean-valued functions, 243
bracketing interval, 219
break, 42
bubble sort, 188–190
C, 417–421
calculus, 105
carriage return, 258
case sensitivity
lower, 206
upper, 206
ceil, 22
cell arrays, 209, 216
and character arrays, 217
and text files, 258
curly bracket notation, 210
of matrices, 300, 306
of strings, 209
size and length, 216
sorting, 217
cellstr, 217
character arrays, 201, 207
and cell arrays, 217
circumscribed circle, 244
computation, 247
clc, 10
clear
command window, 10
close all, 83, 85
code fragment, 9
codon dictionary, 199
colon notation, 75
permutations, 185
strings, 205
three-dimensional arrays, 309
color
checkerboard plot, 175
AUTHOR PROOFS. NOT FOR DISTRIBUTION. REPORT ABUSE TO [email protected]
Copyright © by SIAM.
Unauthorized reproduction of this article is prohibited.
Index
computation, 80–82
figure window, 409
fill, 80
intensity, 308
plot shading, 175
plot window, 409
vector, 80, 84
color maps, 285–290
built-in, 286, 291
color science, 290
colormap, 291
comment, 6, 7, 10
complete path, 260, 309
complex numbers, 107, 411
imag, 107
real, 107
computational engineering, xii
computational intuition, xi
computational science, xii
computer graphics
intersection problems, 242
rendering, 297
shading, 292
computer-aided design, 380
concatenation, 200, 206
repeated, 200
conditional, 16–21, 23–24
constrained optimization, 374
context (function), 102
continuation, 10
contour plot
clabel, 170
contour, 168, 170
Crtl-c, 42
correlation between vectors, 330
cosine, 411
cos, 12
cosxy , 330
creating files
.dat, 268–280
.jpg, 309
.wav, 323
current working directory, 9, 107,
266
data
acquisition, 257
427
motion, 184, 255
data abstraction, 234
importance, 227
daylight hours, 257
degrees, 412
deMorgan’s law, 242
derivative, 414
design parameter, 119
design process, 118–124, 372–380
differentiation formulae, 415
dirt specks, 308
median filtering, 311
disp, 11, 164
distance
Euclidean, 112, 413
from being equilateral, 245
point to line, 250
point to line segment, 357
divide and conquer, 335–361
dot matrix display, 299–306
matrix representation, 299
dot notation, 230
double, 280
e, 411
exp, 12
echo control, 9
edge detection, 308
edge effects, 34
efficiency
color maps, 289
function evaluations, 358
linear search, 205
precomputing for later use,
116
storage, 274
versus clarity, 115
Einstein, Albert, 129
ellipse
aphelion, 383
center, 382
foci, 383
perihelion, 383
semiaxes, 382
tilt, 383
else, 16–19, 23–24
elseif, 19, 24
AUTHOR PROOFS. NOT FOR DISTRIBUTION. REPORT ABUSE TO [email protected]
Copyright © by SIAM.
Unauthorized reproduction of this article is prohibited.
428
empty string, 200, 206
end-of-file, 258
engineering
design, 372–380
versus science, 387
engineering notation, 87
eps, 91
error, 7
model, 264
relative, 101, 113
rounding, 88–91
Euclidean distance, 112, 413
execution
function, 101–104, 107
pause, 68, 76
terminate, 42
exit interview, 423–424
exp, 12
factorial, 414
factorial, 59
fast Fourier transform, 333
fclose, 259, 266
feof, 266
fgetl, 258, 266
Fibonacci numbers, 56–59
explicit formula, 59
recursive formula, 56
field, 230
fieldnames, 235
figure, 83, 85
figure window
bring to front, 85
color, 409
positioning, 410
file
complete path to, 260
ReadMe, 259
file id, 258
file processing
acoustic, 319–334
counting lines, 270
images, 306–317
read/write framework, 270
text, 255–281
file-processing commands
fclose, 259, 266
Index
feof, 259, 266
fgetl, 258, 266
fopen, 258, 266
fread, 274, 280
fwrite, 280
File-Reading Convention, 261
File-Writing Convention, 271
files
.bin, 272
binary, 280
.jpg, 309
ReadMe, 267
text, 280
.wav, 322
fill, 80, 84
find, 206
finite arithmetic, 87–90
floating point arithmetic, 87–90
and bisection, 221
floor, 22
font design, 306
fonts in plots, 398
fopen, 258, 266
for reading, 258
for writing, 271, 280
for, 30–34, 76
for-loop
reasoning about, 40
vector of count values, 185
format
format long, 10
format long e, 10
format short, 10
format short e, 10
plot, 76–77, 84–86
print, 6, 11, 164
format, 5
formulae
and programs, 3–7
fprintf, 6, 11, 164, 271
fread, 274, 280
full machine precision, 90
function
as parameter, 360
handle, 222, 360
function, 99, 106
function evaluations, 221
AUTHOR PROOFS. NOT FOR DISTRIBUTION. REPORT ABUSE TO [email protected]
Copyright © by SIAM.
Unauthorized reproduction of this article is prohibited.
Index
functions, 106
as parameters, 168, 170, 222, 224
body, 100
boolean-valued, 243
context, 101–103
execution, 101–104, 107
handle, 169, 170
header, 99
no input parameters, 202
overloaded, 234
parameter, 100–104
parameters that are structures, 231
recursive, 340
returning a subset of output, 195
search path, 117
specification, 99, 111
string-valued, 202
subfunction, 117
user-defined for graphics, 125
why use, 95
with multiple output parameters, 148
with no output parameter, 120
fwrite, 280
gigabyte, 279
golden ratio, 56
granularity, 74
graphical user interface, 380
graphics functions, 125
gray value, 307
great circle distance, 367
greatest common divisor, 411
Greek symbols in plots, 400
grid
generation, 166, 169
refinement, 306
Hamming, Richard, xii
help, 98
hertz, 322
heuristic, 360, 365
histogram
hist, 135, 140
hold
off, 83, 85
on, 83, 85
Horner’s rule, 92
429
IEEE
arithmetic, 89–90
floating point standard, 89, 91
if, 16–21, 23–24
imag, 107
image
and dirt specks, 308
black and white, 307
color, 307
compression, 313
cropped, 310
edge detection, 308, 311–312
file formats, 313
gray value, 307
image processing, 306–317
image rendering, 297
imread, 309
imshow, 309
imwrite, 309
infinity
inf, 90, 92, 368
inner product, 333
input, 6, 11
inscribed circle, 244
computation, 248
insertion sort, 189, 191–192
int, 280
integer vectors
generating, 185
interpolation
adaptive piecewise linear, 354
bilinear, 293
cubic, 84
linear, 79, 285
intersection problems, 237–244
computer graphics, 242
intervals, 414
inverse cosine, 412
inverse sine, 412
inverse tangent, 411
iteration, 30–34, 38–42
reasoning about, 40
Java, 417–421
.jpg, 309
least squares fitting, 381
legend, 404
AUTHOR PROOFS. NOT FOR DISTRIBUTION. REPORT ABUSE TO [email protected]
Copyright © by SIAM.
Unauthorized reproduction of this article is prohibited.
430
Index
length
of a cell array, 216
of structure arrays, 233
length, 74, 205
liberal education, xi
line width in plots, 408
linear equations, 253
2-by-2 systems, 249
solving with, 249
linear interpolation, 79, 285
linear search, 203, 204
efficiency, 205
linspace, 67, 75, 167
local variable, 106
log, 12
log10, 12
log2, 12
logarithm, 411
logic
and problem-solving, 21
logical operator, 18, 22, 23
loglog, 77
logspace, 75
loop
for, 30–34, 76
nested, 49–53, 159
reasoning about, 40
while, 38–42
lower, 206
matrix, 157, 161–164, 283–317
building column by column,
290
building row by row, 290
max, 21
applied to a matrix, 164, 291
applied to a vector, 140
mean, 133, 139, 194
measurement error, 7
measuring performance, 194
median, 194
median filtering, 311
megabyte, 279
memory
exceeded, 140
memory traffic, 184, 255
merge sort, 344–353
mesh generation, 341
mesh points, 166
metrics
nearness, 252
min, 21
applied to a matrix, 164, 291
applied to a vector, 140
minutes of arc, 412
mod, 140
model-building, 381–388
model error, 7, 264
model parameters, 382
Monte Carlo simulation, 134
m-file, 6, 8–9
machine precision
eps, 91
full, 90
machine epsilon, 91
make functions, 230, 235
mantissa, 88
marker size in plots, 406
Markov chain, 160
math symbols in plots, 402
mathematical error, 7
mathematical facts, 411–415
mathematical maturity, 411
Matlab
and C, 417
and Java, 417
figure editor, 389
NaN, 92
nchoosek, 59
nearness metrics, 252
nested loops, 49–53, 159, 376
Newton’s method, 105, 225
norm, 334
normal distribution, 134
not (logical) ˜, 18, 23
not-a-number, 92
NP hard, 365
O (order of magnitude), 53
object-oriented programming,
419
objective function, 373
ones, 76, 162
online data sets, 266
AUTHOR PROOFS. NOT FOR DISTRIBUTION. REPORT ABUSE TO [email protected]
Copyright © by SIAM.
Unauthorized reproduction of this article is prohibited.
Index
optimization, 363–388
constrained, 374
objective function, 373
or
logical ||, 18, 22
outlier, 388
overloaded functions, 234
PageRank, 148
parameter, 100–104
parametric equations
ellipse, 413
line, 413
Pasteur, Louis, 129
pause, 68, 76
pcolor, 175
perfect shuffle, 179, 181–185
generalization, 187
perimeter of an ellipse, 109–117
permutations, 185
perpendicular bisector, 247
petabyte, 279
pi
approximation, 29–34, 47–51, 131–
136
pi, 11
piecewise linear interpolation, 354
pixel, 306
plane geometry computation, 227–254
plot
axis scaling, 86, 153, 390
color, 84–85
color checkerboard plot, 175
color shading, 175
colormap, 175
caxis, 175
labelling, 77, 85
line and marker, 76–77
logarithmic scaling, 77
refresh versus accumulate, 85
subplot, 153
plot, 67, 76
plot window
color, 409
point set, 229
diameter, 229
polygon
431
approximation of ellipse, 36–39
polygons, 412
convex, 412
regular, 412
polynomials, 412
Pope, Alexander, 129
practice versus theory, 371
print
disp, 11, 164
format, 6, 164
fprintf, 6, 11, 164
sprintf, 68, 77, 164
to screen, 6, 11
to string, 68, 77
print-to-file, 271
probability, 132
product notation, 412
proof by picture, 371
pseudocode, 16
pwd, 266
quadrants, 412
quadratic function, 14
radians, 412
rand, 132, 139, 162
randn, 135, 139, 162
random
cell arrays of strings, 217
protein generation, 200
rectangles, 241
triangle, 251
Web surfer, 148
random number
from normal distribution, 135,
139
from uniform distribution, 132,
139
is pseudorandom, 139
seed, 136, 139
random walk, 143–148
rational
approximation, 47–51
number, 45, 411
rational functions, 412
ReadMe files, 259, 267
real, 107
realmax, 92
AUTHOR PROOFS. NOT FOR DISTRIBUTION. REPORT ABUSE TO [email protected]
Copyright © by SIAM.
Unauthorized reproduction of this article is prohibited.
432
rectangle intersection, 237
recursion, 335–361
base case, 341
infinite, 341
recursive formula, 56
refined graphics, 389
relational operator, 17, 22
relative error, 101
ellipse perimeter approximation, 113
square root approximation, 104
remainder
mod, 140
rem, 22
repeated augmentation, 290
repeated averaging
of neighboring points on a grid, 172
to calculate square root, 97–105
to smooth a polygon, 149–153
reshape, 185
rgb, 285, 308
computation, 80–82
vector, 80, 84
rgb2gray, 309
Roman numerals, 208–215
evaluation rules, 208
root-finding, 105
round, 22
rounding error, 7, 88–91
sampling rate, 322
scalar, 74
science
versus engineering, 387
scientific notation, 10, 11
script, 6, 8–9
search, 197–225
binary, 211
linear, 203
seconds, 412
seed, 136, 139
segmentation, 324
selection sort, 195
semilogx, 77
semilogy, 77
sets, 414
shading, 292
shading interp, 175
Index
shape metrics, 244–253
shg, 83, 85
shortcircuiting, 23
signals and noise, 333
simulation, 134
on a grid, 171–175
sine, 411
sin, 12
single, 280
size, 162, 290
smoothing a polygon, 149–153
sort, 194
applied to cell array, 217
sorting algorithms, 188–194
bubble sort, 189–190
comparisons and swaps, 192
insertion sort, 191–192
merge sort, 344–353
selection sort, 195
sort, 194
sound, 323
sound files, 319–334
sound wave
frequency, 326
specification, 99
sphere
surface area, 3, 413
volume, 413
sprintf, 68, 77, 164
square root
approximation, 97–105
sqrt, 11
standard deviation, 133, 139
state vector, 159
statement
assignment, 4, 7, 9
conditional, 16–21, 23–24
continuation, 10
stationary vector, 160
std, 133, 139
steady state, 160
stop execution, 42
storage capacity, 279
str2double, 261, 266
str2num, 266, 272
strcmp, 203, 206
strings, 10, 200, 205
AUTHOR PROOFS. NOT FOR DISTRIBUTION. REPORT ABUSE TO [email protected]
Copyright © by SIAM.
Unauthorized reproduction of this article is prohibited.
Index
array of characters, 201
blanks, 206
colon notation, 205
comparing, 203
concatenation, 200, 206, 324
conversion into numeric, 266
delimiters, 200
empty string, 200, 206
equality, 206
length, 205
substring extraction, 200
substrings, 205
struct, 230, 235
structure, 246
structure arrays, 231, 235
length, 233
structure variables
definition, 230
design of, 231
dot notation, 230
fields, 230
make functions, 230
with structured fields, 246, 253
structures
circle, 245
line, 245
point, 230, 246
rectangle, 239
triangle, 246
subfunction, 117
subplot, 153
subscript
matrix, 161–162, 175
out-of-bounds, 203
vector, 70–71, 75
substrings, 200, 205
sum
applied to a matrix, 163, 291
applied to a vector, 139
summation notation, 412
tangent, 411
tan, 12
terabyte, 279
terminate execution, 42
text, 82, 85
fancy labelling, 393
433
text files
versus binary files, 280
theory versus practice, 371
tic and toc, 52, 53, 194
title, 68, 77
top-down development, 47–49, 95, 124
touch-tone signal, 326–331
trailing blanks, 218
transition probability matrix, 157
transpose, 74
traveling salesperson problem, 365–372
tree, 341
children, 341
nodes, 341
triangle
area, 413
trigonometric functions, 12
trigonometric identities, 414
trinomial coefficient, 108
truth table, 18, 21
types
double, 280
int, 280
single, 280
uint8, 280
uint8, 280, 307
uniform distribution, 132–134
upper, 206
variables, 4–5, 9
local, 106
logical, 136, 140, 239
vector, 67–76
counters, 201
vectorized
arithmetic, 68, 76, 163
boolean operation, 136, 140
vectors
nearly sorted, 195
of characters, 200
visualizing a function of two
variables, 166–169
.wav, 322
encoding scheme, 323
wavread, 322
wavwrite, 323
AUTHOR PROOFS. NOT FOR DISTRIBUTION. REPORT ABUSE TO [email protected]
Copyright © by SIAM.
Unauthorized reproduction of this article is prohibited.
434
Index
while, 38–42
while loop
reasoning about, 40
working directory, 266
worst case analysis, 194
Xeno’s paradox, 90
xlabel, 77
ylabel, 77
zero-finding, 105, 224
Newton’s method, 225
zeros, 72, 76, 162
AUTHOR PROOFS. NOT FOR DISTRIBUTION. REPORT ABUSE TO [email protected]
Copyright © by SIAM.
Unauthorized reproduction of this article is prohibited.