Tuesday 19 February 2013

Quotes and the science of computers - misconceptions

So 236 is done, but I don't want this blog to be too! I'm still a computer scientist, therefore I'll keep writing about my life in here. Also, 263 is just the advanced level of 236, so there's still much to talk about that's related to how this blog started.

This post isn't much about 263 as much as computer science in general. There's a misconception around that computer science is about learning how to deal with computers...if you think so, you definitely haven't had quality computer science courses, or maybe just didn't notice, recognize why computer science isn't about computers. It's the logic, the problem solving, the creating a plan and adjusting it till it becomes the best plan for your own personal purpose. An algorithm is like a piece of art. It's a window to our brain, how it approaches things. A programmer's program (despite which language it's written in, in fact it doesn't even need to be written in a language where a compiler has been made, after all, languages are just a way of getting a computer to understand what we mean, it can be written with any type of pseudo-code) is a way of expression, in a way. You're free to express whatever's in your mind in whatever way you want. It doesn't have to follow a certain norm or even serve a specific function, it just satisfies what your brain, what you want it to.

This little paragraph came to mind after getting some inspiration from some quotes, which I will share here, and you never know, maybe they'll inspire somebody reading this someday...someway ....

(Those quotes are all related to computer science or even learning in general, some more specifically targeted at programming styles, others at the science & logic itself, but most of them deal with a sweet combination of the two :D)

"They know enough those who know how to learn" - J.Adams

"If you're not failing every now and again, it's a sign you're not doing anything very innovative." - W. Allen

"All programmers are playwrights and all computers are lousy actors." - Anon.

"if you understand what you're doing, you're not learning anything" - Anon.

"The person who knows HOW will always have a job. The person who knows WHY will always be his/her boss." - Anon. 

"Weeks of programming can save you hours of planning." -Anon

"Tell me and I forget. Show me and I remember. Involve me and I understand." -Anon.

"The important thing in science is not so much to obtain new facts as to discover new ways of think about them." - W. Bragg



Wednesday 5 December 2012

Problem-solving episode

The problem I decided to look at for this post is the following:

https://wwwcgi.cdf.toronto.edu/~heap/cgi-bin/Solvent/wiki.pl?Problem_Solving_Home_Page/TryThisProblem

Note: I avoided looking at any solutions proposed for this problem, in order to fully show my problem-solving thought process, which I don't want entailing " Looked at a solution which worked and made me realize what I should be doing :P"

Following Polya's approach to how to solve problems (explained in this link), I will be divided this post into 4 parts, each part highlighting a step in my problem solving process and what that entitled for the above particular problem.

Problem:
Suppose n stands for some positive whole number. Define a function f(n) that associates n with another positive whole number, as follows:
If n is even, then f(n) is n/2
If n is odd, then f(n) is 3n+1
Since f(n) takes any positive whole number as input, and produces a positive whole number as output, it makes sense to talk about f(f(n)) or f(f(f(n))) --- composing f with itself several times. Let's define F(m,n) as f(f(...f(n)...), where f is composed with itself m times. Is the following statement true or false?

For each natural number n there exists a natural number m such that F(m,n) = 1.

Note: I avoided choosing a problem that we might've been given in class/in an assignment or in a tutorial. That is because I felt like solving a problem from scratch, and had I done a problem from any of the previously mentioned pools of problems, I would already kind of have an idea of the type of thing I'm supposed to do and where to start, depending on the time that problem was presented and what we were doing in lecture at the time.

STEP 1: Understanding the problem:
Personally, this step entitled defining two piece-wise functions, F(m,n) and F(n), and re-writing  the statement I'm trying to prove in a different way to ensure that I fully understand the statement.

Piece-wise functions:
F(n) = {n/2            if n is even
             { 3n+1       if n is odd

F(m,n) = {F(n)                       m=0
                  {F(m-1, F(n))       m > 0

Statement
for any natural number, if we compose f(n) of itself enough times (m times), we get 1 out of applying F(m,n).

STEP 2: Devising a plan:
For this part of my problem-solving process, I found myself thinking of different approaches to solving the given problem. Thoughts included complete induction and mathematical induction. In order to decide which flavour of induction to use, I decided to set my definitions hoping that would give me a hint as to the type of induction I should use.

Definitions:
The definitions of the functions were given above.
(Side note: since n is said to be a positive number, my predicate will be dealing with a positive n, not any natural number (i.e. not zero))
Let P(n) be the predicate such that:
P(n) : For all positive natural numbers n, there exists a natural number m such that F(m,n) = 1.

While writing the above definition out, I could partially see how to approach the problem through complete induction, so i decided to follow through and see if complete induction works.
I would have to have a base case of n=1. Propose m=0 and show P(n).
For the induction step, I would assume P(i) for all natural numbers greater than 0 and less than n (0<i<n), and look at 2 cases; 1. If n is an even number, then I would use the induction hypothesis to state that there's a natural number m, such that P(n/2) holds and show that by adding 1 to the previous m, we get P(n)
and here is where the problem arises 2. If n is an odd number, then F(m,n) = F(m-1,3n+1), since 3n+1 is greater than n, I can't use the induction hypothesis in any way.
I then tried looking at what P(n) would look like,F(m,n) =  F(m-1,3n+1) = F(m-1, 3(2k+1) + 1) for some natural number k (since n is odd) = F(m-1, 2(3k+1))
= F(m-2, 3k+1) = F(m-2, n+k). since n+k is still bigger than n, I can't use the induction hypothesis anywhere here either. I then tried dividing case 2 into 2 more cases, if k is even (n+k odd) and if k is odd (n+k even), but that only seemed to make the problem bigger.
I then went on to think of how the problem would look like had I used mathematical induction, but that approach didn't get me much further.
After the extensive amount of proof trials, I re-read the problem and thought, maybe the statement is false, and a counterexample is what I need.
I then looked at the number 9 and saw a contradiction.

STEP 3: Carry out plan:
Let n = 9. Assume m is a natural finite number.
Then F(m,9) = F(m-1, F(9))
                         = F(m-1, 3(9)+1)
                         = F(m-1, 28)
                         = F(m-2, 14)
                         = F(m-3, 7)
                          = F(m-4, 22)
                          = F(m-5, 11)
                           = F(m-6, 34)
                           = F(m-7,18)
                          = F(m-8, 9)
# contradiction, since there's a loop when setting n to be 9, m would be an infinite number. Therefore there won't be an m such that F(m, 9) = 1. Therefore the statement is false.

STEP 4: Look back:
From solving this particular problem, I learned to read questions more carefully. If the question isn't asking me to see if the statement's true or false before proving it, I should definitely start by trying many examples and trying to find a counterexample, before attempting to prove the statement.

In addition, through trying to solve the problem, I realized that the statement would be true if n was a power of 2, since that way, we would never need to look at n being odd, therefore never have to use F(n) = 3n+1

ENTERTAINMENT:
I know this section only showed up once or a couple of times before, but here it is again :)

This is something I thought was super cool in google:
if you search recursion in google, you'll see one of google's coolest hidden easter eggs. Look at it! It might take a couple of seconds to notice what it is, it sure did for me. Ok fine I'll tell you. Typing recursion in google gets you to a page that says "Did you mean recursion" which if pressed over and over again takes you to an infinite recursive loop! :D

For 17 other cool google easter eggs, check out this website:
http://www.searchenginepeople.com/blog/ongoing-list-google-search-easter-eggs.html

Tuesday 4 December 2012

Exam-Studying attack plan!

This is a post I hope will be shorter than the previous one. The following are a list of what my plan is for studying for this exam, my "tips", if you will, for how to go about attacking all the materials and making sure everything's well understood.

* Look at the empty lecture notes for each week, starting at the first one and going from there, solve each question given as an example in the lecture notes. After finishing each week's lecture notes, look at the annotated notes and the course notes that correspond to check your solution. If the solution was wrong, attempt it later on after finishing a couple of other weeks' materials/taking some rest.

* After finishing all the lecture notes given. Look at empty tutorial slides, do the same thing in solving the problems, on paper, then checking them against the solution.

*Look at the tests briefly afterwards, see where you might've gone wrong! Compare solutions to corresponding course notes to see the right way of answering each one of the questions you answered wrong. Also, briefly look at the questions you answered right just to make sure you still fully understand them.

* Do the same thing done with tutorial handouts, but with assignments this time. Compare the solution you get from answering the question now, to the one in the assignment solution, to the one in your own solution. Look carefully at the differences, to get an idea of possibly different ways of handling questions.

**Get a good night sleep the night before the exam :D

Hope this helps anybody unsure of where to start :D

Good luck :)

An overall review of the experience :)

Well hey there slog, it's been a while....

Starting off this course, I thought keeping a diary-like blog of my experience in the course and how I handled difficulties would be an easy part of it. I still think it would've been, but there's something about an on-going assignment that's due at the very end of the course that gets you, or me at least, to put it at the back of my head, and maybe sometime, when busy with all the other assignments and tests, even get to the point of forgetting about it, which is too bad considering how cool and exciting I thought this assignment is. In any way, I'm here now and nothing's preventing me from going over the entire course's experience and what I did throughout to keep up with the material right now. So here it goes.

The following will be divided into an overall review of the course, and then a more detailed review of each and every evaluating method, including the difficulties I might've had and how they were handled, in addition to the preparation that happened before the particular quiz/test/assignment-typing.

THE COURSE was definitely a great learning experience. The materials were presented clearly in a very logical progression throughout and a big component of the lecture-time was dedicated to discussions and answering any questions anybody had, no matter how small or trivial they were, in great detail which was absolutely amazing.  In addition, the evaluation methods were well-spaced out. I really liked how we had a chance to review material every week in tutorial, with a relatively simple quiz at the end to make sure we understood the tutorial, and to encourage us to pay full attention in tutorials. The assignments were just as well-paced and they took what we learn an extra step to challenge us. Tests then became the sweet middle.

THE QUIZZES were the evaluation methods I rarely got over 50% on, mostly cause they're marked on the scale of either 0/2, 1/2 or the perfect 2/2. Most marks lost for me personally weren't due to lack of knowledge as much as missing small details here and there. They were a good way of knowing where I might be giving too little information or making a logical mistake in proving a certain thing. I'd usually prepare for quizzes on my way to them or the night before. I looked at the questions and tried answering them, then went on to see the TA's answer and compare mine to that of the TAs to see the differences. It was a great way of staying on track.

THE TESTS weren't difficult at all compared to what we've seen in class. Unfortunately though, test 2 was at a bad time for me since I had countless other assignments/tests and things I had to take care off quickly at the time. Therefore my answers didn't reflect my understanding of the material due to the amount of stress I was under. Even though that was the case, after getting my test back, I made sure that I understood exactly where I went wrong in my thought process/problem solving technique to avoid it in the future, which I think was what was important to move on and do better afterwards.

THE ASSIGNMENTS were at just the right difficulty, in my opinion, for us to be able to solve them not immediately but after a bit of thought and a bit of staring at the assignment trying to figure out exactly what each question is asking. My process for attacking assignments went as follows. Read the questions and attempt them. Look at the course notes, the annotated lecture notes and tutorial solutions for similar concepts and how they were approached. Sleep. Look at the problems again. Have an idea of how the solution's going to be like. Go to Prof. Heap's office hours to see what people are struggling with and confirm my idea of the right solution. Type up the solutions. The only problem I was facing was that I'd know what the solution would be like very well, but I'd actually write it down on paper/type it later than the ideal time to. This usually caused my solutions to have less details in them than I would like. To try and avoid that problem, I tried writing, in great detail, the solutions I had in my mind on paper to try and express everything I mean to and leave the typing up the formal solution to the problems till near the end. I feel that this approach improved my final solution to the assignments a lot.

If you're reading this, it means that you've either skipped over the LONG post, which I don't blame you for, it's long!! Or you've read through the entire post, which I really appreciate and thank you for taking the time. :)

PS. If you want a great writing a blog entry experience, the UC quad on a day with great weather, like today, is a fantastic choice! :D
PPS. sorry for the super long post and I hope the caps give the readers an idea of what each paragraph is talking about in order to maybe choose what to read about.

Thursday 1 November 2012

Dear Diary

This post I had written on Oct. 30th 2012, but for some reason never published, so here it is :

Dear Diary,

I wish I had more time. I also feel very "adult-y" saying that, since for the longest time, I wondered why some people say there's never any time. I seemed to have time....I seemed to have some extra time! Had I known how much more precious time's gonna get, I probably would've spent it differently? Who knows. Anyways enough wasting time talking about it. (one last note that I find interesting, some might argue, time's the one and only fair thing in our world, as in, nobody has an advantage....nobody has "more time").

In anyway, that whole rant came to mind when I was thinking about how much I'd enjoy spending more time on the Slog, making it clearer, more interesting. There are a lot of ideas in my head. I hope that I'll get to implement some of them soon (before the end of the term)...can't believe I'm already at the point of mentioning the end of the term!!

Back to some CSC talk, I got my A1 mark with (little) feedback back. A couple of notes; Feedback was, unfortunately, not as helpful as I would've wanted it to be. A simple "clarity" and a 3/4 doesn't give me a way as to how to improve. Another thing is, for the one feedback comment I got, I had asked Dr. Heap about being able to write it the way I did, and he said it was fine. So I have to go on an adventure investigating where I went wrong, and what I misunderstood, since I'm aiming for that beautiful number, 100, and I believe that I can get it!

Tuesday 30 October 2012

A short Android-y post

I'm such a big android fan && most of the time, I'm on my tablet. So today I thought, maybe there's an app out there that makes blogging a bit easier/faster (why did I not think of this 2 months ago still baffles me). When that thought finally made its way into my head, I rushed over to the app store, and lo and behold, there it was....Blogger! (Link below). So now, blogging just got a lot easier and my excitement level to write posts increased!

Hope this helps all y'all who didn't get this thought just yet! :)

Link: https://play.google.com/store/apps/details?id=com.google.android.apps.blogger&hl=en

Dear future me..

Oh hey there SLOG,

It's been a while! BUT the positive part of that is that there's a lot to talk about from assignment one to the quizzes and of course, the test. Many lessons learned along the way as well. Also, before getting into the details of the above mentioned things, I'd like to mention that I'm gonna start posting a link at the end of each SLOG entry to make the entry a bit more interesting! The links will either be informative, entertaining or a good mixture of the two.

I think it's safe to say that I've gotten to the point in the term where I'm starting to get tired, so I really need to start picking it up and going back to reviewing all my lectures everyday! Aside from that though, let's talk about the 236 experience:

A1 Lessons (for future me and anybody reading this): - Do NOT leave typing the proof till the day before/last day. Typing it up will take more time than expected!
- Do NOT over think things, if you are, take a look back (i.e. if you're stuck in a certain mind set, look back at your work, maybe take a good night sleep before continuing even)
Things I should keep doing : I started thinking about this assignment and the logic behind each question quite early, so I ended up spending little time on it every day and I had a good logical progression of solving each question and getting to the answer. (Dr. Heap was a lot of help when I got stuck as well :D)

Test:  Lesson: When studying for the test, make sure to actually sit down and write proofs. You may read something and think you can reproduce a similar proof, but that can't be guaranteed unless you actually sit down and write another proof.
Things I should keep doing: I reviewed the material that was on the test day by day, which decreased the time required for studying for it a whole lot and made studying for it a lot easier since I knew the material relatively well by that point.

Quizzes: Lesson: Details matter!!! So don't dismiss things too quickly and make sure each step is very logical and clear, otherwise you'll be stuck with that 1/2.
Things I should keep doing: I've been reading the tutorial notes the morning of the tutorials and quickly thinking of how I would go about solving the problems. This way, the solutions aren't as novel and I don't need as much time to understand them in the tutorial, since I've thought about them before && if the solution I thought of was wrong, even better since I'd be more intrigued as to where I went wrong and how to fix it for the future!! :)

Link :
http://recursivejokes.tumblr.com

The joke I liked in that tumblr is:
A recursive light bulb joke
Q: How many twists does it take to screw in a light bulb?
A: Is it already screwed in? Then zero. If not, then twist it once, ask me again, and add 1 to my answer.

PS. I wrote this post sometime ago (15.10.2012) just forgot to publish it, so expect another post SUPER soon regarding the new assignment, the marking of assignment one the new material in class && more! :) (MUCH to talk about! :))