ABC - desk calculator with algebraic expression evaluation.

Description:

The ABC (Abacus) subsystem is a powerful desk calculator which can evaluate expressions that include both constants and symbolic variables. ABC also features a summation operator and a library of mathematical functions. Several useful additions have been implemented in the newest version of ABC.

ABC prompts the user for input by typing six spaces and then waiting for input. Possible input forms are:

expression
x = expression          (x is a variable)
for x = a,b,c;          (where a,b and c specify
expression in x          a range of values for x)
Up to three FOR statements may be used before an expression. ABC will print the results of the expression evaluation immediately and will then prompt the user for more input. You can leave ABC at any time, either by entering a null line or the word "done".

An ABC expression can be composed of operators, numbers, variables, constants, and/or functions; such expressions should conform to ordinary algebraic rules. The following operators are accepted in ABC.

+        (addition)
-        (subtraction)
*        (multiplication)
/        (division)
^        (exponentiation)
**       (exponentiation)
&        (summation)
Parentheses may be used in the standard way to group operations together.

Numbers:

ABC accepts the following kinds of numbers.

Integers:   e.g.   4  -7
Fractions:  e.g.   .4  -.99
Mixed numbers:  e.g.  6.8  -12.7
Standard form:  e.g.  1E6 (1000000) 2.5E-6
octal integers:  #123456701234    #12
floating point octal:  !776777777777
   (This goes to the upper word in the double
    precision octal representation of the number.)

Variables:

Variables names can be one to eight characters long and the first character must be alphabetic; for example, A, GG, and F45T are all valid variable names. There are two types of variables:

The value of a FOR variable is lost when the evaluation of the expression is completed, whereas the value of a LABEL variable may be used in subsequent expressions.

Constants and Functions:

ABC contains three built-in constants which are maintained at full system accuracy (18 digits):

PI     (set to 3.141592.....)
E      (set to 2.718281.....)
RADIAN (set to 57.29577.....)

The following functions are defined in ABC.

ABS(X)      Absolute value of x
ATN(X)      Arctangent of x
COS(X)      Cosine of x
EXP(X)      E to the power of x
LOG(X)      Natural log of x
  or
LN(x)       Natural log of x
SIN(X)      Sine of x
SQR(X)      Square root of x
  or
SQT(X)      Square root of x
  or
SQRT(x)     Square root of x
TAN(X)      Tangent of x
LOG10(x)    Common log of x
CEILING(X)  Returns least integer >= x
FLOOR(X)    Returns greatest integer <= x
TAKE(X)     Waits for floor(x) seconds (DRL GWAKE) 
All trig functions require X to be in radians.

The names of the functions are reserved words, and must not be used as variables.

FOR Variables:

A FOR variable is used to supply a range of values to an expression. The FOR statement(s) must precede the associated expression in the same line of input, separated from it by semicolons (;). The form of the FOR statement is

FOR X = A,B,C
where:  A - starting value for X
        B - final value for X
        C - increment (if omitted, increment = 1)
A, B, and C may be numbers or predefined variables.

Summation:

The summation operator(&) may only be used at the beginning of an expression; the part of the expression after the & operator is assumed to be the argument to be summed. Up to three variables may be given a range of values for the summation by means of FOR statements. For example,

      for i = 1,5,1; z = &(i)
z = 15
      for i = 1,5,1;for j = 1,4,.5;z=&i^j
z = 1878.9395

Continuation of Input:

Sometimes the expression you wish to enter is too long to fit on a single line. Such an expression may be entered by continuing it on the next line. This is done by terminating the input line with a "$" followed by a carriage return. ABC will print another question mark and the remainder of the line may then be entered.

Implicit Multiplication:

Implicit multiplication is allowed before a parenthesized subexpression, but not between two such subexpressions. For example, 3(x) is the same as 3*x but (x)(y) is illegal and must be written as (x)*(y) or x*y.

Alternate Numerical Modes:

The most recent version of ABC contains several new numerical modes. These can be obtained by typing ")octal", ")decimal", or ")floating".

)octal
This mode affects both the input and the output of numbers. Input integers are taken as octal rather than decimal, and can contain up to 12 significant digits before overflow occurs. Integers are output in octal form as shown below.
      a=1+3*5
a = o 000000000020
      a-21
o 777777777777
To input a decimal integer, simply precede it with a "%". Thus in octal mode, "%10" is a decimal ten while "10" is an octal number, decimal eight. A line consisting of only the "%" character will cause the previous result to be printed in decimal form as in
      )octal
      a=%14
a = o 000000000016
      %
 14
)decimal
In this mode, input integers are taken to be decimal rather than octal. This is the default mode, the one that is assumed when you first enter ABC. To enter an octal integer, you precede it with a "#" character. A line consisting only of "#" will print the previous result in octal form.
)floating
This mode is useful when working with the octal representation of floating point numbers. When you type in a floating point number, its octal value is used to fill the first word of a double precision floating point number. When the number is printed out, it will be preceded by an "f" and written as twelve octal digits. For example,
      a = .5
      )floating
      a
a = f 776777777777
To input a floating point octal number in any mode, simply place a "!" before the octal digits. A line consisting only of a "!" causes the last result to be printed in floating point octal form. For example,
      )decimal
      .5
0.5
      #
o 000000000000
      !
f 776777777777
      a=77612345670
a = 7.7612346e 10
      !
 f 112441101632

Multiple Commands:

Several statements can be typed on the same line by separating statements with semicolons. For example,

      a=1; b=2;a+b;#;!;c=3
a = 1
b = 2
3
o 000000000003
f 004600000000
c = 3

System Calls:

The construct ")<TSS command>" will execute the given system command. For example,

)expl abc
will give you this explanation.

The " Variable:

" is an internal variable that is set to the last value which was printed. For example,

      21e1
210
      a="-5
a = 205

)vars:

This command lists all the variables that are currently defined in the ABC session. For example,

      )vars
pi radian e a b i var1 loop ..........
The maximum number of variables allowed is 50. Any variable definitions beyond this maximum will not be entered in ABC's internal symbol table; no warning is given when variables are rejected in this manner.

)fns:

This command is like ")vars" except that it lists all the functions that are available in ABC.

)clear:

This function clears the ABC workspace and prints out the message "clear ws". It does not clear the predefined functions or the predefined variables of ABC.

)erase:

The ")erase" command will erase one or more specified variables or functions. For example,

      )vars
PI RADIAN E A X B
      )fns
EXP SIN COS .........
      )erase e,pi,blat,cos,sqt
      )vars;)fns
RADIAN A X B
EXP SIN SQR TAN .....
No message is printed if any of the specified objects do not exist.

)execute:

This command allows you to execute files containing ABC statements. The command has the form ")exec name" where "name" is the name of some file in your AFT. For example, if the contents of "xxx" are

1
A=1
A
#
FOR I=1,?;A=&I
A
then
      )exec xxx
1
1
o 000000000001
?5
15
The printing of variable assignments is suppressed when executing statements in files, as shown above.

Reading Input:

When ABC encounters a question mark in a statement, it will prompt for input from the terminal. This is useful when you are using ")exec" files. For example,

      a=?*?
?pi
?(1/pi)
a = 1
You can change your the prompt character from "?" to something else using the ")prompt" command (see below).

)prompt:

The ")prompt" command changes the prompt character when reading in expressions. This is usually used with ")exec" files. The default prompt character is "?".

)prompt "yes?"
will change your prompt to 'yes?'. The double quotes are necessary when inputting a prompt that is longer than one character.

)head:

The ")head" command prints out character output on the terminal. This is usually needed in ")exec" files. ABC will output everything following the ")head " until it encounters a semicolon or the end of the line. For example,

      )head the value of a is;a
THE VALUE OF A IS
2.5

)comment:

When ABC encounters the string ")comment", it will ignore everything up to the end of the line or the next semicolon. This allows you to comment ")exec" files. For example,

)comment blat
 ..AND SO ON
For more information on the ABC subsystem, see the Time-Sharing System General Information Manual.