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. 

Saturday 18 October 2014

A (Short) Week in Review: More proofs and midterm results

This is the fourth "Week in Review."

This week was short due to Thanksgiving on Monday. Thus, there were no tutorials and only two lectures.

Unfortunately, I haven't had time to get my test, but my test score wasn't that great. I did pass, so that's something to be happy about, I guess? However, Professor Heap announced in lecture that the class average was in the low 80's. That's amazing! I thought. My test mark is way below the class average. I messed up the first question really badly when I thought I'd do well on it. I didn't do so well on the last question either. That's okay; I'll do better on the next test. But the feeling of getting a mark that is below the class average makes me feel defeated. I'll approach Prof. Heap on Wednesday during office hours to see where I went wrong and move forward. I might be upset temporarily, but I have to keep in mind that this was the first test and that I should still be happy because I passed.

I'll have to admit that I didn't study hard enough. I had my psychology test the very next day and I was a bit too focused on trying to memorize as much as I could because psychology involves memorization of terms. I did study some of the material, though. I still managed to get an adequate result despite my lack of study.

This week was a continuation of proof writing, all with the same proof structure:

Assume...
(insert "Then" statements here with proper indentation)
Conclude....

We've been looking at proofs for about a week now. More specifically, we've looked at certain kinds of proofs.

Recently, we've learned how to prove using different cases. Sometimes, a statement can have different possibilities. If this is the case, it is best to split the argument into multiple cases. For example, we can consider the cases when a number is odd and a number is even. We can integrate this into our proof after we have made our assumption.

The floor function was introduced. The "floor of x" is the largest integer that is either less than or equal to x. On a graph, it looks like this:



This concept is seen once again in MAT137 on a practice problem set, which is used to help students prepare for Wednesday's test.

Proofs can be time-consuming to write. In CSC165, we use a proof structure that mostly involves the written word, especially Python-style comments on the side (beginning with "#") as seen in CSC108. In MAT137, I start with my rough work and then carry on with the proof, but I also have to use words. For my problem sets, I lose marks if I do not explain my proof in words.

I often comment on the similarity between CSC165 and MAT137 because I have both on the same days and they complement each other very well. Technically, CSC165 is a computer science course, but it's all about math and logic. Using what I've learned in 165 can help me with the material presented in 137, notably the logic component. 

Thursday 9 October 2014

Week in Review #3: my first midterm for university

Yesterday morning, I had my first ever midterm test for university. Before the test, I went over all the concepts we've learned up to Week 4. I made study notes, redid my quizzes, and revisited the assignment sample solutions. I looked at a past test from 2013, which seemed to help a bit. I also went to the Computer Science Help Centre at the Bahen Centre to study with friends and ask a TA questions. I should go there for help as well, seeing that it's an excellent and free resource. However, I'm not gonna lie when I say that I did feel very nervous. I hope that my preparation was sufficient in order to do well on this test. My class was even allowed to bring a study sheet.

As I saw the test, I read over it. Some questions were obvious to me; some, well, not so much. Things like negation, true/false, and sets were involved. It wasn't an easy test. The good part is that I was able to finish the test within the fifty minute time frame without leaving any blanks. The not-so-good part is that I don't know how I feel I did on the test. I don't know if I did well or failed it. I'm a bit worried, but I shouldn't be too, too worried because there's another midterm next month followed by the final exam in December. Professor Heap will weigh the two accordingly; the better of the two will be worth 10% while the other is worth 6%. That's not bad.

On a positive note, I'm glad I got the midterm over with.

Aside from the midterm, I had my weekly Tuesday morning tutorial. We went over proof structures, for which we would be quizzed on at the end of the period. It went well aside from the fact that it started to rain when I got out of the subway.

I seem to have a better understanding of proofs now that we went over them in tutorial and in lecture, where we used the examples on the slides. I will use what I've learned in CSC165 to help me write proofs for my upcoming MAT137 midterm. Those two courses make an excellent combo.



Saturday 4 October 2014

Week in Review #2: Prove it!

We went over the proof outline this week. This outline helps us write good proofs that are clear and organized. I have seen this already in MAT137, but given the similarity between that and CSC165, it came back to me.

First off, a proof is the explanation of why and how a statement is true. To prove something, we have to believe that the statement is true. We start by understanding why it's true. Once we understand why it's true, we then go on to writing it down. However, it does not stop there. Proof writing is not a finite process. Sometimes we may encounter gaps that need to be fixed that require us to start over. The first step, understanding the proof, is where we try and strengthen our weak spots. In MAT137, we call this "scratch work" or "rough work." It is a messy process, but it is necessary that we go through this process to strengthen any given proof. Much like English writing, there is an audience to our proofs: CSC165 students and staff. We have to make sure that our audience can understand our proofs. 

As for style, indentation is required to show scope of assumption. We also begin our sentences with words such as "Assume" and "Then" throughout our proofs. As I learned in MAT137, I could also end a proof with ∎.

This is how a proof would generally look like. We start with "Assume" and end with a concluding statement (starting with "Then" or "Conclude"):

Assume...
      Assume...
      Then...
      .
      .
      .
      Then....
Then...


In addition, I had my third quiz in tutorial on Tuesday. When I went over the exercise with the TA, I had a better understanding of the material. The quiz wasn't so hard either.

I also had my first assignment due yesterday. At first, I did not know how to approach many of the questions. I worked with other people to get help. After many hours, it was finally finished. I felt a sense of accomplishment and relief.

Thursday 25 September 2014

The Week in Review: What is negation?

This week, we began learning more symbols and terminology.

On Monday's lecture, I was stuck on standard negation. It was Monday morning and I was feeling a bit tired. In class, I looked at the corresponding slide and tried to understand the concept, but to no effect whatsoever. My class was told to try and negate the following statement in two minutes:

¬(∀ x ∈ X, ∃ y ∈ Y, P(x) => Q(y))

I was out of it. I thought, I can't do this in two minutes! I need more than that! I copied the statement down in my notebook and tried to think about it. Eventually, time was up. This is the solution:

∃ x ∈ X, ∀ y ∈ Y, P(x) ∧ ¬ Q(y)

I wrote down the solution below the original statement, but I was still stuck. I talked to Professor Heap after class. As he explained, I realized I was overthinking. It was all review on negation. I then felt relieved, knowing that it wasn't as hard as I thought it would be. I regained my confidence.

Negating a statement means to take the opposite of the original statement. The negation (or opposite) of a universal claim (For all...) is an existential claim (There exists...) and vice versa. As well, the only time a statement is false is when the antecedent, P(x), is true, but the consequent, Q(y), is false. In this case, the original statement says that P(x) implies Q(y). However, to negate this, Q(y) has to be false while P(x) remains true in order to make the statement false because that's the only situation when this happens. (For all other cases, the statement is true.) Thus, we would have to put the "¬" symbol in front of Q(y). 

The next morning, I had my second tutorial. Our exercise involved writing English statements using logical symbols as well as determining true and false statements with explanations. The concept of math logic was still quite new to me, but I did make sure to ask my TA questions on things I found difficult. Once again, I hope I did well on my quiz, given that it was similar to the first question on the exercise. I did try my best.

I do find the idea of switching statements between math and English quite fascinating. It's something I have never seen before. Initially, I was lost when it came to this idea, but after getting proper help from Professor Heap and the TA over the weeks, I seem to be enjoying it now. 

Friday 19 September 2014

So it begins...

Hello and welcome to my CSC165 SLOG! This is where I post weekly updates on what's happening in class, including what I've learned so far and how the course is going.

Last week was the first week of classes, so all the topics on logic that I've learned are meant to introduce people to the course. I found out that this course does, indeed, involve considerable amounts of math, as the course is called, "Mathematical Expression and Reasoning for Computer Science." Computer science definitely needs math. However, I learned that this course is also about communication; in the computer science world, communication is done through creating programs and documentation, cooperating with others, and much analysis of programs and arguments.

Mathematical concepts were being introduced to the course day after day. On the second day of CSC165, I came across a familiar concept: building sets. I thought to myself, Hey! I learned this in MAT137! MAT137 is a full year calculus course. However, this was taken a step further and applied to the Python environment.

A set is given. For example, there exists the following set: S = {1, 2, 3, 4, 5, 6}. In Python, to check whether a statement is true, I would have to replace math symbols with with words, like so: {x for x in S if x > 2}. Python would then return the x values for which the statement is true; in this case, the values 3, 4, 5, and 6 would appear. The word "and" that is seen in math is replaced with "if." Similarly, "for" replaces the vertical line, and "in" replaces the element symbol. Using what I knew from MAT137, I was comfortable with the material.

This week, I had my very first tutorial at the Bahen Centre, and it was bright and early in the morning. My TA was taking up the exercise on universal and existential claims pertaining to sets that would prepare us for a quiz later on in the period. I understood the first question, but the second question involved Venn diagrams. I didn't understand it fully. I sat there with a confused look on my face. I felt frustrated, so I repeatedly said to myself, Don't give up. I couldn't grasp the material, but I knew that the best solution was to ask questions, not to be upset about it. I asked my TA to explain concepts that I found difficult. She explained everything thoroughly. She is a nice person. With that, I felt confident again. I smiled.

Once my TA passed the quiz around, I looked at it. There was only one question, but with two parts. I made sure to read carefully. I felt confident that I knew the answer to both parts as I reread everything to make sure I didn't miss anything. For the most part, though, I feel like I did pretty well. I left the Bahen Centre triumphant. My TA helped me deepen my understanding on the day's topic.

On Wednesday's lecture, I didn't quite understand some of the topics that were presented: implication and numerical examples of negation and contrapositives. I was lost. I didn't feel confident yet. I knew that Professor Heap held office hours every Wednesday afternoon, so I decided to go visit him in his office at the Bahen Centre after my 137 class to go over these concepts. He explained everything thoroughly. I found it very helpful, and I was able to have a clearer understanding of the concepts I found difficult. I felt better afterwards and thanked him.

I am very much looking forward to learning more concepts in this course.