Mathsy(ID:4355/mat011)Interactive mathematics and graphicsfor MATHematical SYstem pronounced MATH-SEE Peterson & Budgor, Lawrence Livermore Lab 1977 Groundbreaker system that directly led to both new algorithms and new physics breakthroughs. COded in FORTRAN IV, allowing direct access to most of the FIV transforms, but in an ultra-concise manner "High-level interactive mathematics and graphics computer language [...] an interpretive, interactive, mathematical, array processing, and graphics system" Places Structures: References: Discussion We have presented a very general technique (differential- area method) for computing composite density-of-states spectra given any nonsingular dynamical matrix. These spectra compare favor ably, but with longer CPU times than density-of states obtained by summing individual- branch spectra, and have the additional benefits that they do not require any root searching and can be preset to any desired frequency or energy range. Mesh size in the independent variables (three for three-dimensional lattices) is easily fixed to suit the physical nature of the problem. Thus, dispersion relations which are derived from nonlinear problems can be treated as easily a s their linear eigenvalue counterparts. All eigenstates are obtainable simultaneously. Furthermore, since the differential-area method requires little more than the elements of a dynamical matrix, or even experimental data fit to some fictitious dispersion relation, the MATHSY code used to sense zero crossings is only 1.5 lines long. Inclusion of all graphics and initialization data specific to the simple, face- and body-centered, Eqs. (3)- (6) enlarges the code to 49 lines. This is true regardless of the dimensionality of the matrix. It is therefore very easy to implement, even by non-experts in band-theory calculations. In many instances with a little more effort, such as by utilizing group-theoretical reduction of the dynamical matrix to separate branches, or at worst using matrix-diagonalization routines, even the inherent degeneracy error facet of multi-branched dispersion relations can be removed. (Analytic branch spectra can be practicably obtained from any Nth order dynamical matrix whenever it can be block diagonalized so that no block is larger than 4 x 4.) The differential- area method will then become an exact method and differential-area spectra will superpose onto the root- surface spectra. Since the differential-area algorithm is also Brillouin-zone- symmetry independent, in situations where there is less symmetry along any particular direction in : space, the choice of partitioning space in planes containing this asymmetry will also remove-partially or totally-the degeneracy error. One final advantage that need be stressed stems from the numerical equivalence of the differential area method to evaluating the delta-function integrals (8). It can therefore be easily modified to find the density of states for any physical problem, be it electron, plasma, etc. As in the phonon problem, a starting point is some dispersion relation o r equivalently a dynamical-like matrix from which the dispersion relation is generated. Extract: Introduction Introduction The emergence of high-level computer languages distinct from Fortran has permitted solvability of extremely complex problems. Mathsy, as an example of such languages, enables the user to issue commands much like those of hand calculators, but as we hope to demonstrate, is much more powerful. Mathsy is being used at the Lawrence Livermore Laboratory for a large portion of the image data analysis in the laser fusion project, for advanced laser design, and for other data manipulation and numerical calculation. Recently, the use of this language has been instrumental in the conceptualization of a new algorithm to complete the density of electron or phonon (quantized or normal mode vibrations) states spectrum in solid stale physics. Considering the ever increasing application of Mathsy to numerical work of all types, we feel that it is now timely to introduce Mathsy to the general computing public. Extract: Mathsy - The Language The Language: Mathsy Mathsy (math system) is an interpretive, interactive, mathematical, array (matrix) processing, and graphics system. The system is an interpreter that executes directly from commands given at a keyboard, from an editor-created file, or both. New commands are easily defined and can be treated as any basic library command. Mathsy is interactive as it presents the user with the facility to perform operations or make program changes from a keyboard and almost instantaneously view the results either numerically or graphically on a graphics terminal. Of the more than 250 currently existing library commands, the mathematical operations available include almost all of those in Fortran. Vector operations (across each row of an array) such as first Fourier transforms, curve fitting, sum and differencing, ordering, shifting, rotating, and reflecting are available. There are array operations such as transpose, maximum, minimum, and histogram. In addition to numerical output, many types of 2-D and 3-D graphical displays are possible. All the graphs in this paper were generated by the system. The Mathsy language is operationally similar to that of a hand calculator. There are no parentheses, and operations are perfbrmed from left to right with infix notation. Presently, only the 26 letters of the English alphabet are permitted as array variables; a colon followed by up to two letters enables definition of 703 scalar constants. Unless otherwise specified, the letter Y is the working array variable and is treated as the accumulator (display register) of a hand calculator. Arrays are initialized with dimension and value commands. The dimension commands specify how many rows and columns the arrays have. Array values are initialized by defining an operation. These are designated with a command such as "SPAN [2, -5]" which generates a linear span of numbers from two to minus five across each row of the working Y array. A single argument produces a span symmetric about zero. Thus, "SPAN2" is equivalent to "SPAN [-2, 2]", In Mathsy, the commands "B+C*A SIN D=" are equivalent to the algebraic operations D(i,j) = SIN(A(i,j)[B(i,j) + C(i,j)]} i= 1,...,N, 1,...,M, for each of the N.M elements of the arrays A, B, C and D, Sequentially, the Mathsy commands bring the B array into the working Y array, add the corresponding C values to Y, multiply by the corresponding elements of A, take the SIN of each of the Y values, and then copy the Y array into the D array. [...] The compactness of the language can be illustrated by Figure 1; only two lines of code are needed to produce the torus there depicted. Figures 2, 3, and 4 demonstrate some of the graphics capabilities using a Gaussian function as data. Note from the figure captions that one command produces the desired operation and display. From this stance, Mathsy is operationally a geometric language. Sequential transformations are viewed via its graphic interface. Except for a few machine language routines used to increase Mathsy's speed, it is written in Fortran. Thus, it is reasonably transportable and can be interfaced with other graphics systems. This, together with its easily understandable syntax, is one of the major attributes of Mathsy, and distinguishes it from other graphics-array processing languages such as SPEAKEASY and LG. Implemented on the CDC 7600 computer, Mathsy uses about 48,000 words for program and nonuser data information; this leaves approximately 350,000 words for user data space. Mathsy adjusts its data size as the user program requires more or less space. To keep down the running size for the various graphic and command modes, the Mathsy program contains overlays. Many of the array operations, such as "SIN", are simply single "DO loops". These perform the same operation on all elements of an array. The vector operations, such as "SPAN", are double "DO loops". Except in the Boolean mode, where each bit of each word can be manipulated, all operations are 60-bit floating point with 14-digit accuracy. Extract: Mathsy Commands Mathsy Commands In this appendix we present an overview of all the Mathsy commands. The "BOOLEAN" and "NOBOOL" commands turn the Boolean mode on of off. In the Boolean mode commands such as "+ ? * / ** NEG ROL ROR SHL SHR" perform bit manipulations, logical operations, and rotate and shift bits within words. Array operators modify arrays by either performing specific operations (e.g., ABS, EXP, INV, LOG, LN, MAX, MIN, MOD, NEG, SQRT, COS, SIN, TAN, ACOS, ASIN, ATAN, COSH, SINH, TANH) or by combining two arrays or an array and a scalar (e.g., + ? * / **.). In addition to all the standard Fortran operations there are many others. The special function commands like "ERF" (error function), "ERFC" (complementary error function! "CHYPG" (the confluent hypergeometric function), "BESSJ" (Bessel function, 1st kind). "BESSY" (Bessel function, 2nd kind), and "VOIGT" (Voigt function) allow many other functions to be generated easily. The "VAX" command allows arrays other than the Y array to be used as the working space "Y AXA*A" in line 64 makes A the working array, then multiplies by itself. This could have been done with "A*A A=" or "A**2 A="; both move A into Y, square Y, and then move Y intoA. YAXA*A is faster. "NOSAVE"' and "SAVE" are used in conjunction with the "DIM" (dimension) command NOSAVE indicate that when any DIM is executed, all arrays are to be destroyed and the Y array is to be initialized to the specified number of raws and columns. SAVE indicates that when any DIM is executed no arrays are destroyed, but all arrays are now to be treated with the newly specified number of rows and columns. The first time an array is mentioned space is dynamically allocated for it in accordance with the present array dimension. Arrays can be reordered by ranking them from the smallest to the largest value (ORDER), by randomly rearranging the values (RANDO) by rotating or shifting each row (ROR ROL SHL SHR), by reflecting each row (REFL|, by transposing (TRANS), and by moving (MOVE). "MOVE" allowsthe beginning of an array to be moral to another part of it. The data that is being moved can be averaged, stepped across (eg,, every third row), or transposed. Functional approxiniation can be done with "FFT" (Fast Fourier Transform) and fitting commands. Poly-nomial least squared fits to each row of an array are done with else command "FIT n", where n is the poly-nomial degree desired. "FITF" allows fitting to arbitrary functions such as aF(x) + bG(x). (The coefficients a and b are available as well as the fitted function) Fitting can also be done using the B-spline method. The display commands allow linear and logarithmic horizontal and vertical axes enable a number of pictures to be displayed simultaneously, and provide different ways of displaying the same data (e.g. nonhidden, hidden, contours, gray level front, and degree). Arrays that have more than one row can be thought of as surfaces or families of curves. These pictures can be rotated to help visualise and understand the data. Unless instructed not to, MATHSY displays graphucally on the TV monitor. There are also commands allowing the data to be displayed numerically, and allowing other text labels to be displayed. "GRAY" level uses various degrees of gray to indicate density. "FRONT , xr, yr, zr, xt, yt, zt, xs, ys, zs" rotates, translates and scales surfaces about and along the x, y and z axes in the order shown. "DEG de" specifies the viewing angle on the TV monitor, small "de" values permit one to "zoom" in on a surface. Data can be read into MATHSY from disk Files or from a keyboard terminal. Results can be stored on disk files, and any pictures generated can be displayed on a TV monitor or plotted on film or paper. Color commands permit color film to be generated. Although programs can be generated and written to disk using MATHSY. the usual procedure is to use an editor to generate a program on disk and then read it into MATHSY using the "RMAC" (read macros) command. A "FORMAT (. . .)" command specifies a standard Fortran format. These are used for displaying numerical information on a TV, on a terminal, or for reading or writing disk files. "TVX" and ''TVY" specify where to begin displaying characters on the TV. "WTV f, n" displays on the TV with format f, using the first n data values of the working array. "TVCX" arid "TVCY" are used to change the TVX and TVY values. In addition to the basic MATHSY commands, the user can define any commands (macros) be desires. User-defined commands can be called by other user-defined commands and can have arguments. A user-defined command can be repeated a specified number of times by using the form "XXX, n." (XXX is a user-defined command and n is the number of times it is to be repeated.) An example is the "BCS1,, :NQ" in line 52. The "IF" command stops a user-defined command if the specified condition is not met. Thus, if the user-defined command "ABC, 100" has been given and ABC contains an IF, execution of ABC will stop at any point if the IF test fails. The commands "PAUSE" and "GO" allow the user to run his program to a PAUSE, examine any array or scalar he desires, and then continue with GO. Since entire arrays are displayed graphically, programming errors are usually found easily. Extract: Discussion Discussion In the preceding sections we have attempted to give a didactic overview of the computer language Mathsy. Due to the nonexistence of published documentation our presentation was slanted toward a user's description of the language. As a noatrivial example of solving a complex physical problem which embodies some of the more geometric and data manipulative Mathsy commands, we introduced the density of states spectral problem in solid state physics. Mathy's conciseness, readability, and its ability to allow the user to visualize, better yet, geometrize the command-to-command transformations of a program enabled the authors to develop the LATSPEC algorithm. Mathsy enables researchers at the Lawrence Livermore Laboratory to complete their programming tasks in a much more adroit and efficient manner than they could have in Fortran. This is due to the fact that no program compilation is necessary, graphics routines are already interfaced, program debugging is easy (compared to other languages), the language is extremely powerful, thereby making programs relatively short (about 1/10 the size of Fortran programs), and new commands are easily defined by using basic Mathsy or other user-defined commands. Mathsy is capable of using just about any input-output computer facility and graphics routine available at the Lawrence Livermore Laboratory. Currently operative on the CDC 7600, it is being adapted to the PDP 11/70 and the CRAY-I. Two other computer languages which have some features similar to Mathsy are SPEAKEASY and LG. The crosses (x) in Table I indicate which of these are common to each other.
In addition to the differences annotated here there are also philosophical differences. SPEAKEASY seems to be a concatenation of library commands, accessed by a more complex language than Mathsy. Although it is an array processing language, its algebraic rules on 2-D arrays are different from those on vectors. Mathsy, while contaimng a respectable number of library commands, stresses the use of operational transformations. This enables it to be an effective scientific language, as well as a data manipulator, without requiring the command library to forever keep expanding. Its algebraic rules in one and two dimensions do not require distinct sets of commands. LG is not an all-purpose language, as are Mathsy and SPEAKEASY. It is a language specifically constructed to do analytic geometry. in [ACM] CACM 23(08) August 1980 view details in [ACM] CACM 23(08) August 1980 view details in [ACM] CACM 23(08) August 1980 view details |