[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: array dimensions

Richard G. French (rfrench@wellesley.edu) writes:

> Now that you mention SMOOTH, one of my pet peeves is that 
> y=SMOOTH(array,n) gives an error message when n=1. There are lots of 
> instances where the degree of smoothing is calculated on the fly,
> and one common instance is that you want no smoothing at all - i.e.
> just give me the original array, unsmoothed. I've ended up writing
> my own routine MYSMOOTH which is identical to smooth except that
> it does not barf when n=1. Perhaps this has been changed recently,
> but I don't think so. Does anyone have a good explanation for why
> n=1 does not have the expected behavior of returning the array
> unsmoothed? Or is there a keyword I have not been noticing that
> can handle this case?

Having had some modest experience these past few years
writing programs for public consumption, allow me to 
make an observation or two.

I don't know how it is done in the real world, but
in my world a program idea is generated as a result
of a problem I have encountered (usually more than once) 
in my own work. I come up with what I almost always 
mistakenly believe is a clever idea and I code it up.

The program stays at this stage for some indeterminate
amount of time, usually until someone runs into a similar
problem and asks a question on the newsgroup. "Oh", I think,
"I have a clever solution to *that* problem. I'll clean
it up for them and offer it on my web page."

In the course of "cleaning it up", I usually discover
that my clever solution is really not as clever as I 
thought it was and that it tends to work only in the
narrow confines of its original purpose. So I
make it more general. In fact, I usually try to imagine
all the ways it might be used. 

Now, I am known in some circles as having a pretty
fertile imagination, but I have to admit that one of the
things that would *never* occur to me if I was writing
a SMOOTH function is that someone would use it if they
*didn't* want to smooth anything. Are you sure it would
have occurred to you?



David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155