MathGroup Archive 2000

[Date Index] [Thread Index] [Author Index]

Search the Archive

Functional or rules-based equivalent for procedural program

  • To: mathgroup at smc.vnet.net
  • Subject: [mg24976] Functional or rules-based equivalent for procedural program
  • From: leko at ix.netcom.com (J. Leko)
  • Date: Mon, 28 Aug 2000 08:27:34 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Hello.

I have a question regarding the type of programming style by which I may
accomplish a task in Mathematica. Mathematica supports three types of
programming: procedural, functional, and rules-based. Like the majority of
people, I was formally taught procedural programming, but am trying to
undo this evil. >:-)

Here is my situation...

I am working with a set of all-sky imager (instrument) data. Some years
ago, I created a FORTRAN program which subtracts background intensities
from the data of interest. Here is a brief example of how it works:

o The first two entries in the background file are at 2:08, and 2:17.
o In the data file, the first four entries are time stamped 2:06, 2:10,
2:15, and 2:19.
o My algorithm averages the background values taken at these two times,
and then subtracts this from data which falls between these times, namely
2:10, 2:15.
o The 2:19 data time value falls outside this background range, and would
be handled by the average of the 2:17 and succeeding background times.

Since the routine is written in FORTRAN, it is obviously procedural. As I
stated above, I am expert in procedural programming, but would like to
become proficient in Mathematica programming. Is there an efficient method
by which I may perform this task in Mathematica using either functional,
or rules-based methods?

Thank you (in advance) for your consideration!

J. Leko
University of Alabama in Huntsville


  • Prev by Date: Re: opening files
  • Next by Date: Re: How to avoid complex exponents?
  • Previous by thread: Please recommend a better test strategy??
  • Next by thread: Math, MathKernel ... and others