"I have held many things in my hands, and I have lost them all; but whatever I have placed in God's hands, that I still possess." -Martin Luther
Showing posts with label Update. Show all posts
Showing posts with label Update. Show all posts

Thursday, June 11, 2009

Weakly Typed Languages, or, I Don't Get the Point

Dear Readers,

It got all dark outside the office and started raining about half an hour ago, so I'm sticking around until it lets up a bit before making the 0.25-0.5 mile walk home. While I'm sticking, I might as well write up what I've learned today.

I'm working with IDL, a weak-typed language, which means you don't have to specify a type, such as int, long, double, or string, when you create your variables (real computer people are probably rolling over in their cubicles at this definition; it is more complicated than I'm making it out to be (don't get the idea from this mention of rolling over in cubicles that I in any way believe computer people have no lives; it's all in good fun)).
Weak-typed languages have all sorts of benefits and problems compared to strongly-typed languages.
Today I discovered one of the problems.
I was fitting some data by changing various parameters and running a batch of scripts that took a little under two-minutes to complete, then looking at my results and trying again. About three hours in I ran into a strange trend. A certain parameter did affect my results; I had observed it do so before, and was observing it do so now; however, no matter how I varied the parameter, I got only one of two outcomes, whereas I expected a whole continuum of variation as I varied the parameter. Above a certain parameter value, I got one answer, below it, another, and, the more tests I ran, the smaller the possible value of that, well, certain value became, until at last I determined there was indeed an integer parameter value above which I got one result, below which I got a strikingly different one. This was most odd, so I typed
help
at my idl command line, and idl did its best, which was to give me a list of all the variables of which it was aware, their contents, and their current type. The parameter I was varying was a ratio of two numbers, yet it, amongst a host of other ratios, was registered as an int. That was the problem, because I was working with a ratio very close to one. Any ratio with a value between one and two was assigned the integer value one. Any ratio between two and three was truncated to two. Well, that couldn't be my fault. After all, it's a weakly-typed language -- it's responsible for such matters!
And yet, it was my fault. As soon as I asked myself why the compiler would assign this particular ratio as an int, and looked at the various parameters in the parameter file, I realized my mistake.
All the other numbers in ratio form had these annoying little decimals at the end of them. I, of course, had deleted the decimal in this ratio after changing the value. No point in leaving it in, you know? But of course that was the whole point. In order to let the computer know it's dealing with a floating-point number rather than an int, IDL allows the user to simply add a hanging decimal. Well, isn't that convenient! And now I know.

Before I conclude this post, I ought to answer a question I am sure many of you are asking yourselves. The question is as follows: I thought he was an intern, yet he knows when it gets dark outside and starts raining. Do interns have windowed offices? The answer to this question is that yes, I do work in a windowed office. There are AC pipes hanging from the ceiling. Beneath, upon, above, and about my desk are seven computer monitors (besides my own -- five CRT, three flat panel) and ten computer chassis (although a few look like they've been cannibalized). There is also a window running the width of the room. It's at the top of the wall, though, leading to the somewhat jaded comment I was privy to a few weeks ago: "there's piping in the ceiling and the window's are raised; it's either prison or a grad-student's office." That statement, of course, now proves to be false, as this office is my very own, and I am neither graduate student nor prisoner.

Monday, June 01, 2009

Stellar Solar Summer Days

What better way to break a several month's silence than by letting my readers know what I intend to publish during the next few!
To cut to the chase, I intend, no later than tomorrow, to upload the next installment of Nathanael Booth and the Ring of Power. I have written the end. How much longer can it take to publish it all?
After that I plan to work on posts every day. How often I will post depends on how much I get finished.
In the works are updates on Physics, Computer Science, sword-fighting, story-writing, a few historically-accurate Benjamin Dobbs episodes, and perhaps even something entirely new and science fiction-y...

And now, a brief update on my life, which will set the stage for some of those hopefully-pending physics and computer science related updates.
Today was my first day at work as an intern in the Astronomy department of South Carolina's beautiful Clemson University.
When I'm not learning about and hopefully contributing a tiny little bit back to astronomy, I plan to cook, write, read, study for the Physics GRE, and research graduate schools.
I will be working with IDL to learn, use, and, perhaps, improve a model of gas in what are believed to be protoplanetary accretion disks surrounding a class of observed stars known as Herbig Be stars.
This means I not only get work on real research using computer programming in an office in a physics department just a door down from real live physics graduate students and not very far at all from departments-full of living, breathing physicists, but I also get to live in my own apartment, shop for and cook my own food, and walk or use public transportation everywhere I go (all the italicized items are things that I think are just awesome, although I must admit that I may well be tired of quite a few of them by the end of the summer).
Nine weeks from now I will have, Lord willing, gained an entry-level knowledge of the field, written a paper and prepared a presentation on my particular work, spent a few nights at the SARA telescope at Kitt Peak, Arizona, and gotten paid by the NSF to do it.
I am daunted, but, today, quite happy about the prospect. While excitement over my project is one reason for my enthusiasm, I must admit that I suspect some part of it is due to all the other good things that have happened to me today. Frisbee tossing an old friend and some new, a successful journey to Wal-Mart and back with the treasure of a week's supply of food, and the unexpected arrival of air conditioner repairmen who installed a thermostat that, while set 4 degrees higher than the former, keeps the apartment at least 8 degrees cooler (I don't think the needle on the old one could go higher than 80). I hope my contentedness and joy will not prove to depend on my circumstances.