******* SIM_EQ v1.0 ******* 3/28/89 WHAT IT DOES SIM_EQ.PRG solves linear simultaneous equations. It allows input of coefficients and constants, allows you to edit any errors, then solves the set, printing to the screen. It allows either a printed output of just the solution vector, or of the set of coefficients entered and the solution vector. It will also allow the data to be saved to disk in ASCII in either tabular form, so that it can be loaded into a word processor, etc., or as DATA statements. And finally it allows you to go back to the data you entered, change a few numbers, and run it again. HOW YOU USE IT You've solved an engineering problem and now you have a set of linear simultaneous equations sitting in front of you, written either as equations or in matrix form. No sweat. You fire up SIM_EQ. You probably won't need these, but here follows long instructions.... How many equations..? First, answer this prompt and tell the program how many equations you have... up to 15 or 20 should be OK. (Incidentally, if you want to bail out of the program, you can enter a "q" or a "Q" at almost any prompt...) After hitting a short explanation screen appears; read it, then for more information on the program, or hit to get started. Enter your data: Now you start entering the coefficients of your equations, one at a time. The prompts refer to the conventional way of subscripting terms in a set of equations: The first subscript refers to the ROW, the second subscript refers to the COLUMN. Thus C(2,4) is the fourth coefficient in the second equation. Also, the constant term in each equation is subscripted with the equation (ROW) number; thus R(3) is the constant term in the third equation. In equation form, then, the coefficients and constants would look like this: C(1,1)*X(1) + C(1,2)*X(2) + . . . +C(1,n)*X(n) = R(1) C(2,1)*X(1) + C(2,2)*X(2) + . . . +C(2,n)*X(n) = R(2) . . . . . . . . C(n,1)*X(1) + C(n,2)*X(2) + . . . +C(n,n)*X(n) = R(n) So when entering the data you will just enter your equation 1, then equation 2, etc. Error entering data: So you're entering 12 equations in scientific notation, 6-digit precision, and on the ninth one you enter a wrong number... Hey, DON'T WORRY! You can fix it LATER! Just remember which equation has the bad term, and continue entering your data. Edit the data: When the last constant R(n) has been entered, you will be asked if everything is correct. A "Y" will solve the equations and print the result to the screen. A "N" will start the "editor". Here you can call up each equation and modify it. You will first be asked which equation needs work, then that equation will be listed, and you will then be asked which term to change. Just follow the prompts. If you didn't mean to be here, and you want to get out quickly, enter an "X". Solve the set: Now, finally, you're sure you've entered the equations right. When it asks "Is everything right?", hit a "Y" and it will solve the equations, and print the solution to the screen. Now that the results are on the screen, you can print them or save them or both or neither... just follow the prompts. Don't worry, you can always get back into the main part of the program from anywhere. So after you, say, print the results, you can save them, then change inputs and save them again, etc. The order in which these things are done is not important. Print the results: If you want to print the results on paper, first hit a

, then follow the prompts... you may print just the solution (hit ), or print out all the coefficients as well as the solution (hit ). There is no fancy formatting in the print-out as I wanted to be sure no one's printer would be left out. (Up to a six- equation set and its solution will print on a single standard page of 66 lines.) Save the results: If you want to save the results to disk, first hit an . A page will appear which explains the options. Saving will always save both the coefficients you entered as well as the calculated solution in straight ASCII format. First, select the layout you want the data saved in, then you will get a file selector box. If you hit , the data will be saved in a tabular layout, with the coefficient names as well as their values, like the printed output. In other words, the ASCII file will look like: SOLUTION 1: 2 SIMULTANEOUS EQUATIONS ---------------- Equation 1 C(1,1) = 23 C(1,2) = -38.5 R(1) = 2.0E-12 ---------------- Equation 2 C(2,1) = 4.6 C(2,2) = 0.34 R(2) = 7 ================ Solution X(1) = 1.4573869782 X(2) = 0.87064676617 This might be useful if you want to play around getting a pretty printed format through your word processor or DTP program, or you want to include the info in a document, or you just want to double-check your inputs carefully. If, instead, you hit , the data will be saved as DATA statements, as used in BASIC. This is so you can re-use the information in your own BASIC programs, and won't have to type all those numbers again. The file includes some comments, and looks like this: ' SOLUTION 2: 2 SIMULTANEOUS EQUATIONS ' Coefficients DATA 23, -38.5, 2.0E-12 DATA 4.6, 0.34, 7 ' Solution DATA 1.4573869782, 0.87064676617 Next, a file selector box will open with a default filename of either SOLUTION.EQ. (for the tabular layout) or SOLUTION.DTA (for the DATA statement layout). If you click on OK, a file by this name will be created and the data will be saved. You may use any filename you want, of course. If the filename you click on already exists, that file will be opened and the data will be appended to it. (BE CAREFUL!) Thus you can keep clicking on the same filename and all data from successive runs will be saved in one file, which can be convenient. Also, you can save twice; once in tabular layout and once in DATA statement layout.... Pathnames for the two files will be remembered separately by the program. Change the numbers & do it again: After printing (or not) or saving, or both, or not, or whatever, you may go back to the "editor" and change terms, so that you can do some primitive "What If" stuff without re-entering the entire set of equations. However, if you want to change the number of equations, you will have to quit the program and restart it, as GFA doesn't like to re-dimension it's arrays (can't blame it!).... Play around a little. It's not a fancy program, and is certainly a little clumsy compared to some. But it is simple and fast and it works fine. WHY? While an engineering undergraduate, I found that there were many times that I needed a quick solution to a set of linear simultaneous equations. Cramer's rule, row reduction methods, matrix inversion, etc., were OK for small sets (like 3 equations). But they're real grunt work and subject to error. So I wrote a little Gauss elimination program for my Commodore 64, and it proved very useful, even though it had no facility for editing input! This is essentially the same program, with a pivot element maximizing scheme added, and with some bells & whistles, and compiled in GFA Basic 2.0. (I have 3.0 also, but used 2.0 because it has the compiler.) The file selector box was really somewhat clumsy to get to do everything that I wanted, but I think it's OK now. The program works fine for what it is. The source is ugly, embarrassing spagetti and is not included, but if you really do want it, please leave me E-mail (GEnie - J.KLEISER) and I'll try to get it to you. Also, please let me know if there is any problem with it, and let me know of any suggestions you might have. After all, it's all fur fun, right? James D. Kleiser 1100 15th St. #229 Sparks, NV 89431