Friday, September 26, 2014

Folding Problem

Got it. The problem I had before had to deal with an index error I would get on folds larger than 3. The problem seemed to be that when I was reversing the folds on the left side of the down fold, the list I was multiplying it by was not of the same length.

For my purposes, I used [-1] to represent a single down fold and [1] to represent a single up fold. When I had the list [1, -1, -1], which was the result from two folds, I originally tried to multiply it just by [-1]. Instead, I had to multiply it by [-1, -1, -1] to prevent the indexing error. So, I needed to figure out what size the list would be based on its number of folds. Then, I would multiply this number by [-1] in order to get a list of several -1's. This stopped the indexing error from occurring. Technically, my function now works for any number of folds. Practically, any more than 5 folds seems to take to long to compute. Maybe I'll figure out a way to optimize such functions one day so that I won't run into the same issue.

Week 3

This week I enjoyed tackling the folding problem presented on Friday. For starters, I wasn't expecting to be doing an activity for the entire class. In most classes, Professor Heap goes through a powerpoint while the class takes notes. Friday felt like an unexpected yet welcome break from that routine. The folding exercise also gave students a chance to work with one another, which our class hasn't done much of outside of tutorial. My partner was Bill who worked out fine. At some points, there felt like there was a language barrier between us working together. If anything was too complicated to explain in words, we could always write down what we went on paper.

After class, many students stayed behind to ask each other questions about how each of them intended to solve it. Most of the answers we discussed technically worked, but none of us had a firm understanding of how to define a function in Python that would output a sequence of folds based on the number of folds you made. I think I have a way of doing it, but when I try to call my function for any value, I get the message "RuntimeError: maximum recursion depth exceeded." Obviously, something doesn't work. The more I research recursion functions, the trickier they look. My next plan is to see if a loop function might be simpler. So far, this has also been tricky, but I managed to accurately output the fold patterns of one and two folds. For three folds, I got an error list index is out of range. I will return to this problem next week, and hopefully it should be easier.

Thursday, September 18, 2014

Week 1 in CSC165

The first week of CSC165, I learned Professor Heap's approach to problem solving. I'm used to expressing problems (in math classes especially) as lists of inputs given and outputs desired. What I hadn't done before was the solution planning part. Usually when I solve a problem, I immediately dive into without articulating how I'm going to solve it or thinking about alternate solutions. Professor Heap's approach requires you consider multiple plans for divining a solution for a problem. Interestingly, when you describe the solution you're looking for, it's better to keep the answer general. For example, when we were searching for the three ages of a commuter's children, the solution we were looking for wasn't 2,3,4 or 4,3,3. All we wanted was 3 numbers.

Week 2 in CSC165

This week in tutorial, I learned some tricks involving universal statements and venn diagrams.  When we had universal examples like, "All programs pass all tests" or "All programs fail at least 1 test", I used to get confused on the venn diagram. In the first example, "All programs pass all tests",  I would put an 'x' in the "tests" circle. This meant that there couldn't be any members in that circle because that meant that those programs failed a test. What I didn't know was that you also needed to include an 'o' in the intersection to communicate that programs had passed all tests.  For the second example, I had the opposite problem. "All programs fail at least 1 test" could also be expressed as "No programs passes all tests". To indicate this, I put an 'x' in the intersection. This meant that no elements were in the sets, all programs, and programs that passed all tests. What I didn't know was that I needed to put a circle in the "all programs" circle to show that there were elements there that didn't pass all tests.