Displaying 1-7 of 7 result(s).

First Brush with Python

By doug on 2011-05-17 22:54:01

I'm well aware I'm late to the band wagon - Python is a big deal and has been for a long time. For a long time, I've been meaning to give it a shot and see what it was all about. I've had a few weak attempts to understand it here and there, but generally never had it really grab my attention. Now that I've managed to complete my time at UNH, it's about time to try and pick up some new and interesting things. To quote the Python website itself:  Python is a remarkably powerful dynamic programming language that is used in a wide variety of application domains. Python is often compared to Tcl, Perl, Ruby, Scheme or Java. Some of its key distinguishing features include: ... Python is an interpreted language that is open source and very portable (it can be supported by a variety of virtual machine back ends). The language is a multi-paradigmed including imperative, object-oriented, and functional. These can work interchangably quite easily if desired, and results in some code that's fairly unique to read, yet really simple to follow. In addition, the standard library is very extensive (and the example I've created only touches a few of those options). Following in the steps of my previous post, I found it neat to attempt to put together a simple statistics package in Python. This is an easy way to check out how a language may express particular algorithms. This set of stats functions is fairly simple - Read in a set of numbers from standard input (in...

Statistics and Programming - Fundamentals

By doug on 2011-01-30 13:22:55

If there was one thing I could go back and do in my college career... well, there would probably be a lot of things I'd change. One academic choice I could change would be to make better use of my statistics class. I've recently been thinking about my lack-of understanding of good statistics and how it could be applicable to testing and verifying software systems (or any studies for that matter). I decided I wanted a bit more of a hands on and familiar way to approach statistics, so I decided to look up statistics for programmers. My first results were interesting: Programmers Need To Learn Statistics Or I Will Kill Them All Does knowledge of statistics make you a better programmer? Statistics For Programmers I: The Problem I was kinda surprised. There are also arguments that support using statistical knowledge like many other fields have for a long time to reason. Check out this presentation by Greg Wilson - What We Actually Know About Software Development, and Why We Believe It's True. Greg Wilson - What We Actually Know About Software Development, and Why We Believe It's True from CUSEC on Vimeo. I suggest watching the entire hour. However, my understanding of the presentation is this - Many fields (varieties of engineering fields, social sciences, etc) take advantage of good statistical evidence to argue and support claims while the world of software engineering has yet to do this properly. From what I understand, Greg argues that many of the qualities that ha...

What I've Learned From Classic Hollywood Film and Programming

By doug on 2010-11-25 22:32:40

Wait, what? As a disclaimer, I am NOT a film person by any stretch of the imagination. I'm also not going to claim I know much about the classic Hollywood system, how good films are truly constructed or try and do anything to provoke a violent backlash from those who do consider themselves film people. So please, reserve for your attacks on me at least after reading what I'm writing here. However, I've gained something critical in my mind from some ideas behind this system of filming, and maybe film in general. In particular, it's the idea of making precision shots that help with continuity of the story. The goal of films in the Classical Hollywood System is to create a series of image that are very easy to process, digest, and help persist the story without having to really think about each image that is show. Tricks such as eyeline matches and graphic action matches along with dialog that is very concise and only helping to continue the flow of the story are all part of this system to creating film for the masses.  In a similar way, the presentation of code and ideas behind code are also critical to this notion of clarity behind an idea one is trying to convey. While this is well taught and obvious from the perspective of code semantics/correctness (AKA, what you want the damn thing to do at each step and overall) as well as efficiency of the code itself, it is not always clear in the sense of who must come and maintain it. For example, it's very much ...

Collatz Conjecture - Implementing a Natural Number

By doug on 2010-08-22 20:43:12

  Collatz conjecture is a strange problem in mathematics. In particular, the conjecture states the following: Take any natural number n. If n is even, divide it by 2 to get n / 2, if n is odd multiply it by 3 and add 1 to obtain 3n + 1. Repeat the process indefinitely. The conjecture is that no matter what number you start with, you will always eventually reach 1. Wikipedia, Collatz Conjecture What's particularly interesting about it is trying to formally prove the validity of the statement. While a proof would be rather fascinating for a problem such as this, I'm certainly not the man to be working on creating that. Instead, I've become more interested in its implementation as software. Here's a basic implementation of the algorithm: n € N (integer >= 0) while ( n != 1 ) {     if ( n % 2 == 0 )          n = n / 2     else         n = 3*n + 1 } return Normally, the question for a person is "Will this halt?" I believe there is a proof that this is an undecidable problem, but that's not what really interest me here. What interests me here is more detail oriented towards system. The largest possible representable integer on a 32-bit computer is 4,294,967,296 (unsigned). This, in respect to Collatz conjecture, is a relatively small number. The question th...

Traffic Circles

By doug on 2010-07-05 07:51:39

Working in Portsmouth, NH now involves me generally taking a route down Rt. 16/Rt. 1 to get to work on a daily basis. While in transit on the route, you'll run into a classic friend - a traffic circle. The Portsmouth Traffic Circle In my driving experience, people have not been too graceful in respect to handling traffic circles. From what I understand, traffic circles should really help reduce traffic loads by allowing a consistent flow of traffic. At the very least, if you're in line, at least you're constantly moving in that line. I've found this to not be the case, especially here in NH for whatever reason. However, driving through the circle so often, I wonder why that is exactly. After observing for a while, I've come up with a few points for people to ponder when attacking a traffic circle. Wait for a space to merge into the traffic circle I've found that most people attempt to merge into the circle as closely as they can to another car in the circle. This is a poor strategy in the traffic circle since you then force cars in the other lines to have to wait longer to find another opening. This in turn builds up those pesky lines which we want to avoid. Sure, it doesn't matter if one person does it, but since everyone is doing it this way, it causes for some big line buildups. I suggest leaving probably about 4 car lengths open for another car to merge into. Even leaving about 3 leaves many people uncertain about merging in, so 4 is probably ideal for ...

String Powers

By doug on 2010-05-26 13:59:08

This past semester, I took a course on Computer Science Theory. In particular, CS659 at UNH. The course is intended to give an introduction to the fundamentals of what makes computing work - formal and informal proofs, program verification, finite automata (deterministic and nondeterministic), languages, pushdown automata, and lots of other topics. This course was the toughest I've taken in the CS department to say the least (especially not being a huge math person). What a struggle that was! There was one topic I found somewhat intriguing though - strings. Strings, in CS theory, are defined inductively. It is essentially a set of values where every member in the set is a value of an alphabet. So, in other words: S = {wa | w € E* ^ a € E} *NOTE: I MAY HAVE BOTCHED THIS DEFINITION, BUT YOU SHOULD GET THE IDEA* Similar to strings programmers are used to, you can perform a lot of operations on these strings (obtain substrings, put two strings together, etc). There's one operation that I found really neat but haven't seen around too much - that's the power operation. The power operation on strings is essentially performing concatenation with a duplicate of itself. For example, lets say I did something like this (assuming Java syntax): System.out.print( "abcd" + "abcd" ); I would get an output of "abcdabcd". The same output could be achieved from using the string power operation, where the power is 2 (note that this syn...

Get Up And Start Again...

By doug on 2010-04-24 15:53:53

Hello all! First and foremost, long time no chat! I've done a poor job of keeping this blog up to date when it was working. A pretty sad state of affairs, especially since it was finally broken due to what I suspect were stupid and careless errors on my part. Anyway, a few months later and here we are - back on track! I've had some ideas of things I've wanted to explore and write about a little bit, so I'm hoping that I can make myself try and stay on top of the writing thing as often as possible. I also know I told myself this last year, but I'd like to try and keep up with the writing over the summer. However, though, I'm going to go with my normal rule of thumb - Do what seems right. I'm happy with how things turned out on the blog so far. I think the layout looks good (or, at least is a good start). The graphic off on the left could definitely use some work. I was trying to mess around and see if I could get it to turn out well (since graphics are kinda a weak spot for me). It's an OK first attempt! In addition, I'm also using the Yii Framework to run the blog this time around. Hopefully I can implement some things (like an RSS Feed and a commenting system) to this blog using Yii and given some more time. In other events, school has been pretty challenging these days. This semester certainly is pushing me to my limits of trying to balance time and do as well as I can. Between the more advance CS courses I'm having to take along with an Ele...