MAT5939-03 ACM Computing Seminar – Fall 2016
Course Information (syllabus)
Time & Place: | Monday 6:45PM - 8:00PM, LOV 102 |
Instructor: | Matt Hancock |
Office Hours: | Tues 12-2, Thurs 2-4, 409 B MCH |
Email: | mhancock@math.fsu.edu |
Resources
Programming Language Guides
Programming assignment resources
- Programming assignment template (Read the README!)
- Example programming assignment and solution
Assignments
Week | Assignment |
---|---|
1 | Install gcc / g++; write and compile "hello world". |
2 | Compute the value of the truncated sum, |
\(s_N := \sum_{n=1}^N \frac{1}{n^2}\) | |
and the absolute error, | |
\(a_N := \vert{}\frac{\pi^2}{6} - s_N\vert{}\) | |
while \(a_N > 10^{-5}\). For each iteration, print | |
\(N\), \(s_N\), \(a_N\) | |
if \(N\) is a multiple of \(100\). | |
3 | The files, x.txt, and y.txt contain 101 sampled |
points. The x values are not sampled equidistantly. | |
Write functions to read both files, and approximate | |
the definite integral of the sampled function over | |
the values given, using the trapezoidal rule. | |
Modularize your code, i.e., use header and | |
implementation files | |
4 | 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 p-norm. 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 p-norm |
|
of 100 vectors of length 10 whose components are | |
uniform random on [0,1] (see the C++ guide section | |
on generating random numbers). | |
5 | 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 component-wise addition |
|
and subtraction. | |
The behavior of operator== should be |
|
such that x==y returns true for vectors if |
|
abs(x[i]-y[i]) < 1e-10 |
|
for all the components of the vectors, x and y . |