MAT5939-03 ACM Computing Seminar – Fall 2019

Course Information (syllabus)

Time & Place: Monday 18:45-20:00, LOV 102
Instructor: Zhifeng Deng
Office Hours: Monday/Tuesday 1:00-2:30 or by appointment
Email: zdeng@math.fsu.edu

Resources

Programming Language Guides

Programming Assignment Resource

Programming Environment Setup

Assignments

Due Time Assignment
1 <2019-08-26 Mon> 1. Read the Programming assignment resources carefully.
   
  2. Install g++ or other compiler you prefer, create and compile helloworld.cpp.
2 <2019-09-16 Mon> Summation.
   
Assignment 2 Consider the Taylor series $$\cos(x)=\sum_{k=0}^{\infty}\frac{(-1)^kx^{2k}}{(2k)!}.$$
   
  Write a routine to evaluate \(\cos(x)\) with the following truncated serise:
  $$s_n=\sum_{k=0}^n\frac{(-1)^kx^{2k}}{(2k)!}$$
  in single precision at \(x=1.5708\).
   
  You should determine the truncation \(n\) by bounding the relative error
  $$\lvert (s_n-\cos(x))/\cos(x)\rvert$$
  under threshold RelTol. Generate the exact answer, \(\cos(x)\), the exact
  truncated sum, \(s_n\) and the exact series in double precision.
  NOTE: Computation done in double precision is consider exact w.r.t single precision.
   
  You routine should evaluate the sum, \(\hat{s}_n\), in different strategies:
  1. Accumulate in decreasing order of the magnitude.
  2. Accumulate in increasing order of the magnitude.
  3. Accumulate the positive and nagative parts in decreasing order of magnitude separately.
  4. Accumulate the positive and nagative parts in increasing order of magnitude separately.
   
  Check the final error you achieved \(\lvert(\hat{s}_n-\cos(x))/\cos(x) \rvert\) as well as
  the error w.r.t to the truncated sum \(\lvert (\hat{s}_n-s_n)/s_n \rvert\). Discuss your observation.
  Do you find certain strategies under certain RelTol perform terrible? In what sense?
   
   
   
3 <2019-09-30 Mon> Newton method.
   
Assignemnt 3 Implement Newton method, i.e., the iteration
  $$x_{k+1}=x_k-\frac{f(x_k)}{f'(x_{k+1})}$$
  to solve the problem
  $$x^3-x+0.384900179=0$$
  in IEEE double precision system.
   
  Your routine should terminate when \(x_{k+1}\) gets no update, i.e. \(x_{k+1}=x_{k}\). Use the last
  \(x_{k}\) as the true solution \(x_*\), i.e. \(x_*=x_{k_{\max}}\). Do the log-log plot of
  \(\lvert x_k-x_*\rvert\) vs \(k\). Comment on the quadratic behavior and possibly some outliers.
   
  Note that in this simple case, you may not obtain a nice straight line for convergent order.
  Quadratic convergence in 1 dimension problem is way too fast therefore convergent sequence
  is short and the numeric error comes in too early. You can still comment on magnitude,
  which indicates quadratic convergence.
   
<2019-11-11 Mon> Implement a column-major matrix class with element accessor, column array accessor and overloaded
Assignment 4 operator << for outputing.
  Compute the \(p\)-norm of the columns of a 5 by 6 matrix, whose entries take random value in \([0,1]\),
  with \(p=1,1.5,2\).
  Your norm routine should be generic for arbitrary standard array in C++. A typical implemtation is
  template<class T>
  T norm(T* data, int length, double p)

Anouncements

Date Announcement
<2019-09-07 Sat> The due day of assignment 1 corrected.
   
<2019-09-25 Wed> The Julia code of assignment 1 is posted in here.
<2019-11-04 Mon> The row-major matrix class is posted in here.
<2020-01-04 Sat> blah.