# HG changeset patch # User Steve Losh # Date 1261610975 18000 # Node ID e030519b448dcd3a0d20f1b448fa9e4aa3cc1417 # Parent dad1fb1655ec58dcb8715ed8cd8c1ab2f3db9e9a Finish adding the 2008 articles. diff -r dad1fb1655ec -r e030519b448d content/blog/2008/08/beauty-in-computer-science-recursion.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/content/blog/2008/08/beauty-in-computer-science-recursion.html Wed Dec 23 18:29:35 2009 -0500 @@ -0,0 +1,179 @@ +{% extends "_post.html" %} + +{% hyde + title: "Beauty in Computer Science" + created: 2008-08-29 15:30:38 +%} + + +{% block article %} + +When I went to college, I majored in Computer Science. I haven't really +written anything about this part of my life yet, so I figured this might be a +good time to start. + +I decided to major in CS when I was in high school. I learned to program on my +own and enjoyed the challenge of it. I also knew that programming jobs are +fairly common and pay well enough that I wouldn't have to worrying about +paying my rent. I wasn't artistic in high school, and CS seemed like a +logical, sterile field that I felt I could do well in. + +During the years I spent at RIT I changed quite a bit. I think the most +important, or at least the most obvious, change has been my becoming more +artistic. Between dancing, playing bass and photography I've developed a +creative side that I never thought I could. Has this led me away from Computer +Science at all? + +No. While I became a programmer for practical reasons, I stayed one for +entirely different reasons. Computer Science (and math in general) is +beautiful. It took me years to slowly realize this, but now that I have I see +that it's more beautiful than any dance, photograph of music I've ever +encountered. This post is the first in a series of posts that I hope can +communicate why I find CS beautiful, or at least point in the right direction. + +A Quick Primer on "Functions" for Non-Programmers +--------- + +I know that most (if not all) of the people that read my website don't +program. I'm going to try to avoid using extremely technical, computer sciency +terms in these posts, but there are at least a few basic things that I need to +explain. The first is what a function is. + +Think of a function as a set of instructions. A recipe is a decent example. +Imagine you have a piece of paper with the following written on it: + +1. Heat a frying pan. +2. Crack two eggs into a bowl. +3. Mix the eggs. +4. Pour the mixture into the hot frying pan. +5. Stir the mixture until it is solid. +6. Take the mixture out of the pan. + +That's the simplest example of a function: a list of instructions that you +follow in the order you get them. The next idea is a "parameter." That recipe +only told us how to make food for one person, wouldn't it be nice to know how +to make enough for two or more? Imagine the paper now says this: + +1. Heat a frying pan. +2. Crack NUMBER_OF_PEOPLE * 2 eggs into a bowl. +3. Mix the eggs. +4. Pour the mixture into the hot frying pan. +5. Stir the mixture until it is solid. +6. Take the mixture out of the pan. + +Now we still have a single piece of paper, but by just substituting in the +number of people we're cooking for we have instructions for making any amount +of food. If we have three people, NUMBER_OF_PEOPLE * 2 eggs becomes 3 * 2 +eggs, or 6 eggs. + +The last important concept is "calling." Once you have one function, you can +use it in other functions, like so: + +1. Put a plate on the table. +2. Refer to the other piece of paper and do what it says, for 1 person. +3. Put the result of that on the plate. +4. Eat it. + +See how we did a few things, then referred to the other piece of paper instead +of repeating ourselves? This lets you make small tasks and put them together +to form bigger ones. That's enough of a primer for now; if something's not +clear please comment and let me know. + +What's Recursion? +--------------- + +Recursion is a term that means, basically, a function calls (or refers to) +itself. This concept can be hard to grasp, but once you do it slowly turns +into something breathtakingly beautiful. + +Here's a simple example: imagine you're 10 meters away from a doorway and you +want to walk out of it. A function that could help you do this might be: "Walk +11 meters." That's pretty simple. + +What if we want to be able to walk out of a doorway that's any number of +meters ahead of us? We could say: "Walk DISTANCE + 1 meters." This works, but +requires that you know how many meters away the door is before you even start +walking. What if we don't? + +How about we just do a little at a time and see how it goes? "Walk 2 meters. +If you're out of the doorway, stop. Otherwise, repeat this function." If the +doorway is 3 meters in front of us, we'll walk 2, check if we're out (we're +not), and repeat. We'll walk 2, check if we're out (we are), and stop. This +function is recursive; it refers back to itself. + +Why is it beautiful? +-------------- + +The beauty of recursion, for me, is that you can build infinitely large or +complex tasks or structures using one or two tiny, simple parts. I'll give an +example of this because I think it's the easiest way for me to show it. + +Imagine that you only know three things: how to add 1 to a number, how to +subtract 1 from a number, and what 0 means. Now imagine that you want to be +able to add any two (positive) numbers (integers) together. How could you do +this? Here's a function: + + function add(x, y): + if y = 0: + return x + otherwise: + return add( x+1, y-1 ) + +Don't let the new notation scare you; it's the same kind of function as +always. In English, it says "This function is named 'add' and needs two +parameters (x and y). Step one is to see if y is 0. If it is, the result is x. +If it's not, then the result is whatever you get from performing this function +with the following parameters: x+1, y-1." + +It might not be immediately obvious that this will actually perform the +addition we're used to, so let's try it. First, let's try adding 1 + 0. In +that case, we check if y is 0. It is, so the result is x, or 1. So far, so +good. + +Let's try 2 + 1. Is y equal to 0? No, so we need to call add with some new +parameters. 2+1 is 3, 1-0 is 0, so the result is now whatever we get from +add(3, 0). We start following the instructions of add. Does y equal 0? Yes, so +the result is 3, which is what we expect. + +One more for good measure: 9 + 2. First we check if y is 0. It's not, so the +result is then add(9+1, 2-1), or add(10,1). Start over. Is y zero? Nope, so +the result is now add(11, 0). Start over. Is y zero? Yes, so the result is x, +or 11. + +So What? +-------- + +This will work for any x and any y (as long as they're both positive, negative +numbers make it just a tiny bit more complicated). This might not seem +impressive, but think about what we've done. We've created something that can +add any two numbers together. There are an infinite amount of numbers. This +tiny function that we've made from the simplest of parts can generate more +results than there are people on this planet. Or atoms in the universe. To me, +this is amazing. Not "magic trick" amazing or "miracle" amazing but "I can +understand and create something that can describe more knowledge than the +whole of humanity couldn't hope to describe in a thousand lifetimes" amazing. + +Computer Science (and math in general) is full of this kind of beauty. I've +tried to find parallels in my other interests; the closest I've found is the +photograph [Pale Blue Dot][]. It's a photo taken by the Voyager 1 space probe +showing an immense amount of space with the tiniest blue speck in the middle, +which is Earth. + +When you view the photograph, it's a mostly black field with a little fleck of +blue pigment. Not terribly complicated or interesting, until you realize that +that blue fleck is a representation of the planet that billions of people have +lived and died on. A smidgen of blue ink, in the right context, represents +every place a human has ever called "home." + +Our addition function might not seems nearly as nifty as this, but it actually +represents more than even this photo ever can. There are a finite number of +people on Earth, but the addition function can add more numbers that that. +Even if you count every second in the life of every person that has ever lived +on our planet, the addition function can create more numbers than that. + +This awes me more than any myth, photograph, story, song, legend or dance ever +has. It's the reason I stayed a Computer Scientist. + +[Pale Blue Dot]: http://en.wikipedia.org/wiki/Pale_Blue_Dot + +{% endblock %} \ No newline at end of file diff -r dad1fb1655ec -r e030519b448d content/blog/2008/08/negative-space-dancing.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/content/blog/2008/08/negative-space-dancing.html Wed Dec 23 18:29:35 2009 -0500 @@ -0,0 +1,102 @@ +{% extends "_post.html" %} + +{% hyde + title: "Negative Space in Dancing" + created: 2008-08-31 15:33:57 +%} + + +{% block article %} + +Last night a few of us from Rochester drove to Buffalo for a swing event. +There were three classes during the afternoon that were pretty fun. There was +a dance in the evening which had a great turnout and plenty of energy. As nice +as all that was, the real highlight of the day/night was the blues party after +the dance. Matt and I ended up DJ'ing it and it was absolutely awesome. I got +to meet and dance with a whole bunch of new people that I hope to dance with +again soon. + +One concept I try to use in my blues (and tango) dancing is that of negative +space. I've found that a lot of blues dancers don't really seem to quite get +that idea. I'm not saying that it's the "right" way to blues dance but it's +something that's changed how I dance and I wanted to write something about it +to share it with anyone interested. + +What is negative space? +------------------- + +Negative space is a term used a lot in painting, photography, graphic design, +etc. It basically means that for a given photo (or painting, whatever) the +whole frame isn't filled with "things." Two examples of this taken from my +flickr favorites are [this photo][1] and [this one][2]. In both of these +images the subject takes up only a small portion of the frame. The expanses of +even texture and tone add certain qualities to the photos that can't be +achieved otherwise. + +A photographer that takes this to an extreme is Hiroshi Sugimoto, in his +[Seascape][] series. He uses long exposures and darkroom techniques to produce +images of nothing but negative space. The sea blends into a seamless texture +and the sky becomes a single tone. Even though there isn't a physical object +between the two, the division between them forms a subject of its own. + +How does it relate to dancing? +------------------------ + +Most of the blues dancers I know come from a Lindy Hop background. Lindy Hop +is a dance of movement and momentum; that's part of what makes it so much fun. +When blues dancing I think a lot of Lindy Hoppers never catch on to this idea: +*you don't need to be moving all of the time*. It's alright to slow down and +actually stop for one, two, three, four measures. It gives the dance a chance +to breathe and lets you focus on your connection with your partner without +movement getting in the way. + +"Won't that be boring?" No. Absolutely not. Stopping can provide things that +you can't really get while moving. It can add tension, release it, and +completely change the mood of a dance. It really does have a lot in common +with negative space in art, and it adds a lot to a dance. + +Negative space does not mean "empty space," although it's often described like +that. In the first photo I linked to the wall is indeed blank, but has color +and texture that can give you plenty to look at. In the second, the expanses +of white are just that: white. They are not empty; they have a distinct tone: +white. If they were black, or even a light grey the photo would be entirely +different. + +In dancing, movement is important but not the only thing we think about. +Posture and body positioning is one example. "Feeling" or "mood" is another, +more elusive, one. Just because the movement is gone doesn't mean all these +other things go away automatically; they're still there until you let them go. + +Taking it to the extreme like Sugimoto's Seascapes is also emphatically *not* +boring. In some of the best blues dances I've ever had there were parts where +we didn't really move for several measures at a time. When this happens, both +of you create your own negative space through your posture, etc. Neither of +these spaces are empty. + +Where these spaces meet is your connection. Like the horizons in Sugimoto's +photographs it becomes the main subject. By eliminating motion you're free to +focus your attention on other aspects of the connection. Sometimes these +aren't obvious at first. One example Mihai likes to talk about is breathing. +Another is understanding where your partner's weight is. + +By giving yourself time to really feel the connection with your partner you +have time to examine it much more closely. You can introduce tiny movements +(like the waves that fleck the surface of the water in Sugimito's seas) that +interrupt the absolute flatness of the spaces and let you explore the +interactions between them. Not only does this let you learn about how your +partner is connected to you in a more in-depth way, it's very, very fun. + +I don't have a particularly amazing ending for this post. The main points I +wanted to get across are these: Negative space in dancing is removing most or +all of the movement for a longer-than-normal about of time. Negative space is +not empty space unless you ignore all the other aspects of the dance like +posture, mood and connection. Negative space can add things to a dance that +you can't get otherwise. + +Try it. + +[1]: http://flickr.com/photos/theoperamafia/2790037114/ +[2]: http://flickr.com/photos/jodiseva/2385347094/ +[Seascape]: http://www.sugimotohiroshi.com/seascape.html + +{% endblock %} \ No newline at end of file