CS 1323 Section 30, Spring 1997
Individual Project 5
Signal Identification
Due Wednesday, March 19, 3:30pm
papers submitted after 3:30pm Mar 19 and before 4:30pm Mar 20
suffer a penalty of one-grade
papers not accepted after 4:30pm Mar 20
What to Hand In (see also:
example project solution)
- a
Program Organization Chart
exhibiting the interactions between major program
components. Attach a report to the chart
providing a rationale for the program organization
- a
listing
of the Haskell script you write for your
project, following the required
standards
- a
two transcripts of a session
during which you entered the command main to demonstrate
your program's behavior
- a logical argument showing that the function
average,
defined in the
NumericUtilities
module, satisfies the following property:
- Property A
- If xs :: [Float],
then average(xs) = sum(xs)/length(xs)
- Assume, in your proof, that arithmetic on type Float is exact.
(It isn't, really, but assume it is, anyway.)
- Extra Credit: Assuming that the range of numbers
a computer can perform arithmetic on is limited,
give an example sequence xs where
the formula defining
average(xs) in the NumericUtilities module delivers
a better approximation to the average of the numbers in
xs than the formula
sum(xs)/length(xs).
The Program You Must Write
Write a program that reports, for each of the years after
World War I in a file
rainfall.dat
on the Supplied Software page of the class web site,
the three years from
before and during World War I whose rainfall patterns most
closely resemble the rainfall pattern
of that post-war year. The program should also report the degree of
resemblance between each of three most similar years and
the post-war year in question.
That is, for each post-war year y in the dataset,
the program reports the three pre-armistice years whose
rainfall patterns most closely match those of the post-war year
y along with the degrees of resemblance between the three
most similar pre-armistice years and the post-war year y.
-
The program may assume that:
- Each year recorded in the data file
will contain records for the same set of months.
- The data file will contain records for
some pre-armistice years and some post-armistice years.
- The standard deviation of the rainfall figures for any given
month in the pre-armistice years is not zero.
-
However,
the program should not depend on the number of years of rainfall
data recorded in the data file, nor should it depend on the
number of months per year recorded in the file.
- Resemblance Between Rainfall Patterns
A rainfall pattern is a sequence of numbers representing the
rainfall amounts in the months of a given year
in chronological order, January through December.
The degree of resemblance between two rainfall patterns is
the correlation between their normalized patterns --
the larger the correlation, the greater the resemblance.
- Normalized Rainfall Patterns
A normalized rainfall pattern is sequence of numbers constructed
by dividing the numbers in a rainfall pattern by the
standard deviations of the numbers in the corresponding months
of the pre-armistice years. For example, the January figure in
a normalized pattern is the January figure from the original
pattern divided by the standard deviation of the January figures
for the pre-armistice years.
- Correlation Between Sequences
Two sequences of numbers have a correlation if they contain
the same number of elements.
The correlation between two such sequences is
the sum of the products of the corresponding elements of the two
sequences divided by the product of the magnitudes of the
two sequences. The magnitude of a sequence
of numbers is the square root
of the sum of the squares of its elements.
Ground Rules
- Depending on how you construct the program, it may consume
a lot of space when it carries out the computation.
Sometimes, when Hugs runs out of space, it collapses
issuing a message indicating a floating point exception
of some kind. If this occurs, try restarting Hugs with
a command like this:
- hugs -h500000 yourProgramFilename.lhs
The "-h500000" option makes five times more than the default
amount of space available. The "h" stands for "heap."
- You may use any aspects of Haskell
described in the Haskell textbook, any intrinsic operator or function
you have learned from any source, and
any
software supplied
for any project on the class web site.
Note that
-
NumericUtilities
exports functions for computing standard deviations
-
IOutilities
exports functions for converting between numbers of various
types and strings in various formats
-
SequenceUtilities
exports the function transpose, which rearranges "matrices"
as sequences of rows or columns, and
the function quickSortWith, which rearranges a sequence to
conform to a given ordering among its elements
-
Project3D
exports a function to build table displays from
columns of words
-
modules defined in the solution to Project 4
(
TableConversion,
VarianceNormalization)
export functions that you may find useful in this project
- The
Project Style Guide
describes additional report requirements.
CS 1323 Section 30 - Fundamentals of Computer Programming -
Spring 1997
Instructor:
Rex Page
(Email: page@ou.edu)
Up to: Welcome Page ~~~
Up to: University of Oklahoma ~~~
Go to:
Next Semester ~~~
Go to:
Previous Semester