4 <20160926 Mon> 
Add a member function, norm , to the vector class 

discussed in the C++ guide. The function should 

have the signature: 



double norm(double p); 



and should implement the vector pnorm. The function 

would be then called like: 



x.norm(1.53); 



where x is a vector object. Write a test script 

that loops through values of p=1, 1.1, ..., 1.9, 2 

and for each value of p , prints the average pnorm 

of 100 vectors of length 10 whose components are 

uniform random on [0,1] (see the C++ guide section 

on generating random numbers). 
5 <20161003 Mon> 
Extend the vector class given in the guide, by 

adding functions dot , operator+ , operator , 

and operator== . Implement these as friend 

functions. 



dot should implement the inner product between 

two vectors, x and y , while operator+ and 

operator should implement componentwise addition 

and subtraction. 



The behavior of operator== should be 

such that x==y returns true for vectors if 

abs(x[i]y[i]) < 1e10 

for all the components of the vectors, x and y . 
7 <20161017 Mon> 
Write a squarematrix class that inherits from the 

matrix template class. The constructor should only 

accept a single argument to create the matrix, rather 

than two like the normal matrix class. 



Add a member function, unique to the squarematrix 

class, that computes the matrix determinant 

recursively using the Laplace expansion. Test your 

algorithm on square matrices, \(A \in R^{n \times n}\), 

where \(A_{ij} = ni + j\), where \(i=0,\ldots,n1\) and 

\(j=0,\ldots,n1\) for \(n=2,3,\ldots,100\). 