MUI Calc 1.25 by Robert Poole 1. What is it? MUI Calc is a calculator program for the Workbench (or other public screen) that utilizes Stefan Stuntz's Magic User Interface (or MUI for short). It's an RPN calculator with a stack shown in a listview gadget which can be as deep as available memory. Why another calculator program? (1) The one that comes with Workbench is simplistic. (2) IntuiCalc, the replacement of choice, causes severe Enforcer hits.* (3) I needed to teach myself some basic features of MUI programming. (4) MCalc 1.1, also known as MuiProCalc 1.1, is an atrocious example of MUI programming. I felt obligated to offer a much improved version of my own program as an alternative to MuiProCalc.** I think you'll find the interface of my program to be much less arcane and confusing. * Since I first released MUI Calc 1.0, the author of IntuiCalc came out with an "IntuiCalc-MUI," which is functionally identical to the original IntuiCalc but uses MUI for the user interface. I can't find any Enforcer hits in the new program. Still, I prefer this style of calculator to the kind that IntuiCalc offers. The original version of IntuiCalc-MUI had a bug in his interface which made it impossible to enter the digit '8' from the keyboard! This has been fixed in IntuiCalc-MUI 1.1. I still don't like the interface for a number of reasons, but this is mostly personal bias, tempered with my understanding of GUI design. ** I find it amusing that there was an explosion of calculator programs after I released MUI Calc 1.0. I also wonder at the author of MuiProCalc 1.1, who named the archive MCalc11.lha, so similar to the name of the Aminet archive of MUI Calc 1.0. Coincidence? You be the judge. At any rate, I have bumped my revision number past 1.2 to avoid any confusion with MuiProCalc. At any rate, MCalc 1.3 appeared on Aminet recently, and I tried it out. It still stinks. I was tempted to give this new version of MUI Calc a version number beyond 1.3 to stay "ahead" of MCalc, and to continue avoiding confusion, but I decided that this would be stupid. 2. What is this RPN stuff anyway? Reverse Polish Notation. So called because this famous Polish mathematician (Jan Lukasiewicz, but with a / through the L, so that it is pronounced something like Wookashye'veech) invented a notation which requires no parentheses. He used a kind of prefix notation, where the operation precedes the operands. Most calculators in the HP vein use a postfix notation, hence the "Reverse" part. (If it weren't for the HP28 Owner's Manual, I'd never be able to remember this guy's name.) Therefore, to use the calculator, you enter operands on the stack and then select the operation. For instance, 5 ENTER 6 ENTER + will put 5 on the stack, then 6, and then add them, leaving the result (11, hopefully) on the stack. 3. OK, so this calculator is sort of like an HP calculator. How is it *not* like an HP? Please note that this calculator, like the HP28S and its successors, uses a strict postfix notation. Earlier HP calculators used prefix notation for certain special functions, such as STO. Unline the HP28S and its successors, this calculator doesn't offer programmability and non-float data types. Go buy an HP48G or GX if you need either of those features, or buy Maple V. 4. Is there any weird behavior I should know about? Some of the stack operations require multiselection of items; for other stack operations, this is optional. SWAP requires you to multiselect exactly two elements in the stack to swap. You must shift-mouseclick on each of them, since in MUI applications, the listview gadget makes a distinction between the "active" item and "selected" items. (Merely clicking on an item will only make it active, not selected.) (Yes, I know, there is an option available to the programmer to automatically make the active element selected as well. I didn't think this was appropriate.) DUP doesn't require you to select an element to duplicate; it defaults to the bottom element on the stack. If you do select an element, though, that one will get duplicated. Multiselecting several items to duplicate will work just fine. ROLL takes the "top" element of the stack and rotates it down to the bottom. Please note that this stack is built by inserting elements at the physical bottom, meaning that the bottom of the stack is logically the top. If this seems confusing, just play with the calculator, all shall become clear. 5. Can you clarify the logarithmic notation you use? Sure. There's been a lot of confusion in the math community lately over what notation to use. I guess now the standard is "log" to denote the natural log; subscripts are used for all bases aside from e. However, I learned the notation "ln" for natural log early on, and that's what I've stuck with because it makes a little more sense. I guess slide rules and tables of logarithms aren't too hip anymore, so "log" for log base 10 has fallen into disfavor; however, that's the convention I use as well. As for "lg," that denotes log base 2, which many computer scientists out there might recognize. "exp" denotes the exponential, e raised to the x power. All other exponential functions, such as 2^x or 10^x, can be done by entering the arguments onto the stack and using the x^y button. (Note: the base is pushed onto the stack first, then the exponent.) 6. Hey! How come when I try to find 8!, I get 40319.99999206 instead of 40320? Simple. The x! function on the calculator is actually computing Gamma(x + 1). I suppose I could put in a special case to test for integer arguments, but this calculator treats everything as floats anyway, so why give special treatment to pseudo-integers for one special function? At any rate, x! will overflow the limits of a double precision float when x > 170, and probably isn't completely reliable for x > 30. For big values, you should be computing a function which is actually log(Gamma(x)), but I haven't implemented that -- this is supposed to be a desk calculator with some scientific functions. Well, OK, a lot of scientific functions. Just be happy I gave you an x! which works over all reals (except negative integers). 7. Is this program Shareware or what? This version of MUI Calc is giftware. Version 1.0 really wasn't worth money whatsoever. Version 1.25 is much more cleanly written, has many more features, and to be honest, is probably far worthier of distribution. Still, I can't expect people to pay serious money for it. So... Tell you what. I'd be happy to get postcards, letters, you name it. I like hearing from people. A contribution of US$5 (or more, I'm not one to refuse charity) will be most welcome. Hey, I'm a starving grad student. :-) Please don't send cash though for obvious reasons. Future versions of MUI Calc will probably be rewritten in C++ to take advantage of the reuse of code. 8. What's new since version 1.0? Lots of stuff. The program has been recompiled using the MUI 2.0 includes. I've improved much of the basic logic of the program, such as the formatting of numbers being printed on the stack. I now use a paging group to swap in sets of buttons which perform different mathematical functions (trig, log, etc.) The contents of the stack can be printed, either to PRT: or to another device or file. I stripped out all debugging information, removed code dependent on stdio, and enabled optimization for size, chopping executable size in half. (What a gas, I add more functionality and get a smaller program in the bargain.) I now use a custom image for the iconified state. I also threw in more sanity checks. (You can still crash it if you try hard enough. I'm not going to tell you how.) Oh, yes, it auto-detaches from the CLI now. 9. How do I contact the author? Mail: Robert Poole 300 South Street Apt. G5 Vernon, CT 06066 U.S.A. Email: pooler@rpi.edu 10. Distribution I specifically grant distribution rights to Fred Fish, for inclusion in his CD-ROM collection. This package is freely distributable providing that all files found in this archive are included. That means the binary executable muicalc, the documentation (this file), MUI.readme, and all associated icons and support files. 11. Legal Stuff MUI Calc is Copyright © 1993, 1994 by Robert Poole, all rights reserved. MUI is Copyright © 1993, 1994 Stefan Stuntz. All other copyrights and trademarks belong to their respective owners.