Thursday, March 29, 2012

Some updates...

So I wasn't super productive in the last couple of days, but I did manage to watch some lectures and do a little work.

I did a bit of re-thinking of my schedule. During some of my GRE study where I encountered some combinatorics and statistics, I decided that perhaps taking some classes that addressed this would be a good use of time, so I entered a bit earlier than I thought into the Discrete Math course from ArsDigita that I was planning to take. How much I treat these as equal to my other classes remains to be seen, but at the very least it looks like a fascinating course, with a wide range of subjects covered.

I also briefly thought that perhaps I wasn't taking the right class to satisfy my Data Structures requirement, and I considered switching from the Stanford CS106B course I'm in now to the Berkeley 61B course, which has the benefit of being specifically titled "Data Structures." But after looking at the syllabus and seeing a fair amount of overlap with 106B, I decided to stick with that one. Besides the fact that I'm already a few lectures into 106B, it has a few benefits as well. For one, it seems to be a slightly more complete course, with problem sets, libraries, handouts etc all readily available. For another, it's good to learn C++, even if it's somewhat of a PITA compared to Python (that feeling has diminished slightly since I've gotten going, but it still is more cumbersome). The 61B course teaches Java, which no doubt is worth knowing as well, but while I can be quite confident that it's worthwhile for someone who only knows Python to also learn C++, I'm not so sure the same thing holds with Java. I don't really know that much about Java, but from what I do know it seems to be quite similar to python, both being high-level object-oriented programming languages. On the other hand, there are some courses I plan to take which involve Java so I'm sure I'll pick it up sooner or later. I hear it's syntactically similar to C++ anyway.

I watched the fourth lecture of 106B and did another problem (problem 2) of the first set. Here's the code for it:
106B Problem set 1, problem 2: http://pastebin.com/nwpTu6yW

Like I mentioned I've begun to be a bit more comfortable with C++. I still forget to initialize variables and put in the semicolons at the end of the lines, but all in all it really isn't shaping up to be that different than python deeper than the surface. There are a few exceptions - for example, python has really handy data types like lists, tuples, dictionaries etc which are very simple to understand and manipulate, and are also incredibly powerful. C++'s data types seem to be a bit more restricted, or perhaps just a bit more obcure (third option: I just don't understand them well enough yet). The new data type at work in this code is a struct, which is somewhat like a very anemic class object that only contains variables and not functions.

I watched lecture 3 and partway through lecture 4 of the Linear Algebra class. I'm working my way through the first problem set and about 2/3 finished. I'm finding it difficult to get an intuitive grasp on how matrices work. The lecturer obviously has no trouble looking at two fairly complicated matrices and seeing immediately how multiplying one into the other will result. I'm not at that level as of yet. But I've been able to figure out some basic concepts of my own which are helping me understand it.

Rules for LR = F, where L, R and F are two n X n matrices:

  1. The kth row of F depends on all of R but only the kth row of L.
  2. Similarly, the ith column of F depends on all of L but only the ith column of R .
  3. Think of L as a bunch of n-vectors laid out horizontally. Think of R as a bunch of n-vectors laid out vertically. Matrix multiplication is a bunch of dot products between the vectors in L and those in R. 
  4. In order for a dot product to happen, two vectors must have the same number of elements (namely n), which is why the horizontal length of L must match the vertical length of R. The other dimensions are independent.
It's still a work in progress, but this kind of thinking helps me a bit.

In the Algorithms class I watched the explanation of the Master Method, which is interesting. I have to admit algorithms have yet to really spark my enthusiasm, but apparently they're the bee's knees for a lot of computer scientists, so we'll wait and see. 

I haven't visited udacity in a few days, so I'll probably go today. At some point when I've cleaned up the code, I hope to upload the web crawler code I've written. I'm mostly using the same concepts as taught in the class, but I'm using object-oriented programming, with objects like web pages, keyword dictionaries, etc. Fun stuff.

Random musings, unexplored ideas:
I'm curious if there's a fast algorithm for finding prime numbers.
In a physics tangent, it occurs to me that the reason objects under a damping or friction force stop, instead of slow down asymptotically like models often show, must have to do with some sort of energy well - if the kinetic or other relevant energy decreases below the threshold of a given energy well, the object won't proceed. Consider a ball rolling over a rough surface. Initially its speed will decrease smoothly, but at some point it won't have the kinetic energy to pass over some pit or hill on the surface it's traversing, and its speed will decrease from some non-zero amount directly to zero. How non-smooth the end of this curve is will depend not only on initial speed, but also on the relationship between the geometries of the surface and the ball.

No comments:

Post a Comment