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. 

No comments:

Post a Comment