Wednesday, July 01, 2009

Document Your Christ-Damned Code

In the context of my research, I've been running a large number of test cases on triangles, which happen to be a good way to look at crystals. My tests were generated with the use of (among other things) a function that takes a triangle and splits it up into four other triangles, like so:



These four sub-trianges are then stored in an array.

Figure 1 above shows the ordering of the sub-triangles, according to the comment above the function I used. Figure 2 shows the actual ordering of the sub-triangles in the array:



Note the subtle but important discrepancy. My test cases were meant to test adjacent triangles, so I used triangle 3 and a randomly-generated second triangle - but by the actual ordering of these triangles, triangle 3 probably wasn't adjacent to the other one.

These worthless tests ran for about 24 hours before I figured out the problem. Now, the fact that I didn't catch this before wasting several trillion processor cycles and ~76 kWh of energy is my own fault, but all this could have been averted had the function been properly fucking documented in the first place.

Note that I'm not saying "comment your code". The code was commented - but the comments themselves contained negative information. The whole point of comments is to prevent the reader from having to go through, line by line, and discern for themselves the functionality of the program - but if you can't trust the comments to be accurate, you have to do that anyway.

So, document your Christ-damned code. The kilowatt-hours and processor cycles you save might be your own.

--
wake up, put on my riot gear

Labels:

Thursday, June 04, 2009

Outliers
Until a man is twenty-five, he still thinks, every so often, that under the right circumstances he could be the baddest motherfucker in the world. If I moved to a martial-arts monastery in China and studied real hard for ten years. If my family was wiped out by Colombian drug dealers and I swore myself to revenge. If I got a fatal disease, had one year to live, and devoted it to wiping out street crime. If I just dropped out and devoted my life to being bad.

Snow Crash, Neal Stephenson

In Malcolm Gladwell's book, Outliers, he talks about something he calls the "10,000 hour rule", which is basically the statement that if you do anything for 10,000 hours, you will be good at it. He (or possibly someone else entirely) further argues that "talent" as we normally think of it doesn't really exist - if you're "talented" at something, what it really means is that you love it so much that you're willing to devote 10,000 hours to it.

Lately, I've been thinking that this might apply to relationships as well, based on two observations. One is that two people who don't love each other can build a functional relationship, if they have to - this is how marriage worked for a very long time. The other is that two people who do love each other are not necessarily inherently capable of building a functional relationship.

This is because a relationship isn't just about love - love is important, but there's more to it than that. Maybe the word I'm thinking of is "compatibility". Compatibility might be inherent, to an extent, but a large part it's learned. No two people are perfectly compatible right off the bat - part of any healthy relationship is learning to forgive each other for your flaws, and love each other in spite of (or even because of) them.

My point is that compatibility doesn't come automatically from love, but love makes it easier to develop compatibility in the same way that "talent" makes it easier to develop expertise. You can be compatible without love - it may not be a happy relationship, but it will probably be a functional one for the purposes of familial stability and so forth.

Now, before you start frantically wondering if anything is wrong with the relationships in my life - these are nothing but idle musings that in no way reveal my inner thoughts.

--
like a moth before a flame

Labels: , ,

Friday, May 25, 2007

Ms. German's Parting Words To Her Seminar Class

Seminar on Scientific Thought was one of the best and most interesting classes I've ever taken, and it's given me a lot to think about, some of which will undoubtedly trickle down onto this website. For now, I want to share what she said to us on the last day of class; though all of you who were there remember it, it's something that everyone should hear.

FOR SEMINAR 2007

What is it about humans that we do science, and make music, and create art, and practice religion, that we study fossils and galaxies, build telescopes and particle accelerators, that we ask about the origin of ourselves, of life, and even of the universe? We keep asking questions, learning more, asking more questions.

So where do we go from here? What new technologies will expand our observations? What is dark matter? Dark energy? Can quantum mechanics and general relativity be unified? How is the climate changing? What are the links between climate and plate tectonics? What will be the results of the loss of biodiversity? What will be learned from the Human Genome Project? From stem cell research? And where will the answers get us?

Do all the pieces fit together? And where do we fit? The knowledge we have gained - continue to gain - gives understanding - and power - and we must be very careful. The work has consequences, and the workers have obligations. We must be thoughtful, respectful, and ethical; we must have compassion and humility. For all that scientific knowledge gives us, as Eiseley says, it "is not the road back to the waiting Garden ... that road lies through the human heart."

A scientist says "while science attempts to describe nature and to distinguish between dream and reality, it should not be forgotten that human being probably call as much for dream as for reality. It is hope that gives life a meaning. And hope is based on the prospect of being able one day to turn the actual world into a possible one that looks better."

A poet says: "Man dissevered from the earth and stars and his history.../Often appears atrociously ugly. Integrity is wholeness, the greatest beauty is/ organic wholeness, the wholeness of life and things, the divine beauty of the universe. Love that, not man/ Apart from that..."

If you are going on to do science, put your work in a larger perspective. Be responsible. If you are going on to other work, remember you live in a world where science is done; understand what that means - what science can do, and what it can't. Be responsible.

Keep learning. And dream. Ask hard questions and don't accept easy answers. And remember "there are simply no answers to some of the great pressing questions. You continue to live them out, making your life a worthy expression of a leaning into the light."

first quote: (Eiseley): The Firmament of Time
second (scientist) Francois Jacob: The Possible and the Actual
third: (poet) Robinson Jeffers: "The Answer"
last: Barry Lopez: Arctic Dreams

--
so we'll scratch it all down into the clay

Labels: ,

Wednesday, September 13, 2006

College Essay, Draft One

I honestly thought this was pretty clever.

I always wanted to be a poet. Poetry alone seemed to have the power to transcend my everyday life and show me that there could be something more fundamentally important than the world I could see. I wanted nothing more than to be able to find for myself that fundamental truth that would, from time to time, peek out at me from behind a stanza.

My interests turned from poetry to physics for a simple reason: I am good at math, and terrible at writing poetry. However, I believe that my two passions have a common motivator. Physics, like poetry, is about searching for the truth, a fundamental truth that is somehow greater than the person that strives for it. Both the physicist and the poet want nothing more than to completely understand the world around them.

The approach is different. The sudden, revelatory flash of intuition plays its part in both disciplines, but for science to be taken seriously it must be supported by piles of evidence painstakingly extracted by experiment from the universe itself; the poet can just write it down and be done with it. This "extra" step reveals the difference in the kinds of truth revealed by each approach. The truth poetry seeks to attain is inherently human. It is rooted in humanity, based in human ideas, written in human language. The truth revealed by science is universal. It rises above those who observe it; it exists regardless of their observation. The laws of the universe hold true whether we recognize them or not. Poetic truth is created, while scientific truth is discovered.

Anyone who would scoff and say that the scientific perspective is cold, calculating, and devoid of emotional content simply lacks the proper understanding of what science lets us see. The subatomic world is filled with uncertainty, strangeness, and charm; the world we can see pales in comparison.

Knowing the mechanisms of the universe only heightens my appreciation for them. A watch is a mere timepiece until one looks beneath the face and can see the delicate intertwining of gears and cogs and springs, acting in precise unison. Afterwards, a watch is never just a watch. Every time I watch a sunset, I find myself thinking about the diffractive properties of light that cause it to be so.

And yet, the universe is not merely a colossal timepiece; indeed, modern science tells us that it is impossible to comprehend it as such. There is much in the universe that humans have yet to understand, and every time we think we've come close, we realize that we have barely even scratched the surface. To anyone but a scientist, this would be frustrating. But science is not about finding answers. Science is about asking questions, and perhaps encountering some fundamental truth along the way.

It is this desire to understand the world beyond the surface that drove me to become a poet. It is this very same desire that fuels my zeal for scientific understanding.

Labels: ,

Monday, May 22, 2006

A Factually Accurate "Rhyming Couplet", As Per The Style that is All the Rage with the Nation's Young People

The speed of light remains the same
In all inertial reference frames.

Labels: