Nonimperitive language for numerical simulation 
Author Message
 Nonimperitive language for numerical simulation

Hi Folks.

I'm interested in numerical simulation.  I've written some simulation codes in
C and come to the conclusion that the imperitive programming style is totally
unsuited to this sort of thing.  I'm looking for better solution, but in the
meantime, I was thinking about the requirements for an ideal language for
this application.  Oh, I've tried mathmatica, and if you compare it against
the following list, you'll note it lacks the naming structure and data
structure.  As you read this, you'll note I have a certain bias (I think about
car design far too much).

If you know of a language like this, tell me!  Otherwise, send your comments

Language Features:

* Language should be based on the declaration and restriction of state.  When
  I try to write my own code, I get rapidly confused about which values I've
  already computed and the best way to calculate new ones.  By simply declaring
  restrictive equations on state variables, I specify what I want in a lot less
  space, and it's much clearer to me.

* The language should have some sort of heirarchy of definition.  I imagine
  something quite a bit simpler than most object-oriented schemes.  How about
  defining objects to have some state variables, some of which can be copies
  of other objects.  The object itself can be declared to be "like" several
  other objects.  The semantics can be as if the variables and restrictive
  equations were simply copied over, and naming collisions and inconsistent
  restrictions can be handled just as if they were within a single object.

* The language should be able to use abstract data types declared in
  another language.  I should be able to have a state variable for a car which
  is a bivariate non-uniform rational b-spline of its surface.  These data
  would be rather hampered without some means of explaining the possible
  simplifications to the compiler.  Overloading would be similarly useful.

* The language is going to need to be able to "get inside" some data types.
  When I define a four cylinder engine, I want to make an array of cylinders.
  Furthermore, I'd like to define that array in the generic engine definition,
  to be variable sized on the number of cylinders (also a state variable).
  Since cylinders are objects with state and restrictions, the language needs
  to be able to "get inside" the array.  Taken to a pleasant extreme, I would
  be able to define abstract data types (lists, grids, toroidally connected
  meshes in 3D) of simulation objects.

* The language should allow for redundancy in the restrictions.  That way, if
  I'm not sure whether to alias individual connecting rod length to the engine's
  definition locally or globally, I can do both.

Compiler Features:

* Output should be in the form of a function in, say, C.  I can imagine handing
  my compiler a definition of the mechanics of an engine, and asking for
  instantaneous displacement of each cylinder as a function of time, or the
  wobble of the engine block as a function of crankshaft rotation.  Generating
  the output in C allows my compiler to rise above many of the issues of
  compilation about which the folks at MIPS (or whatever) have done such an
  excellent job.  Furthermore, the host language can provide support in the
  form of abstract data types, external functions, and a runtime library.

* It should be unnecessary for every state variable to be computable, so long
  as the result requested is computable.  Also, the compiler should be able to
  say which variables it could compute and which it could not.  This last could
  come in the form of the source listing, annotated, and is the best debugging
  output I've thought of so far.

* Many numerical solution techniques require the construction of a function of a
  specific form, so that this function can be passed to a library routine to
  perform the Runge-Kutta integration or the Newton-Raphson iteration.  This is
  manifestly a job for the compiler.  But at the same time....

* The compiler is never going to make as good a choice as I will when
  determining the proper technique to use when solving a system.  In fact,
  merely deciding which set of variables and equations to use in a simple
  simultaneous linear equations example is nearly impossible.  There must be a
  way of telling the compiler how to solve a certain system, without having to
  specify too much detail.  I imagine calling some external Newton-Raphson
  function with lambda (sum-of-forces-on-each-node-of-bridge ( position-of-
  each-node-of-bridge )).
  This item really belongs up there in language features.

* The compiler should figure out which computations are constant from one
  invocation to another, generate code to compute them only once, and
  thereafter reuse its partial results.

* The compiler should eliminate all the redundant state.  This saves both
  memory, memory moves, and cache misses.  Furthermore it should order the
  parital results that it computes so that on reuse they are accessed in
  increasing order in memory, to best use cache prefetching.

* The compiler should only compute values necessary, right down to the
  atomic operation level.  I imagine it solving the gas law for P*V, but
  never computing P or V, since neither is needed.  Combined with the above
  item, this constitutes the ability to change the very things being computed,
  a fundamental new ability this compiler can have.

* The compiler should have extendible simplification, so that it can move
  the solution of a simultaneous linear equation out of the loop of a N-R
  iteration.

* The compiler should perform all kinds of optimizations that are simply not
  possible for a normal compiler.  It has more information than a normal
  compiler, and so more space over which to optimize.

Whew!  That's definitely enough for now!

-Iain McClatchie



Mon, 17 Jan 1994 22:16:18 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. numerical simulation in FORTRAN and C++

2. WANTED: numerical simulation visualization widgets & tools

3. numerical math with functional languages?

4. Q: Numerical codes in functional languages?

5. numerical & statistical programming in functional languages

6. Numerical Algorithms in functional languages

7. Numerical programming (was: Overloading Operators: Extension to Language)

8. Q: Numerical codes in functional languages?

9. Announcing Octave - a high-level language for numerical computations

10. Languages for Numerical Computation --- Was C vs FORTRAN

11. Language for Numerical Weather Forecasting

12. Expert system shell/languages for numerical problem domains?

 

 
Powered by phpBB® Forum Software