[CMSC 455] | [Syllabus] | [Lecture Notes] | [Homework] | [Projects] | [Files] | [Notes, all]

CS455 Details of homework assignments and Quiz

    The most important item on all homework is YOUR NAME!
    Print. No readable name, no credit.
    Staple or clip pages together.
    Homework must be submitted when due.  You loose 10%, one grade,
    the first day homework is late. Then 10% each week thereafter.
    Max 50% off. A zero really hurts your average!
    Paper or EMail to squire@umbc.edu  ONLY PLAIN TEXT.
    I can NOT accept OCTET/STREAM. .doc .gif .jpg .rtf ...
    If I can not read or understand your homework, you do
    not get credit.  Type or print if your handwriting is bad. 
    Homework is always due on a scheduled class day before midnight.
    If class is canceled then homework is due the next time the
    class meets. EMailed or submitted homework has until midnight
    of the day it is due, or under my office door before I get in.
  EMail only plain text! No word processor formats.
       You may use a word processor or other software tools and
       print the results and turn in paper.

Submit Homework

 The "submit" facility only works on the "gl" machines.
 The student commands are:
    submit   cs455 hw1 some_file
    submitrm cs455 hw1
    submitls cs455 hw1

Do your own homework!

You can discuss homework with other class members but DO NOT COPY!

All parties involved in copying get zero or negative on that assignment.

Contents

  • Homework 1
  • Homework 2
  • Quiz 1
  • Homework 3
  • Homework 4
  • Quiz 2
  • Homework 5
  • Homework 6
  • Quiz 3
  • Other Links
  • HW1 , Rocket height 25 points

    In a language of your choice, write the program defined in
    lecture 2. Test your program and
    produce an output file, then submit both files on a GL machine:
    
    submit cs455 hw1 your-source your-output
    
    
    

    HW2 , Least Square Fit 25 points

    In a language of your choice, write a program that
    does a least square fit of the thrust data used in Homework 1.
    Use your data  x =  0.0  0.1   0.2  ...  1.9
                   y =  0.0  6.0  14.1  ...  0.0
    
    Do the least square fit with 3, 4, ... , 18 degree polynomials.
    Compute the maximum error, the average error and RMS error
    for each fit. If convenient, look at the plots of your fit
    and compare to the input.
    
    Print out your data.
    Print out your polynomial coefficients for each degree 3..18
    Print out maximum, average and RMS error for each.
    Lecture 1 shows how to compute error
    copy whatever you need from Lecture 4, Least square fit
    
    Submit your source code file(s) and your output file
    
    submit cs455 hw2 your-source your-output
    
    My MatLab errors looked like:hw2_m.out
       (with a lot of complaints from MatLab!)
    
    My "C" errors did not improve as much:hw2_c.out
    
    Plotting three points between each starting point in MatLab, n=19, gave:
    
    
    
    

    Quiz 1, 12.5% of course grade

    See Lecture 9
    

    HW3 , Integration 25 pts

    
    1. Compare two methods of integrating  sin(x) from 0 to 1
    Take as the exact solution  -cos(1.0)+cos(0.0) = 1.0-cos(1.0)
    Print out number of points, your integration value, and
    error your_value-exact
    
    1.a) Use the trapezoidal method with 8, 16, 32, 64 and 128 points.
       Put this in a loop  e.g. in C  for(n=8; n<=128; n=n*2)
       Note how the error decreases as n increases.
       h = 1/n
       your_value = h * ((sin(0)+sin(1.0))/2 + sum i=1..n-1 sin(i*h))
     
    1.b) Use the Gauss Legendre method with 8 and 16 points.
       Copy the function  gaulegf  from your choice of language
       or convert to your choice of language. Be sure to keep
       the #undef abs and #define abs in "C" code.
    
       double x[17], w[17]
       n=8   then again for n=16
       gaulegf(0.0, 1.0, x, w, n)
       your_value = 0.0
       for(j=1; j<=n; j++)
          your_value = your_value + w[j]*sin(x[j])
    
    
       Note the significantly smaller error than for trapezoid.
    
    2. Write a small program in the language of your choice to
       numerically compute, to at least 3 significant digits,
       the area that is outside Circle 1 and inside both Circle 2
       and Circle 3.
       Circle 1 center at (2,2) radius 1   (x-2)^2+(y-2)^2=1^2
       Circle 2 center at (0,2) radius 2    x^2+(y-2)^2=2^2
       Circle 3 center at (0,0) radius 3    x^2+y^2=3^2
    
       Hint: count the dots in the area and multiply by the
       area of a square. Run with a grid 0.1, 0.01, 0.001, 0.0001
       to see if your computation is converging. Obviously, if the
       left hand side of the equation is larger than the right
       hand side of the equation, the point is outside the circle.
    
    
    
    
    submit cs455 hw3 your-source your-output    for 1a, 1b and 2
    
       (Note: in problem 2, if you were given a function z=F(x,y) and
        needed to compute the volume over the area, you would
        probably combine part of problem 1 with problem 2.)
    
    

    HW4 , Big numbers 25 pts

    Use a language and big numbers package of your choice to
    compute the exact integer value of the following:
    
    How many ways can you lay out a deck of cards in a line?
    52 cards in a deck, all permutations is 52!.
    Thus, just compute 52 factorial.
    
    How many five card hands from a deck of 52 cards?
    This is an n choose m problem. n! / ((n-m)! m!).
    n is 52, m is 5. Direct computation, no math reductions.
    
    Submit your source code and your output.
    (Clean out unused source code, it should be small.)
    
    

    Quiz 2, 12.5% of course grade

    See Lecture 19
    

    HW5 , FFT 25 pts

     
    Take a .wav file. Listen to it.
    Extract the amplitude data from the .wav file.
    Use a FFT to get the frequency spectrum.
    Modify the frequency spectrum
    Use inverse FFT to get amplitude data.
    Insert the modified amplitude data into the .wav file.
    Listen to the new .wav file.
    
    a) delete high and low frequencies from the spectrum or
       perform some other modification. Comment on how the
       sound changed.
    
    b) Move all of the spectrum from i to n down into 1 to n-i,
       zero spectrum from n to top. You should be able to
       understand the modified .wav yet it will be a much
       deeper voice. You have lowered the frequency.
    
    Sample code for FFT and IFFT provided.
    copy whatever you need from Lecture 18, FFT
    Sample code to read and write a .wav provided.
    waveplay.m reads a .wav file, plays the file
    at three speeds, then writes a .dat file with just the sound.
    The .dat file can be read with %f format. soundplay.m
    Will play a .dat file, that may be read, modified, and rewritten.
    
    The program read_wav.c reads and writes a .wav file.
    You can put a FFT in between the read and write for your homework.
    Use common existing software to play the .wav file(s).
    
    You may need to convert complex values to magnitude.
    Given a+bi  amplitude = sqrt(a*a+b*b)
    
    Submit your source code, input .wav files and output .wav files.
    (option: use just ascii files of numbers, read and write with %f
     MatLab code  soundplay.m plays file.
     short_count.dat is one two three.)
    
    
    

    HW6, Timing 25 points

     
    Compile and run the program time_matmul.c
    on some computer. You may use other languages and MatLab.
    Time the matrix multiply for 100 by 100, 200 by 200, 400 by 400 etc
    and record the actual time and a normalized time. It is OK to stop
    when a single size takes over 10 minutes.
    
    The normalized time is some constant time actual time divided by N^3.
    Matrix multiply is order N cubed, thus the time goes up by a factor
    of 8 each time N doubles. Note that the small 100 by 100 runs very fast.
    As the matrix gets larger, the time increases by more than a factor of 8.
    This is because of cache performance verses memory bandwidth.
    
    Submit your code and your output.
    
    
    

    Quiz 3, 15% of course grade

    See Lecture 29
    

    Other links

    Go to top

     Last updated 6/7/07