Tuesday, April 12, 2005

It figures

Every so often, we all need to make various exploratory calculations as part of running our businesses. Perhaps we need to estimate a preliminary budget, calculate the projected revenue from a program, or analyze results we've been given. Often these are relatively simple calculations that just happen to deal repetitively with arrays of numbers.

As most of you probably do, I sometimes turn to spreadsheets or a calculator for such calculations. I keep coming back to an old standby, though, that often makes my life easier and gets results faster: the free J.

Just this week, I had some numbers to explore, and I started in a spreadsheet. After a few iterations, I was beginning to get lost, even with comments on cells to help me recall my assumptions. One of the challenges was the inability to see the assumptions, calculations (equations), and results, all at the same time.

So I switched to J. I opened a script window and started typing. Assumptions went into comments. Calculations went into simple equations. Constants went into even simpler equations. Every so often, I'd save and run the script to see the output. When I didn't get what I expected, I'd enter the name of a variable in the execution window and use the intermediate result to help understand what was happening.

Within a relatively short time, I had the result I needed, and I also had a file that documented my assumptions and process.


Labels: ,


Blogger Michael said...

Thanks for that nice description of how J solves real-world problems. I have been learning J, motivated mostly by curiosity rather than a current need. I expect as I gain greater facility with the language it will become a powerful tool in my bag 'o tricks.

13 April, 2005 23:08  
Blogger Bill Harris said...

You're welcome, and thanks for the note, Michael. Even if you don't use it for anything else, try using J as a calculator. I find it really handy to be able to operate on a bunch of numbers at once (e.g., recalculate a forecast over the next 12 months all in one step).

15 April, 2005 13:57  

Post a Comment

<< Home