Titan File #11 Joseph K. Horn <53> "SYMBOLIX" is here! The HP-28’s ability to perform symbolic math impresses everyone who sees it (except Harry Bertuccelli?), AS LONG AS it’s one of the examples from the book, or something equally simple. Don’t try to impress anybody with a "real" problem, because you will cause the HP-28 either to go comatose, or to run out of memory, neither of which is impressive. But some of us don’t want to impress anybody; we just want the job done. If that’s your reason for shelving your HP-71 and forking out a laughable cut of your salary for an HP-28, forget it! The HP-71 can do symbolic math too! AND BETTER THAN THE HP-28! (You may want an HP-28 for its other features, however, like its excellent stack logic & display.) A "freeware" program called "SYMBOLIX" gives your HP-71 the ability not only to perform full symbolic algebra and derivation, like the HP-28, but also FULL symbolic integration (not only on polynomials)! The problem that Harry said couldn’t be done on the HP-28 "in less than 10 minutes" (a tremendous exaggeration) is performed by SYMBOLIX in just over one minute, with exactly the answer that he wanted! (Cf. HPX V1 N1 P12 first line) That’s not bad, considering that it’s written ENTIRELY in HP- 71 BASIC (no lexfiles or ROMs required). The listing is NOT published here, because it is 20K long, and takes forever to type in, not to mention the time it takes to find bugs caused by bad typing. Most of the 644 program lines are full length, and many are too long to type in (they were entered by Monkey Business techniques). It’s freeware, but is copyrighted with all rights reserved, so don’t get ideas of making a ROM out of it. It’s an HP-71 re- write of a program written by The Soft Warehouse for the Atari computer in 1982, and therefore I cannot charge for it NOR can I allow others to profit ($$) from it. It is PRIVATE, and even if you bust that, you still won’t be able to LIST it (more Monkey Business). If you like it, RUN it; if you don’t like it, PURGE it. Don’t even try to modify it; ANY modification at all will decompile the GOTO/GOSUB offsets, and it won’t run. (There are no line numbers. They are removed by ... some Monkey Business!). A full set of instructions will be included with your copy of SYMBOLIX. To whet your appetite, here are its features: ALGEBRAIC EXPANSION & SIMPLIFICATION. Example: (2X^2Y+3Z)^3 returns 8X^6Y^3+36X^4Y^2Z+54X^2YZ^2+27Z^3 (that’s Harry’s example!). This is what the HP-28 SHOULD do when you press EXPAND. SYMBOLIC AND CONSTANT VARIABLE ASSIGNMENT. Example: E=EXP(1) sets the variable E equal to the constant "e". N=B/C sets the variable N equal to "B/C", and then, whenever B & C change, N changes accordingly! Self-referential and circular assignments are possible. This is the same as the HP-28’s STO function. ALGEBRAIC EXPANSION OPTION. Turn on/off expansion of product logs into log sums, and trig functions into sines and cosines. Example: after performing the E=EXP(1) assignment mentioned above, then LOG(EA^2) returns 2LOGA+1. The HP-28 does not offer this option; it either always does it, or never does, depending on the function. HARMONIC EXPANSION OPTION. Turn on/off expansion of sine & cosine products and powers into angle sum or multiple angle identities. Example: SINA^3 returns .25COS(3A)+.75COSA. The HP-28 does not offer this option either. PARTIAL DERIVATIVES. Example: AX^3+SINX %X ("%X" means "derive with respect to X") returns 3AX^2+COSX. The HP-28 does this quite well. But I never got it to do SINX/X %X (it always ran out of memory after thinking for a long time), but SYMBOLIX gets - SINX/(X^2)+COSX/X right away. ANTIDERIVATIVES (INTEGRALS). Example: 4X^3-2X $X ("$X" means "integrate with respect to X") returns X^4-X^2. The HP-28 performs this on polynomials quite well. But it can’t do it to non-polynomials, which SYMBOLIX handles just fine. Example: COS(LOGX)/X $X returns SINLOGX. The re-write from Atari to HP-71 BASIC involved a few improvements. The trig functions work correctly according to DEGREE or RADIAN mode (in the Atari they were always radians). Atari BASIC does not have ASIN or ACOS; they had to be calculated. The fast HP-71 RMD function replaced a lot of number crunching in the Atari version. Whereas variables are faster than numeric literals in Atari BASIC, the opposite is true in the HP-71, so the "constant" variables were replaced by literals, for speed. It runs faster on the HP-71 than the Atari version runs on the Apple ][e! Sound good? For your FREE copy of SYMBOLIX, send either 16 GOOD mag cards or one GOOD 3.5" disc (no cassette tapes!), a self-addressed envelope with enough postage on it, a request for "SYMBOLIX", and NO MONEY. (Address below). The instructions will be printed on ThinkJet paper kindly donated by Jeremy Smith. COMPUTER GENERATED MAZES "MAZE" is a BASIC program that generates and prints random mazes. They are the simplest type: enter at the top, follow the path, and exit the bottom. Nothing fancy. But it works! To use, just input the desired size (vertical and horizontal dimensions; try 10,10 for starters). The top line will be printed immediately, then the HP-71 will silently calculate the rest of the maze. This may take a lot of time; be patient (10 by 10 takes about 30 seconds). The maze will be printed when all the paths are calculated. Due to the random nature of the maze generation process, it is possible for the calculated maze to be non-solvable (no way out), but the program detects this, and in this case re-runs itself to try all over again. The listing here assumes that you are using a ThinkJet printer. Line 30 assigns to E$ the escape code for a half-line feed. If you are not using the ThinkJet, change line 30 accordingly. Also, the maze is made of ThinkJet character 252, the little square block. If you don’t have a ThinkJet, use some other appropriate character. The two mazes printed here are both 5.5 inches on a side, but differ in character width and line height. The maze with fatter paths used an input of 32,32 in ThinkJet default modes. The maze with skinny paths used an input of 44,58 in compressed mode at 8 lines per inch. Experiment with your printer’s modes and characters! (How about graphics mode?...) SPAGHETTI CODE RULES! Before you ASSIGN "Titan File" TO *, please ponder one thing. "Structured programming" is all the rage these days. "Spaghetti code" has become an epithet. Are the days forever gone when programmers wrote for computers, not teachers? Is there anyone out there who still cares more about the program being as short and fast as possible, than about it being readable by the Computer Science 101 lab assistant? Yes, we’re still here, the die-hards who refuse to sacrifice elegance on the altar of the false god of portability. If it’s good enough to want on another system, it’s worth rewriting for that system. Ergo SYMBOLIX, the worst case of spaghetti code I’ve ever seen. It’s so ugly it’s beautiful. It hasn’t got a single module in it; the program pointer jumps around so much it’s a wonder that it doesn’t fall out. MAZE too is a mess; just read that listing and tell me line-by-line what’s happening! Glorious! I’d like to see it in a structured language, like FORTH! Of course, we’ve seen SYMBOLIX in FORTH; it’s called the HP-28. Need I argue further? Ponder it. Joseph K. Horn <53> 1042 Star Route Orange, CA 92667