TRIGMAN(ID:2587/tri003)celestial mathematics systemA system for solving problems in celestial mechanics using symbolic maths. A preprocessor written in SNOBOL 4 created FORTRANIV output. THe terminolgy is borrowed from Weizenbaum's SLIP, rather than SNOBOL or LISP or FLIP From the Quasar page: "Also in 1966, Jefferys was lured to The University of Texas at Austin by Harlan Smith, to join an astronomy department with a rapidly developing first-class faculty. At Texas, Jefferys continued exploring dynamical systems. He applied his work not only to solar system objects, but also to galactic dynamics and to the dynamical stability of star clusters. He has a philosophical attitude toward the challenge of dynamical systems. 'The most interesting problems are always the ones that are the hardest,' he said. Jefferys also became interested in solving algebraic and calculus problems with computers. Calculations in celestial mechanics require extensive amounts of algebra. Jefferys designed a programming system, which alleviated the tedium in calculating these formulae, thus accelerating the work. This programming system, called TRIGMAN, was essentially finished by 1970. It is still used in celestial mechanics studies." Structures: Samples: References: feasable, as well as popular, to use them for manipulating the symbolic expressions which arise in Celestial Mechanics. One of the most important types of expressions is the (truncated) Poisson series, that is, a sum of terms of the form (Polynomial in several arguments). (sine or cosine in a linear combination of several angles with integer coefficients). (1) Besides the fact that they arise frequently in Celestial Mechanics, Poisson series have several properties of importance for symbolic manipulation. The results of addition, subtraction, multiplication and differentiation (with respect to any of the variables) of Poisson series are again Poisson series; if the polynomial arguments are raised to non-negative powers, this also holds for the result of substituting one Poisson series for one of the polynomial arguments of another, and for the case of integration with respect to a polynomial argument. Integration with respect to a trigonometric argument also results in a Poisson series if the original series contains no terms which are constant with respect to that argument (i.e., the 'periodic part' of the series). Finally, a Poisson series is obtained if a substitution of one series for an angular variable in another series is made by means of an expansion in (truncated) power series. A number of systems for the automated manipulation of algebraic expressions in Celestial Mechanics have now been developed (Barton, 1966 ; Chapront and Mangeney- Ghertzman, 1968 ; Rom, 1970, 197 1 ; Jefferys, 1970a, b). They have been applied to a variety of interesting problems. All of these systems are programmed for an application in the same basic way: A series of calls to the appropriate subroutines in the formula manipulation package is written, and the program is then compiled (e.g., with the local FORTRAN compiler) to produce an object program for execution. For example, a program to generate Legendre polynomials in the function E*COS (U) might be written for the TRIGMAN subroutine package as follows: DIMENSION P(11) CALL INIT (0,1,1) CALL TERM (1.0, 2HE., 3HCOS, 2HU., X) CALL CONST (1.0, P(1)) CALL TRIGADD (ZERO, X, P(2)) DO 1 1=2,10 CALL RATDEF (2*1- 1,1, COEFF) CALL TRIGMPY (COEFF, X, P(I), TEMP) CALL RATDEF (I- 1, I, COEFF) CALL TSCMPY (COEFF, P(I- l), TEMP2) CALL TRIGSUB (TEMP, TEMP2, P(I+ I)) CALL OUTPUT (IHP, P(I+ 1)) END In this program, INIT initializes the routines, TERM creates a series, as specified, CONST creates a constant series, RATDEF creates a rational multiplier, and the rest of the program should be fairly intelligible as a prescription for the recursion relationship for Legendre polynomials, if it is remembered that because FORTRAN arrays start with a subscript 1 instead of 0, it has been necessary to depart from the standard labelling for Legendre polynomials. As shown by the example, a typical program written for the TRIGMAN system consists of a sequence of calls to the needed subroutines, plus a few additional statements to control the flow of the program. It is cumbersome to write, more difficult than need be to debug, and the meaning of the individual steps is greatly obscured. It is not intolerable to have to live with these drawbacks, but a preferable route would be to invent a higher-level language in which it is easier to express ones problem, and to write a translator or precompiler which takes a program written in this higher level language and rewrites it so that it will be acceptable to the local compiler. Such a program has now been written for use with the TRIGMAN system. It is relatively short (about 500 lines of code) and is written in the string processing language SNOBOL. Since SNOBOL is available on many modern machines, it is to be expected that the precompiler could easily be adapted for other formula manipulation systems. To demonstrate the improved appearance and readability of a program, one can now write the example above as follows: POLY E TRIG U SERIES P(1 I), X P(l)= 1 P(2) = E*COS (U) X= P(2) DO 1 1=2,10 P(I+ 1) = (2*I- l)/I*P(I)*X- (I- l)/I*P(I- 1) 1 OUTPUT P(I+ 1) END The first two lines declare the variable letters E and U, while the third declares the variable P to be an array whose values are series. The rest of the program is selfexplanatory. Extract: Declaration Statements - POLY, TRIG, SERIES Declaration Statements There are three declaration statements available in addition to the usual ones of FORTRAN IV. The POLY declaration is followed by a list of up to twenty-nine variable names, separated by commas, which will be interpreted as the polynomial variable letters in all series. In addition, each variable name may be followed by an optional nonnegative integer, enclosed within parentheses, which will be interpreted as the order of the corresponding variable, for purposes of series truncation. For example, the statement POLY E, ALPHA(2), GAMMA tells the compiler that E, ALPHA and GAMMA are to be interpreted as polynomial variables in the program, and that ALPHA is of second order (i.e., if the parameter which controls truncation is set at 5, then terms in ALPHA**2 will not be dropped, while terms in ALPHA**3 or ALPHA**2*E**2 will be). The TRIG declaration is followed by a list of up to ten variable names, which will be interpreted as trigonometric variable letters in the program. A typical statement might be TRIG L, U, OMEGA. The POLY and TRIG statements are given before any others and are effective in all of the subprograms which may be compiled. It should be clear that the variables declared in these two statements stand for themselves and can not be assigned other values (i.e., they are atomic variables). The SERIES declaration names variables in a subprogram which the compiler is to interpret as having values which are series. Each name in the list may be followed by an optional array specification (and if this is done, a DIMENSION statement will be compiled). For example, the statement SERIES F(10), G(10, 20), TEMP declares F, G and TEMP to be series-valued variables, and in addition compiles a statement of the form DIMENSION F(lO), G(10, 20). The SERIES declaration is only effective within a given subprogram. Extract: Making Formula Manipulation Systems in Celestial Mechanics Easier to Use Making Formula Manipulation Systems in Celestial Mechanics Easier to Use The TRIGMAN system has been available for some time now at the University of Texas and has been used on a number of problems. Many students have spent the effort required to learn it, despite the clumsiness of its original form. Now there is available a much simpler and more natural way to express problems for the system, and it is expected that TRIGMAN will enjoy even wider use than in the past. As long as one is writing a system solely for use within a limited group, there is probably no need to go to this trouble. Even here, however, the convenience and clarity gained may be a great boon. On the other hand, when a system is to be made available to the general public, it is my feeling that an effort should be made to create an easy-to-use system. To be sure, if an outsider is desperate enough, he will use anything, but then the question becomes, "what is desperate enough?" The use a system gets will increase as it becomes easier to employ. Fortunately, the TRIGRUN compiler is now available, and while not perfect, it shows how easily this goal can be accomplished. In fact, it was written in about a month of spare time, and the speed with which this was accomplished is indicative of how suitable SNOBOL is to the task. Now, SNOBOL is itself an imperfect tool, its principle drawback being that programs written in it tend to be rather slow (we compile about 20 statements per second with TRIGRUN). Even this time, however, is small compared with the length of time it takes to execute the compiled program, and is no real drawback. Again, the compiler is not the most efficient one in terms of the code generated; this can be improved, but a few simple rules (if obeyed by the programmer) can overcome much of this drawback, too. There is an alternative method for making formula manipulation systems easier to use, and that is to write an interpreter-based system. The interpreter takes the user's code, written in a suitable language, and executes it as a part of the translation process. Interpreters (if they are good) may take longer to write, but there can be certain advantages, too, such as built-in debugging and tracing facilities which would be difficult to implement in a compiler-based system. Additionally, an interpretive system is the best one for conversational algebraic manipulation, a mode of operation which can have distinct advantages (Campbell and Hearn 1970). The author is currently investigating the feasibility of developing such a system for use in celestial mechanics. in E.W. Ng (ed) "Symbolic & Algebraic Computation Proceedings of EUROSAM 79" Springer-Verlag, Berlin, 1979 view details in E.W. Ng (ed) "Symbolic & Algebraic Computation Proceedings of EUROSAM 79" Springer-Verlag, Berlin, 1979 view details Resources
|