Massachusetts Institute of Technology
Dept. of Electrical Engineering and Computer Science
Spring Semester, 2008
6.01: Introduction to EECS I
Comments on exploration 5
Grading comments on exploration 5
There were two parts: (I) symbolic expressions; and (II) the
toothbrush model. Each was worth 5 points.
I: Symbolic expressions
This is a very difficult problem to do in general, especially when you
consider the issues of algebraic simplification, for example
- Does multiplying x times zero give
zero?
- Does adding y+2 and y+3 produce x+y+5?
- Does adding 2*x and x*2 combine the terms?
- Does adding x*y*x to x*x*y combine the terms?
Things are much harder if you consider fractions and common
denominators: there have been Ph.D. thesis written on that topic.
In order to get significant points on this problem, you had to not
only implement the basic code, but also include test cases and give
explanations. You also had to have a good set of test cases that
exhibited the different properties of your system, not just two or
three expressions.
One of the big dimensions on which the class answers diff-erred was the amount
of simplification. Most people handled the cases of adding zero and
multiplying by zero. But few people dealt with things like x*y=y*x.
There were several really excellent papers turned in.
But one area where almost everyone fell down was in using data
abstraction. Typically, people represented algebraic expressions as
strings. As a result, the various operations had to continually parse their
inputs, which made them both cumbersome to implements as non very
extensible.
A better idea would be to keep the expressions as data
abstractions. For example, a "sum" is an object that has a list of
terms, and a "term" is an object that has a list of "factors", and a
"factor" is either a number or a symbol or a sum (note the recursion).
Then define addition and multiplication as operations on the list of
terms, to generate new lists of terms and factors. And then define
print methods separately from all of this.
Professional level algebraic manipulation systems are often
implemented with the aid of pattern matchers that abstract
away the details of manipulating expressions and picking out the
pieces. You can learn about this in courses on symbolic computing,
including 6.945.
II: Buying toothbrushes
This problem was much easier than part I. Many people did very well
and got the full 5 points. In order to get full credit, you needed
not only the correct diagrams and equations, but also a good analysis
of qualitative behavior, including a discussion of stability that
included some algebraic analysis to find the poles: not just a lot of
computer printout showing that you could search different values of
k.