XXIV. COMPUTATION RESEARCH Research Staff Martha M. Pennell T. H. Brooks A. Gail M. Fratar Veronica E. McLoud R. M. Nacamuli A COMPUTER INDEXING PROGRAM Chemical Titles) which have been Today there are several indexes (e. g. , KWIC, prepared essentially by computer techniques. For the most part the computer pro- grams involved are too sophisticated to be used for indexing a small number of titles such as would be found in one's personal library or that of a small research group. We have written a computer program that permutes and alphabetizes the key words in a title of, at most, 132 characters for a maximum of 70 titles. The index obtained consists of entries 132 characters wide with the key word made to lie in column 67 and the rest of the title shifted and folded over if it extends beyond the allotted length. The most difficult obstacle to overcome in such a program is to define what is meant by a key word. In our program a key word was said to have at least four letters. After alphabetization those entries in the index whose key words were not of interest were manually discarded. Such a method is possible only if the number of titles is small. Some other indexing programs have used a table of non-key words which the program referred to each time. Such a method has the disadvantage that titles consisting of non- key words are ignored. Moreover, if several groups with diverse interests are to use such a program, the table of non-key words changes radically and must be reconstructed each time. Thus far, we have indexed 212 titles with the following results: Output 1555 Acceptable titles 1275 title s 286 Unacceptable titles Number of acceptable key words 75 Average occurrence 3.73 Percentage of unacceptable titles 8% The program is now being used to help update "Basic Data."' Martha M. (U. S. Pennell, R. M. Nacamuli This work was supported in part by the Joint Services Electronics Programs Army, U. S. Navy, and U. S. Air Force) under Contract DA 36-039-AMC-03200(E). QPR No. 82 293 (XXIV. COMPUTATION RESEARCH) References 1. S. C. Brown, Quarterly Progress Report No. 80, Research Laboratory of Electronics, M.I.T., January 15, 1966, pp. 83-85. B. EXAMPLE OF SYMBOLIC MANIPULATION OF POLYNOMIALS IN MAD The ease of solution of numerical problems by means of a digital computer is often lessened by necessary prior tedious mathematical manipulations such as the example discussed here, the multiplication of polynomials. The problem from which this example arose is the following. Let x = sin 0 cos c, y = sin 0 sin w1 = x 4 +y4 + - 3/5 w2 = - 15/11[x4 +y4+ 3 = x8 +6 + y8 + 4, z = cos 0 (1) ]+ 30/77 8 - 28/15[x6 +y6+z6 ] + 154/143[x4 +y4+z 4 (2) ] 7/39. Let f(x, y, z) be a product of 2 to 4 factors each of which is wl, w 2 or w 3 . to evaluate integrals of the form d f(x, y, z) sin 0 dO. We want (3) We can approach the problem in two ways, either by numerical approximation or formal integration. The latter method, which is preferable, would involve so much tedious algebra to expand the product f(x, y, z) that it would be futile to attempt it unless the process could be mechanized. Investigation proved that this could be done quite easily. Our problem is to find an algorithm that will construct symbolically the product P(x,y, z) - Q(x,y,z), where P,Q are polynomials in x,y, z. If n is the highest power of x,y, z occurring in P, then P can be represented by the (n+1) X (n+1)X(n+1) array P1, where PI(I,J,K) is the value of the coefficient of the term P(x,y, z) in which the powers of x,y, z are I, J, K, respectively. If m is the highest power of x,y,z occurring in Q, then Q can be defined similarly by an (m+l) X (m+1) X (m+1) array Q1. If we define a new array ANS, where ANS(I',J',K') is the coefficient of the term of the product P(x,y,z) - Q(x,y,z) in which the powers of x, y, z are I', J', K', QPR No. 82 294 then COMPUTATION RESEARCH) (XXIV. Pl(I,J,K) - Q (II, JJ, KK). ANS(I', J', K') = I+II=I' J+JJ=J' K+KK=K' This algorithm was programmed in the MAD 1 language as listed below. Y1,Z1 are the maximum powers of x,y, z in P(x,y, z), Here X1, and X2,Y2, Z2 are the maximum powers of x, y, z occurring in Q(x, y, z). , 1, 1,9ZI, XC, -,2 :7 77t L FUNtCTIi (P ,I ,t E 'C [ULT. I TEG E I ,J ,K ,I I ,JJ ,KK,X1 ,YI1 , 1 ,X ,YZ T'H ZERO, ZELO LCOP FOR I=, I.0. (Xl+X+1)*(Y 1 ) +Ye+1)*(ZI+L +) PNS (I) C. T'T LCCOP, TCF I-C,!,I.G.XLOCP,FO J=C, 1,J.G.Y 1 T' T'. LCCP, FCF K-C, ,I.0.Z11 FC, % II=C,1,I.C.X T L 1,J.C.Y2 'il LCCP, FOF jJ, a..Z2 T'l. LOOP, FOE KK:OC,1, / ~S (T+1I ,J+JJ ,i i) (1+1I+ ,.1 -A , K)+P 1 ( , ) I (II ,JJ ,KK) I F'lUCTICE FTUF< The routine may be called repeatedly if the product of more than two polynomials (2) is desired. From (1) the powers of sin 0, cos 0, sin 4, cos ) in the term whose coefficient is ANS(I', J', K') are easily obtained. The desired integration (3) can now be performed analytically term by term with the use of the recurrence relation sin S x cos in cs x dx xd n-1 sinSm+l x cos xx + m+n nn - m + n . m x cos n-2 sin x dx, m,n > 0. The calling program and the subroutine were debugged and run on the time-sharing system at the Computation Center, M. I. T. Veronica E. McLoud, Martha M. Pennell References 1. B. Arden, B. Galler and R. Graham, sity of Michigan, April 1965. QPR No. 82 "The Michigan Algorithm Decoder," Univer- 295