Numerical Scripting

Alex Angelopoulos (aka at mvps dot org)

As surprising as it may seem to some people, scripting has eminently respectable uses in the world of science and engineering.  One of the earlier sites to discuss this in depth is the Scripting Techniques for Scientific Computing site at the University of Oslo.  Scripting has gained wide acceptance in the engineering world as well; NASA-Langley's fully unstructured Navier-Stokes analysis software now requires Ruby in order to be compiled.

The best justification for this, though, can be seen in the history of the material on this page.  It didn't spring into existence as a carefully thought out approach to numerical computing; it started as a simple solution and a couple of ideas and then grew from there since it was so easy to do.

From time immemorial (or at least 1998 - same thing) there have been questions posed to scripting newsgroups about numerical problems.  Some were calendar centered; others ostensible mathematical questions, ranging from the simplistic ("Q: How do I find pi? A: 4*atn(1)") to the sublime ("Q: How do I get Log base N of X? A: Log (X)/Log (N)") to the ferocious "Atan2? Um.. that's a good question.").

What really inspired me was Jim Warrington's wsh Math Functions Page. He sat down and coded a variety of math functions one day as a general solution to problems, then put them into a VB OCX. 

Numerical scripting

Below are a few example VBScript numerical computing applications I have developed.

4th-Order Runge-Kutta Integration

Numerical integration of arbitrary functions is child's play for VBScript with the Eval and Execute statements

Atmospheric Modeling

A conversion of W. H. Mason's FORTRAN 77 altitude-based atmospheric conditions procedure.  Has an associated readme file.

Parsing EDX Files

EDX files are used for storing high-power rocket motor data.  This parses files and retrieves ordered thrust data from them.

Numerical Constants for Scripting Use

This is a set of standard scientific constants embedded in a Windows Script Component for easy use.  The set includes all o the standard dimensionless constants you are likely to find in an advanced first-year physics text, as well as the usual dimensioned ones provided with MKS-standard magnitudes.

Atomic Table Lookup

A quick-and-dirty periodic table lookup; given an element's number, name, symbol, or canonical mass it will return the other 3 stats for the element.

This is implemented as a plugin class (AtomicTable) with a couple of examples at the top.