Friday 26 September 2014

Slog Wars Episode II Attack of the Crease

So today in class we did an exercise involving a piece of paper and evaluating the creases that occur from folding it. We were told to come up with two or so plans before attempting to solve it, but the problem proved to be quite challenging and both methods failed. The difficulty wasn't from finding the number of creases, but the way they arranged themselves. The one given seemed to be that the middle crease was always down, as well as the fact that either side of it was mirrored by the other.

As for the number of creases, we tried to find a set rule for that before realizing its would be much easier to explain using recursion. The following code fragment shows the way the number of creases (returned) compares to the number of folds (x)

public int crease ( int x ) {

    if ( x == 1)
        return 1;
    else
        return 2 * crease (x - 1) + 1;
}

I'm fairly certain this code is correct, but I haven't worked with Java for a while and there may be a mistake or two.  Anyway, this exercise was interesting, and while I didn't manage to completely explain the solution I found it to be good practice in analytical reasoning.

Thursday 18 September 2014

Post number 1, I have no idea what I'm doing


Test post please ignore. Just kidding. This is my first time "blogging" and honestly I'm just doing because it's required. Who knows though, I might even come to enjoy this process. Anyway, I'm Jiawei (Calvin) Wei, first year at University of Toronto. The first week was a bit of a blur since I wasn't really sure what the content would be about. It turns out that it's mostly logic reasoning, something I remember learning in high school JAVA classes. I guess the class is mostly to help us transition into CS content, such as writing if/else structure coding, or the reasoning behind try/catch blocks. I did learn a lot of this before, but never really looked at this subject in depth. I found the class lectures confusing until some basic rules were explained.

1. For universal claim to be true, all cases must be verified.

2. To prove it false, only one counterexample is needed.

3. For an existential claim to be true, only one example is needed.

4. To prove it false, it must be shown that no examples exist.

My main difficulty with this was that it was explained through functions in Python, something we hadn't gone over in 108 at the time. After these rules were explained the examples became much easier. Then were began to cover "if P then Q" relationships. I thought before that I understood such a simple relation. It turns out that it becomes much more complicated when you consider converses and contrapositives. Essentially:

1. "If P then Q" can only be false if P is true and Q is false

2. Reverse of that statement is contrapositive, "Not Q then not P"

3. If Q is true, P isn't necessarily true

Also from the tutorial session, the main thing I learned was that the negation of universal or "all" claims is an existential or "some" statement and vise versa.

So this blog post is mostly an intro with stuff I learned so far, not sure if I did it properly and I know for a fact that the formatting is off but hey, that just leaves room for improvement right?