Miscellanous Information about k7 Jim Overbeck, January 1997 1. What is k7? k7 is a high precision calculator program that uses text input (rather than using a mouse to press keys on a simulated hand calculator). It evaluates algrebraic expressions and has a crude "programming" capability. Its precision is variable up to 270 binary bits and 60 decimal digits, beyond the capability of a 80X87 floating point processor. k7 comes in two versions: a non-Windows version which has its own fixed size windows, and a Windows 3.1 and 95 version. A complete technical manual may be accessed by clicking "Help" in the Windows version or typing "help" in the non-Windows version. k7 runs on IBM-compatibles with 80386, 80486, or Pentium processors. The non-Windows version probably also runs on an 80286 or 80186, but this has not been verified. 2. What motivated k7? A. Practical engineering calculations that require accurate subtraction of numbers which are very nearly equal. The primary calculations were the optimization of diffraction limited lens designs and the optimization of very accurate control systems. B. Desire for a test bed for a few new software paradigms. The paradigms include: automatic assignment of 2-lettter variable names to numbers automatic re-use of these variable names if a variable name is never referred to simultaneous, nearly transparent calculations in base 2 and base 10 flexible algorithms for algrebraic expression parsing, depending upon user's preferences 3. What are some limitations of k7? A. On-line editing of previously entered lines of text is not available. However k7 dumps its contents into a file which may be edited off-line by any ASCII text editor. The contents of this file may then be read later by k7. B. k7 lacks array variables, names of variables outside a prescribed range, and named entry points. Entry points are identified by sequentially assigned line numbers, as in Fortran or Basic, only worse. C. k7 lacks branching instructions and logical operations. D. k7 lacks local variables within subroutines. All variables are global. E. k7 lacks looping capability. The only instructions provided for doing repeated calculations are "call" (followed by a line number) and "return". 4. Is there a tutorial on how to use k7? Yes and no. Such a tutorial was written and included in a printed manual. Its use of screen images prevented it from being converted to machine readable form for inclusion on this disk. If there is enough demand I will make more copies and distribute them by mail for just enough money to cover copying and postage. Write to k7 Associates, P.O. Box 91, Hingham, MA 02043. But here is an attempt at a tutorial. Say we want to calculate sqrt(1 + (3.5/(50*sqrt(2/ln(2))))**2). **2 means squared in Fortran. You may be used to ^2 in other languages. k7 uses the Fortran convention. There are many ways to calculate this. Use the one which is most comfortable for you. A. Type the expression given above, but replace the period after **2) with a depression of the "Enter" key on your keyboard. B. Do the calcuation in pieces, assigning names, aw, ap, and ar to intermediate results. In the following, the line numbers 0> through 4> are typed by k7 and the rest is typed by you: 0> aw = sqrt(2/ln(2)) 1> ap = 3.5 2> ar = ap/aw 3> sqrt(1 + (ar/50)**2) 4> C. Imagine that for some or all of the steps you are using a HP Reverse Polish calculator. Do not bother to add closing parentheses if they are not really necessary. Type: 0> sqrt(2/ln(2 1> ap = 3.5 2> b/ 3> 50/ 4> **2 5> 1+ 6> sqrt 7> Note that on line 3 the letter b comes from the fact that one sees (when looking at the screen) that k7 automatically assigned the letter b to the result of the calculation on line 0. Similarly it assigned the letter a to the number 2. Note that lines 0 and 1 do not use Reverse Polish, but line 2 through 6 do. Line 0 could instead have been 0> 2 1> 2 2> ln 3> / 4> sqrt 5. Are components of k7 available in a form so that they may be called as subroutines from another program? Also yes and no. This repackaging of k7 was about 90% complete in 1992 when it was pushed aside by a higher priority project. But the subroutine version had some nice features. The primary one was switching between high speed, lower precision (80X87) calculations and the lower speed, higher precision calculation provided by the k7 modules. This was necessary since the target of k7, optimization, requires all the computing speed one can get. Precision beyond that of the 80X87 is only needed at certain critical times, typically when the optimization process is near a local minimum of a cost function. 6. How do I install k7? k7 was written before automated installation and unzipping of files was common. So you do not perform a "modern" operation like running a program named "install.exe." Instead you just copy files. This was very foolproof when there was only the one non-Windows version of k7. Now, with two versions, it is customary, but not necessary, to keep the two versions in separate directories (or separate folders, in current jargon.) On the distribution disk the non-Windows files are in the directory named k7nonwin and the Windows files are in the directory named k7window. The names of the non-Windows files start with k7 and the names of the Windows files start with k7w. 7. The on-line help function in k7 is not what I am used to. What gives? The on-line help function for the Windows version is not "Windows Help." You may click on any line in the index in order to go to the chapter indicated by that line. But these lines are displayed in black, not green. There are no key words such as one normally sees in green when using "Windows Help." 8. The non-Windows version is writing files to disk without my asking it to do so. What gives? Long ago this was not considered to be proper, since one might be running a program which resided on a floppy. If you want to disable the writing of files, type "help" to get to the "Status" screen. Then type 1 to get to the list of help topics. Then 15 to get to its second page. Then 3 to learn more about this. OR: Type "panel" to get to the first control panel screen. Then the letter "a" to get to the second control panel screen. Then the letter "a" again to get to the third control panel screen. Then letter "a" again to get to the fourth such screen. Now combinations of spacebar and tab will enable you to turn logging to disk on or off. Sorry about that. The default setting for the Windows version is to not write files to disk. You may change this by clicking the "Write Logs" entry in the "File" pulldown menu. 9. How do I exit the non-Windows version of k7? Type either "quit" or "exit". I don't know why one would want to use the non-Windows version if you have a computer that is running Windows. 10. On what versions of Windows will the Windows version of k7 run? It runs fine on 3.1 and two versions of 95. It should also run fine on NT. There are occasional crashes on 3.0, but I am convinced these are the fault of 3.0, not k7. 11. Given the extreme limitations in paragraph 3 above, is there any way to do a really complex calculation? Try writing the calculation in a text file, using an ASCII text editor, and using the "Read" option in the "File" pulldown menu (in the Windows version.) Or type "read" followed by a file name in the non-Windows version. Sorry, but there is no guarantee that this "safety valve" will provide you with the power you need. It certainly will not provide you with array variables, or logical operations, for example. The only sensible way to increase the power of k7, I think, is to have its modules be callable from C or C++ programs.