Assigned Date: Wednesday, Sep. 18, 2007
Due Dates: Friday, Sep. 28, 2007
Due Time: 11:55pm
Last modified on September 21, 2007, at 08:38 AM (see updates)
According to Hsu and Hsu :
An anecdote has been told about the dialogue between Emperor Joseph and Mozart after the first performance of his
Abduction from from the Seraglio: The emperor complimented the composer for the heavenly music but complained that it had too many notes. Mozart's reply was, of course, that not one note was dispensable. We agree that we cannot arbitrarily substract a single note from the master's composition. Yet, could we eliminate half of the notes and still consider the music to be by Mozart?
The question whether music has a fractal geometry has been debated. We have presented an analysis and given a positive answer. If this is indeed the case, the implication is self-similarity and scale-indendency. In other words, a musical composition could be represented by a music score of a different scale, using a half, a quarter, or twice as many notes as written by the composer; Emperor Joseph could have an Abduction, at least a music score of the Abduction, that contains half as many notes as it is written by Mozart.
Design, implement, and test a program using incremental development.
bookAbduction.py which reads in an e-book (filename provided by the user), and outputs every other word of the book to a file.
The output filename should be the same as the input one, but with the substring ".abduction" inserted prior to the last "." in the filename (e.g., given input file
Plato.Republic.txt, the output filename should be
Now, write a program
fractalBookSkimmer.py which extends the previous program by allowing the user to enter the abduction level (i.e., how many times to repeat this abduction process).
Output filename should be the same as the input, but with ".skim.level" inserted prior to the last ".", where level is what the user asked.
Test your program with e-books from Project Gutenberg. (For now, use only the us-ascii encoding.)
Run the program on several book with levels 1, 2, 3, 4, etc. Start reading with the highest level (e.g., 4). How far back do you need to get before you can get the gist of what this book is about?
Write a short report describing which books you used and what you observed. Save it in a file called
report.txt. It should be a text file (not a Word document).
Your report should have your name, class, assignment, and date at the top.
report.txt files as attachments. If you cannot get step 2, it is fine to submit steps 1 and 3 for partial credit.
Email subject should be "Assignment #2".
My email address is email@example.com.
The following policies are in effect for this assignment:
- Programming assignment grades will be based on design and style as well as correctness of result.
- You may discuss the problem and how to solve it with others, but you may not look at, copy, or use any code (or pseudocode) that was written by anyone other than yourself. If I have evidence that you have shared program code or used code found anywhere, your grade will be zero.
- If you do discuss the problem and how to solve it with others, you must document that in the program code.
- Not following these rules is in violation of the Student Honor Code and instances of such violations will be reported to the Honor Board.
All identifiers should be meaningful.
Include your design (pseudocode) as comments in your program.
The following comments should appear in your program as the first lines in the file. Items in angle brackets are either to be removed or replaced with what is specified within the brackets:
# Name: <your name goes here – first and last minimum>
# Problem: <Brief, one or two sentence description of the
# problem that this program solves, in your own
# Certification of Authenticity:
# <include one of the following>
# I certify that this lab is entirely my own work.
# I certify that this lab is my own work, but I
# discussed it with: <Name(s)>
- Kenneth J. Hsu, Andrew Hsu, "Self-Similarity of the '1/f Noise' Called Music", Proceedings of the National Academy of Sciences of the United States of America, Vol. 88, No. 8 (Apr. 15, 1991), pp. 3507-3509.
- Michael Frame and Benoit B. Mandelbrot, "A Panorama of Fractals and Their Uses", Mathematics Department, Yale University.