MATLAB code for Linear Algebra and Probability for Computer 
Science Applications
 Ernest Davis 
 Examples discussed in the text 
 Chapter 1: Matlab 
-   hailstone.m Hailstone procedure, p. 6.
 -   p35.m Script to compute x35, p. 6.
 -   fib.m Recursive definition of Fibonacci numbers,
p. 8.
 -   quadform.m  Solve the quadratic equation, p. 8.
 -   t1.m  Local and global variables, p. 9.
 
 Chapter 2: Vectors 
-   correlation.m Compute the correlation
of two vectors (p. 35).
 -   GetStopwords.m  List of stop words for 
Assignment 2.1, p. 43.
 -   hash.m Hash function for assignment 2.1, p. 43.
 
 Chapter 3: Matrices 
 Chapter 5: Algorithms 
-   sampleRandomSings.m
sampleRandomSings(n,k) calls testRandomSings(n) k times and find the
frequency with which LU decomposition generates a zero vector in the
last row and the frequency with which the rank is measured at n-1.
See section 5.2.3, p. 122.
 
 Chapter 6: Geometry 
-   TransformImage.m  Coordinate 
transformation on image arrays. p. 174.
 -   EulerRotation.m. Computes the
3x3 rotation matrix for the Z-X-Z Eulerian angles. Useful subroutine
in testing Assignment 6.3 (p. 178).
 -   polyhedra.m  Script to constructs 5 polyhedra 
as cellular arrays of faces. Useful for testing Assignmment 6.3 (p. 178).
 
 Chapter 7: Change of Basis, DFT, and SVD 
-   getimage.m . Converts an image file to
an array. Used in exercise 7.3. Credit: Pascal Getreuer.
 -   dft.m Uses FFT to convert time-domain to
frequency domain (real DFT).  Section 7.10.2, p. 213.
 -   idft.m Uses FFT to convert frequency domain
to time-domain (real DFT). Section 7.10.2, p. 213.
 -   trigBasis.m . Matrix whose columns are
the trigonometric Fourier components of size 2K. Section 7.10.2, p. 213.
 
 Chapter 12: Monte Carlo Methods 
-   MCCircle.m  Estimate the area of a circle, and
create a plot. Section 12.1.
 -   MCPrimes.m Estimate the number of integer
solutions to 
"x2 +
y2 +
z2" is prime where x, y, and z are between 0 and N.
 -   RelabellingSig.m
Use resampling to determine whether the difference in mean between
data sets V and W is significant. Discussed section 12.7, p. 368.
 
Chapter 14: Maximum Likelihood Estimate 
 Code used to generate figures in the text 
The code to generate figure 6.19 is not included here,  as that is the answer
to Programming Assignment 6.3.
-   DrawFig31.m Smoothing. Figure 3.1, p. 52.
 -   DrawFig34.m Polynomial and 
sinusoidal interpolation. Figure 3.4, p. 61.
 -   FourierA.m and 
FourierB.m. Discrete Fourier vectors. p. 195.
 -   DrawFig96.m Distribution and density for
a step function. Figure 9.6 p. 280.
 -   DrawFig97.m Probability density as the limit
of histograms. Figure 9.7 p. 282.
 -   DrawSigmoid.m Distribution and density for
a bell-shaped curve. Figure 9.8, p. 283
 -   probStairs.m Subroutine for figure 9.7.
 -   DrawFig910Corrected.m  
Approximating the binomial
distribution with the Gaussian. Figure 9.10, p. 290. (Corrected:
See Errata on this.)
 -   MCCircle1.m  Monte Carlo estimate of the area
of a circle, Figure 12.1, p. 340.
 -  BoundingBoxFig1.m "Bounding box"
Figure 14.2, p. 395.
 -  BoundingBoxFig.m Code to generate
a random figure similar to Figure 14.2.