Sunday, November 30, 2014

Fun With Folding - Math Problem

Earlier in the semester we were told to work through a problem called “Folding”. 

Understand The Problem
We were required to take a piece of paper and fold it in half from left to right. Then, we had to unfold the paper and see how many creases there were and what direction they were facing (either up or down). This process was repeated multiple times. 

Devise a Plan / Carry Out The Plan
While working on this with my partner, we decided to repeat the process five times and came up with the following information. A downward crease is represented by a “D” and an upward crease with a “U”

1.    D
2.    UDD
3.    UUDDUDD
4.    UUDUUDDDUUDDUDD
5.    UUDUUDDUUUDDUDDDUUDUUDDDUUDDUDD

After coming up with the result for the first five folds, we tried to identify a pattern. This did not take us very long as we quickly realized that the sequence prior to the current one appears at the end of the current sequence which can be easily noticed through the five sequences given above.

This was when Prof. Heap gave us permission to look at the hints. The first one said to think recursively which we did by noticing the previous pattern appears in the current one. However, the second pattern said to think symmetrically which took a little while. My partner made a key observation by noticing that half of the pattern occurs twice in some way. This took me a while to catch however my partner quickly understood this and decided to code up a solution to the problem.

Essentially, what we figured was that the previous pattern goes directly to the end of the current one, and the first part of this pattern is the opposite of the previous + ‘D’ but flipped. My partner made a program that emulated this and helped explain to me the small pieces I did not understand. There was a flip method that replaces the “D” with a “U” and vice versa. After flipping it, he also reversed the string. After this, he added a “D” which was the middle character of every pattern and then he added the previous pattern to the end. After finishing the program, we tested it and the result for the first five patterns were the same as what we had written down at the beginning so it seemed to be working. We tested it on a few more to confirm that our logic was right and it seemed that we finished the problem.

Look Back 
I found this very interesting how we started off by understanding the problem we had and then simply by devising a plan (to test the first few patterns) we were able to grasp this pattern and arrive at a solution. The program my partner came up with was also very interesting as it caught me by surprise not having extensive programming knowledge. 

Saturday, November 29, 2014

Week 12

Conclusion
We are now done with the lecture material in this course and only A3 and the final exam remain. Looking back at the course, I really did learn a lot starting from the first week where I came in not knowing anything since the material was never taught to me before. I found this course very interesting and the tests, assignments to be challenging and rewarding too. I'm hoping to continue with computer science and looking forward to more logic courses in future years.

Thursday, November 20, 2014

Week 11

Assignment 3

Having a day off on Monday meant that there was only 2 hours of lectures this week and also no tutorial. So far, in Wednesday's lectures we went over halting problems and uncomputable functions. There was not much in Wednesday's lecture however it was a little confusing and I will need to go over it to completely understand it. The final assignment was also posted and after looking over it, I don't think like the assignment is as difficult as the previous one however it will also take some time to ensure we get the proofs right. My partner and I decided to start on the assignment early and try to get as much of it done as quickly as we can to avoid any problems or misunderstandings closer to the due date.

Thursday, November 13, 2014

Week 10

Test

Having received the test back today, I am extremely delighted with the mark I received. Initially I thought I would lose around four or five marks because I had to rush at the end of the test however it turns out I only lost one mark overall. This is amazing because I have received 97% on both my tests and a high mark on my first assignment too. Now hopefully I can do well on the second and third assignment and take that momentum into the final exam. I also feel like I am understanding everything in the lectures on the topic of Big-Oh and Big-Omega which is going to be crucial in the exam and third assignment. 

Thursday, November 6, 2014

Week 9

Test

Well now the test is over with and out of the way. Now we just have one assignment and the final exam (along with 2 tutorial quizzes) left in the course. However, going back to the test, it was not very difficult and I had sufficient amount of time to complete it. The first question was very straightforward and I was able to complete that within 5 minutes however the next two questions required me to think for a few minutes before I got anywhere. For the second question, I noticed that I can negate the statement and make it into an implication and from that implication, I can easily prove the statement. For the last question, it was very similar to a question on the assignment and I looked over the sample solutions to the assignment so I believe I got the correct proof for that question as well. Unlike last test, the aid sheet I made for this test was very helpful because for one of the questions, it helped me solve a small mistake I encountered during the test and for another question, it helped me structure the proof into cases. Now, all that's left is to see how I did and prepare for the next assignment and exam.