Monday 1 December 2014

My final post

This is my last SLOG post. I must say, this semester went by so fast. (I might be a bit early on this because classes end tomorrow.) 

Today marked the end of Professor Heap's CSC165 lectures. I must say, I've definitely learned a lot about math and logic. I was able to look at math from a different perspective. At first, I did not know what was going on, but going to office hours and asking the TA for help in tutorial made the material easier for me to understand. I'd like to thank Professor Heap and my TA for supporting me and explaining difficult concepts. This course was enjoyable, insightful, and full of logic.

I finished my final assignment for the course not too long ago. Now, all that's left is the exam. I would like to wish everyone good luck next Wednesday!

"That's all, folks!" - Porky Pig


I now leave you with this song to celebrate getting this far. That includes completing assignments, tests, and quizzes.


Saturday 29 November 2014

Week in Review #9: The last few updates

Week 12 has just been completed. We are now down to our last assignment of the year. Due to the CDF outage that occurred recently, Professor Heap changed the A3 deadline from Nov. 28 (yesterday) to Monday, Dec. 1. (Like any other year, 2014 is going by so quickly. Oh, and let's say thank you to Prof. Heap for being so kind to us.)

I am not very pleased with my mark for Assignment 2. The class average was 75% this time. That's still awesome. I could have done way, way better despite Prof. Heap changing the deadline for it once again. I lost many (precious!) marks for proving a false claim and misunderstanding the definition of floor. I fell into the "0" trap numerous times. (Grr.) The comments on MarkUs and sample solutions can help me do better next time (and in our case, next assignment). I did really well with proving the last two claims, though!

Overall, I passed A2. Phew! *breathes a sigh of relief*

Hitting an all time low in CSC165 enabled me to identify some weak spots. For example, I really, really, really, REALLY need to practice floor proofs and understand the definition of floor because they aren't coming to me easily. I have to keep reminding myself that CSC165 is not an easy course and I should devote a bit more time on assignments and grasping new material. I'm taking five courses this semester so it's not easy but it's doable. From the looks of things, though, I believe I can get a good mark (60% or more) in CSC165 and go on to do a major in computer science. (I'm still not sure if I want to double major in CS and math or do a double minor in two fields.)

My goals for the week are to complete my final assignment with my group and begin studying for the exam. I will keep in touch with my group members regarding the assignment. Once again, my CSC165 and psychology exams are back-to-back, but the good part is that I began studying for my psychology exam Thursday night. It's best to start studying early. I'll begin studying for the CSC165 exam by reading over my past SLOG posts, doing the assignment and going over the course notes, and I'll use my aid sheets for tests 1 and 2 as study notes. I'll make more notes for Big-O and other things.

We looked at different types of functions this week as well as induction. I'd say that this week's lectures combined material from both MAT137 and CSC108. (Yay for complementary courses!) In addition, we examined induction, another MAT137 concept.

When looking at functions in Python, we can write our code like this:

def f(n):
   if n == 0: return 2
   if n == 1: return 3
   if n == 2: return 4

and so forth. Alternatively, we can write:

def f(n):
    return n + 2

However, induction in this course is different. To prove by induction, we do the induction step (including the induction hypothesis) first and then do the base case. In MAT137, we would do the reverse. Once again, we would follow the same proof structure that we are familiar with in CSC165.

I've been looking at other people's SLOGs to see what others are posting about and to also get some ideas for mine. Before I forget, here's one that I found interesting: http://andrewgoupilcsc165.blogspot.ca/. Andrew's SLOG shows tremendous progress in CSC165. He discusses concepts he finds difficult and self-regulates. He also uses Python to tackle problem solving, and I enjoy the use of humour in his posts.

Sunday 23 November 2014

Week in Review #8: Nearing the end of CSC165 :(

This week (Week 11) was extremely short due to having Monday and Tuesday off for Fall Break. There were no tutorials, so no quiz (and no having to wake up at 7:30 on Tuesday!).

CSC165 is drawing to a close pretty soon. We're reaching the last full week of this course. What I've noticed recently is that CSC165 is starting to look more like CSC108 than MAT137 at this point.

That also means we're focusing on the computer science aspect of the course.

Professor Heap stated in his slide that a lot of people develop an interest in computers due to the notion of solving problems systematically. To fulfill this notion of ours, we create programs that are built around algorithms. Algorithms. That's so CSC108! I think to myself. I've heard that word one too many times. In CSC108, we've worked on a lot of algorithms to help us design programs using Python.

We've looked at examples of algorithms in Python. Here's an example that looks to see if a function will halt or not:

def may_halt(s):
    if len(s) % 2 == 0:
       while True: pass # could also use return len(s)
    else:
       print s + " has odd length." In Python 3, we would use                                             # print(s + "has odd length.") 

I believe this was done using Python 2, as there are no brackets surrounding the call on print. The programming styles for both version differ in certain ways.

This function can be evaluated without actually running it in a program such as WingIDE. We only have an if statement that looks at two cases: if the length of variable s is odd, the function will halt, otherwise we will receive a statement saying that the function has odd length. In other words, the function will not halt if s has an odd length. 

A function is non-computable when a function,  f(x), cannot be computed, but it is well-defined. The halt function is non-computable because it satisfies this definition.

I'm going to keep practicing the new concepts because practice makes perfect. 

Sunday 16 November 2014

Week in Review #7: Test #2 results and other things

We have just finished Week 10 off with getting our tests back and doing more Big-O examples, which led up to Big-Ω. (I can't believe we finished our tenth week in CSC165 in the blink of an eye.)

I was very happy with my second test. It was better than the first one. The result from the previous test definitely gave me that boost! Although I messed up on the floor proof, the other two proofs were well done. I had trouble remembering how that proof worked; I've looked at the solutions to the second assignment the previous night, but my answer didn't seem to match up. That's okay. I'll practice proofs involving the definition of floor in time for the exam. This test's duration matched with the previous test's duration, which was 50 minutes. It would be nice if I had a bit more time, perhaps to look over my answers and fix any mistakes before submission, but I was capable of answering all questions in 50 minutes in some way.

I'm feeling very comfortable with proof structures. I'm confident with the outer parts of the proof, but the inner part needs a bit of work because the statements are different. For now, though, I'll keep reading the course notes, making annotations, and going to office hours.

November is a pretty hectic month for us with midterms, assignments and all. At the same time, the material presented in CSC165 is piling up. I must admit, Big-O is a complex concept. I'll let it take time to sink in. CSC165 is a difficult course, so to ensure success, I visit Professor Heap during his office hours on Wednesdays. I also make use of the Computer Science Help Centre to study for tests and work on assignments.

As I mentioned before, I understand the proof structure and the definition of Big-O very well. Proving it requires more practice because it all depends on which statements we get. For instance, Big-O can be done with two functions and polynomials. The proof structures are similar. But to enhance our proof, it's crucial that we begin with scratch work before going on to write the proof.

I think I'll be okay with Big-O and Big-Ω pretty soon. It's new material. Once I get the hang of it, I'll be fine before I write the final exam in a couple weeks' time.

I'll also begin practicing sorting algorithms using the approaches seen in both CSC165 and CSC108.

Saturday 8 November 2014

Week in Review #6 (!): More with Big-O and completion of assignment and test #2

Has it really been two months since we started CSC165? Time whizzes by in the blink of an eye!

The next instalment in my "Week in Review" series is based on Big-O, which we looked at in weeks 8 and 9, as well as the recent assignment and test.

I had my second test on Wednesday. It was quick and straightforward, consisting of three proofs, just like the practice test. The last proof was on the definition of a floor function, or "the floor of x":


I thought, Wasn't this on the assignment? I could do this! The test was a lot easier than I thought and definitely easier than the first one. The testing effect does help a whole lot.

I've been more prepared for this test than the first test, and I think that this test was a success! Getting a low mark on the first test really motivated me to do better this time around! 

Part of my test preparation involved Assignment #2, due two days before the test. It took a while to finish, but I'm hoping I did well on that too. I managed to get some help from friends and a TA at the CS Help Centre. 

This week, we began proving the Big-O of polynomials. We've been practicing a lot of proofs, and so proving them wasn't too difficult. We started by writing a proof structure followed by writing up the actual proof.

Last week was introduction to Big-O. We started off by proving the Big-O of n², which is extremely long and mentally exhausting. I was quite relieved when we were introduced to proving the Big-O of polynomials because they aren't as long and complicated.

The definition of Big-O is as follows:

(for any function, f, that inputs natural numbers and releases non-negative real numbers)

The statement that needs to be proven is:


We start off by picking a positive real number, c, and a natural number, b, that will work. Then we assume that n is a generic natural number in order to introduce ∀. We assume the antecedent, n ≥ B. I'll put it all together using a proof structure:

Let c' = ____ and B' = _______.
Then c' ∈ R⁺and B' ∈ N.
Assume n ∈ N. # in order to introduce ∀
       Assume n ≥ B'. # antecedent; B is an arbitrary natural number
            .
            .
            .
Then ∀ n ∈ N, n ≥ B ⇒ g(n) ≤ cf(n) # introduce ∀ and ⇒
Then ∃ c ∈ R⁺, ∃ B ∈ N∀ n ∈ N, n ≥ B ⇒ g(n) ≤ cf(n) # introduce ∃ for b and c

Big-O of n², worst case, and the upper and lower bounds are still a bit unclear to me, so I'll go to office hours when I can, read the course notes, and practice a lot. I get the proof structure, but the actual proof is complicated and doesn't come to me just as easily. 

Saturday 1 November 2014

Week in Review #5: Assignment + test = added stress

We have just finished Week 8. (Time flies.) I have my second assignment due on Monday night, and my second midterm on Wednesday morning.

Since doing poorly on the first test (my first ever test for university), I have decided to change my approach to studying. However, I will continue to make a study sheet, go over tutorial exercises and quizzes, and do the practice test within the 50 minute time frame. I learned from one of my readings in psychology that one of the best ways to do well on a test is to do a practice test according to research; this is known as the testing effect. What I've changed is that I'm starting to use Prof. Heap's slides more wisely. He has encouraged us to make our own annotations in whichever ways we want. I find that writing notes in my notebook isn't as effective as having the slides in front of me, either electronically or on paper. If everything can be seen in front of me, then there's no point spending time writing copious notes. Having the slides printed out or opened on a program such as Adobe Reader saves time; I could highlight things and write down what I think is important to master a certain concept.

I also have the course notes to look at. I can use them to look at concepts in more detail. I'm hoping I can study with friends, too. I have high hopes that the upcoming test will be a success. (I try to be optimistic; I always aim to move forward.) I just need to be careful not to make any silly mistakes.

In addition, Assignment #2 is a bit shorter than Assignment #1, which took us hours to finish. I hope this assignment will be better than the last one, and I can also use this as a study tool for Wednesday. As the weeks progressed, so did my understanding of proofs. I seem to understand the proof structure and scope of indentation. Now, it's simply a matter of practice; I feel I did not practice well enough for the first test. I need to fix up my time management skills.

This week, we began Big-O and Big-Ω. The proofs for both were time-consuming. The big-O of n² means that there is a set of functions with the input being natural numbers and output being positive, real numbers. We also began sorting algorithms. We took a look at a couple examples using Python. They looked very familiar to me because I'm currently taking CSC108.

I would like to wish everyone the best of luck on the assignment and test!

Sunday 26 October 2014

Problem Solving: Penny Piles

Unlike my recent posts, the title of this post will not start with "Week in Review." (I couldn't think of any better titles for my weekly posts.) I'll be writing about a problem solving exercise that our class did yesterday, called "Penny Piles."

The four steps to problem solving by Polya are:
  1. Understand the Problem
  2. Devise a Plan
  3. Carry Out the Plan
  4. Look Back
Using this approach, I'll explain how to solve this problem.
  1. There are two drawers. One of the drawers is filled with 64 pennies, while the other one is empty. The question here is: Can things be arranged so that one of the two drawers has 48 pennies? This is where two operations are introduced: l and r.
    • l: If the left drawer has an even number of pennies, half of that amount can be transferred to the right drawer. This operation will not work if the number of pennies on the left drawer is odd.
    • r: If the right drawer has an even number of pennies, half of them can be transferred to the left. Once again, this will not work for odd amounts.
  2. The plan is to consider the range [0, 64]. The goal is to arrange the pennies so that one of the two drawers has 48 pennies as well as another number within the range using the operations l and r from the previous step. To achieve this goal, a number of different possibilities can be mapped out in various ways.
  3. At the start, the left drawer has 64 and the right drawer has 0. To execute the plan, half of the pennies in the left (32) can be transferred to the right using operator l. Now it's even. Both drawers have 32 pennies each. But one of the drawers must contain 48 pennies as per our problem. Operators l or r can be used in this case because 32 is an even number and the pennies are divided evenly. For example, if we transfer half of the pennies in the left drawer to the right, the result is 16 pennies in the left and 48 in the right. Therefore, it is possible for one of the drawers to have 48 pennies using arrangements, but the sequences are endless. Here is an example sequence using the l operator: 
    • Start (left, right): 64, 0
    • 32, 32
    • 16, 48
    • 8, 56
    • 4, 60
    • 2, 62
    • Finish: 1, 63
  4. To check the result, a tree diagram can be drawn, listing all the possibilities. Another way (similar to my approach) is to create an output sequence using only operators l, r, or a combination of both. Using an equation to derive the solution may also come in handy; for example, x + y = 64, where x and y represent pennies in the left and right drawers adding up to 64, respectively. To conclude, any number in the range [0, 64] can be achieved.