
INTRODUCTION:
=============
C-CALC.EXE is a complex number calculator which uses reverse
polish notation.  Some of its features are as follows:

    - Variable size stack and memory.

    - Macros:
       - Macros can be recorded, read from and written to ASCII
         files
       - Macros can be loaded at the command line

    - Easy complex number entry:
         For example, to enter the complex number 1+2i you enter 1,2.
         The comma indicates the complex number is entered in cartesian
         coordinates. To enter 1 @ 45 degrees, you enter 1d45, the d
         indicates angle in degrees. To enter 1 @ 0.4 radians, you enter
         1r.4, the r indicates angle in radians.  To enter 1 @ 0.25 pi
         radians, you enter 1p.25, the p indicates angle in units of pi
         radians. If you only want to work with real numbers you can
         just enter the number.  For example to enter the number 3 you
         enter 3.

    - Various display options:
         Each entry in the stack is displayed in both cartesian and
         polar forms.  The polar form can be displayed in degrees by
         entering d, in radians by entering r, and in units of pi
         radians by entering p.  The amount of the stack which is
         displayed can be adjusted by using the command
         SetStackDisplaySize.  For example, to set the stack display
         size to 6, you would do this:

               6 <enter>
               SetStackDisplaySize <enter>


MOTIVATION:
===========
MOTIVATIONS for C-CALC.EXE:
 1)
   I taught a class in elementary circuits in which many complex number
   calculations were required.  The complex numbers are generally given
   in both polar and cartesian form.  For example, one often has to add
   two numbers given in polar form. e.g.

       1 @ 45 + 1.2 @ 30

   By 1.2 @ 30 what I mean is the expression

       1.2*exp(i*30*pi/180)

   where i is sqrt(-1) and pi is 3.14159...
   Many calculators allow this to be easily done.  Some allow this to be
   done, but in an inconvenient way.  C-CALC.EXE makes it easy to do
   these types of calculations.

 2)
   I am slightly dislexic.  I often dial wrong phone numbers, enter
   numbers into calculators badly, etc.  In order to do a calculation on
   a calculator, it often takes me 4 or 5 tries before I get the same
   answer a few times.  This program allows me to avoid this.  For
   example to do the following calculation

     39(1.2 - 1.4i)(4 at 2.3 degrees) + sin(pi/3)
     --------------------------------------------     exp(2 - 4i)
        (1000 + 4900i) - (4000 at -0.3 radians)

   I now do something like this.  (This is similar to what is done in
   example2.bat.) I make macro file, I'll call junk.mac, containing the
   following.  (I typically put each number on a separate line, it helps
   me to read it.  Here I put them all on the same line to save space.)

        f1  {@n}{@d}{@f} <0; <1; / <2; *
        @n  39; 1.2,-1.4* 4d2.3* pi; 3/ sin; + >0; clearstack;
        @d  1000,4900; 4000r-.3 _ >1; clearstack;
        @f  2,-4; exp; >2; clearstack;

   Then I run do the calculation by running

      c-calc.exe -ejunk.mac

   The -e option loads a macro file and runs the first macro.  In this
   case it loads junk.mac and runs the macro {f1}.  {f1} calls macros
   {@n} etc to perform parts of the calculation.  {@n}  calculates the
   numerator and stores it in memory 0, etc.  Note:  The above macro
   file will not work for two reasons: 1) Each macro must begin in the
   first column. 2) Each macro must be separated by a blank line from
   the next.



OTHER NOTES:
============
    - Run the batch program helpme.bat.  It starts up the c-calc program
      and runs help.  Look at some of the available help screens from
      there.

    - There are a number of batch (.bat) files which give some examples
      of the program's use.  I suggest you look at and run some of them.
      These batch files run c-calc.exe by using various macro files.
      All of the macro files which are included with this distribution
      have the suffix .mac, but this is not necessary.  The .bat files
      with descriptions are shown below.

    - Some of the commands have rather long names, for example see the
      command SetStackDisplaySize above.  If you want to use them, I
      suggest you define macros to implement them, unless you are very
      good at typing.


BATCH FILES INCLUDED:
=====================
  amort.bat
      does this:
         c-calc.exe -eamort.mac
      Starts amortization module.
  example1.bat
  example2.bat
      example1.bat and example2.bat show some examples which
      I have found to be useful, such as changing the
      displayed precision using the arrow keys or changing
      the displayed stack size using page up and down
      keys.
  fundcnst.bat
      some fundamental constants
  helpme.bat
      does this:
         c-calc.exe -ehelpme.mac
      Starts the program and goes to help, then quits.
  r-calc.bat
      Starts the progarm by setting the display to show only
      real numbers.
  shousage.bat
      Shows the command line usage
  small.bat
      does this:
         c-calc.exe -esmall.mac -a4:10
      Starts the program with small stack size (4) and
      memory size (10), then loads and runs the first macro
      in small.mac which sets the stack display size to 1.


AN EXAMPLE MACRO FILE:
======================
  The following shows the macro file small.mac followed by a
  description of some of the macros.  Note each macro must
  be separated by a blank line from the next macro.

---- Beginning of small.mac -----
@1 1;SetStackDisplaySize;

up up;

down down;

right GetPrecision;1+SetPrecision;

left GetPrecision;1_SetPrecision;

f1 ?

f10 ShowMacros;
---- End of small.mac -----

The batch file small.bat does this
   c-calc.exe -esmall.mac -a4:10

The -a option makes the program start with a stack size of 4 and a
memory size of 10.  The -e option loads the macro file small.mac (shown
above) and runs the first macro.  The first macro is the macro
associated with the @1 key.  (@1 means <alt>1).  If you would have just
wanted to load the macros without running the first one you can replace
the -e option in the command line with the -m option.  The first line of
small.mac is

@1 1;SetStackDisplaySize;

Each macro is associated with one key.  For a list of keys
see the file readme.key.  If the user hits <alt>1, this
macro does the same thing as if the user entered the
following keys:
    1<enter>
    SetStackDisplaySize<enter>
The semicolon in a macro file is used for the <enter> key.
This sets the stack display size to 1.  If, for example you
want to define a macro to increase the stack display size by
1 you could define following macro (associated with the
<Page Down> key.

pagedown $Increase stack display size by 1$
         GetStackDisplaySize;
         1+
         SetStackDisplaySize;

This example also shows a comment within a macro definition,
indicated by the pairs of dollar signs.
GetStackDisplaySize; puts the stack display size in the
                     bottom of the stack.
1+                   adds 1 to it.
SetStackDisplaySize; sets the stack display size to the
                     integral part of the real part of the
                     number on the bottom of the stack.

up up;               rolls the stack up

down down;           rolls the stack down (filling the top
                     of the stack with 0).

right GetPrecision;1+SetPrecision;
                     increases the displayed precision by 1

left GetPrecision;1_SetPrecision;
                     decreases the displayed precision by 1

f1 ?                 help

f10 ShowMacros;      shows all of the macros
=======================================================================



STANDARD DISCLAIMER:
====================
I am not responsible for anything you do with this program or use this
program for, even if this program gives wrong results.  You use it at
your own risk.

Joe Spector



LAST NOTE:
==========
  If you like this program and would like to thank me, you may send me money,
  a post-card or just wink your eye.  I prefer money.  My address as of
  November 1994 is

    Joe Spector
    3815 S. Kenwood Ln.
    Tempe AZ 85282
    USA

  Note:  The program you have is not crippled in any way.  There are no nag
  screens, etc.  This is the only place I mention money.


