April 6, 1994
Greetings again from Dr. Nemeth to the members and friends
of the NFB R&D Committee.
Here is my next communication concerning the NFB scientific
programmable calculator. -- A.N.
Thanks to Tim, Brian, Mike, and Steve for their support and
helpful comments. All right, already, I'll switch from Alt
characters to control characters. Thus, Ctrl-P will invoke the
Pythagorean operator and Ctrl-H will invoke the Add h.ms
operator. As for the Percent Change operator for which I used
Alt-5, another assignment is required since Ctrl-5 makes no
sense. Since no intuitive mnemonic readily comes to mind, I will,
for now, use the question mark, ?, for this operator.
Steve suggested using the numeric keypad for entering
numbers. This is an attractive concept for sighted users.
However, most screen access programs that I know of use the
numeric keypad for interactively communicating with the computer.
I could switch between NUMLOCK on and NUMLOCK off, but that's
more trouble than it's worth. So I will stay with the numbers row
for entering numbers.
You will recall the little trick I used to decide whether a
number is the beginning of a new calculation, or whether it is
the continuation of a calculation already in progress. That trick
consisted of looking at the preceding entry. If the entry was =
or <enter> then the number is the beginning of a new calculation,
and must replace the number on top of the number stack. If the
preceding entry was anything else, then the number is the
continuation of an ongoing calculation, and must be pushed onto
the number stack, thereby enlarging the stack. I therefore offer
the following patch to the flowchart I submitted the last time.
4 Was the previous entry = or <enterth --
-- yes -- 4.1.
-- no -- 4.2.
4.1 Replace the top of the number stack by this number -- 2.
4.2 Push this number onto the number stack -- 2.
Note that I use the Dewey decimal number system whenever I need
to patch a flowchart so as not to disturb the remaining numbers
of the flowchart.
New Business: Unary Operators
I propose to implement the following 16 unary operators, as
promised in my previous posting, using the indicated key
assignments. Each operator operates on x, the number on top
of the number stack, and replaces it with the result of the
1. Absolute value: | (shift-backslash, vertical bar) Replaces
x by its absolute value.
2. Common logarithm (to the base 10): l Replaces x by its
common (base-10) logarithm.
3. Natural (base e) logarithm: Ctrl-l Replaces x by its
natural (base e) logarithm.
4. 10 to the x power: e Replaces x by 10 to the x power.
5. e to the x power (exponential operator): Ctrl-e Replaces x
by e to the x power.
6. Sine: s Replaces x by its sine.
7. Arc sine: Ctrl-s Replaces x by its arc (inverse) sine.
8. Cosine: c Replaces x by its cosine.
9. Arc cosine: Ctrl-c Replaces x by its arc (inverse) cosine.
10 Tangent: t Replaces x by its tangent.
11. Arc tangent: Ctrl-t Replaces x by its arc (inverse)
12. Reciprocal: \ (backslash) Replaces x by its reciprocal
13. Factorial: ! (shift-1) Replaces x by its factorial. x must
be a non-negative integer.
14. x-squared: ~ (tilde) Replaces x by x square.
15. Square root: @ (at sign, shift 2) Replaces x by its square
16. Change sign: _ (underline, shift-minus) Replaces x by its
Here are some remarks concerning the various unary operators.
The vertical bar (shift-backslash) is used for the absolute value
operator because, in mathematical notation, vertical bars are
used to enclose the quantity whose absolute value is desired.
Pure mathematicians (like me) like to use the base e and
natural logarithms. Rough-and-tumble engineers (like you) like
to use the base 10 and common logarithms (to the base 10.) I have
therefore assigned control characters to the "purer" forms and
used the "uncontrolled characters" (a reference both to the
keyboard and my audience) for representing the "wilder" choices.
In a later posting you will see that the calculator comes up in
"degree" mode rather than in the "radian" mode preferred by us
If the callculator is in "radian" mode, the calculator will
execute the trigonometric functions of sine, cosine, and tangent
directly on x. If the calculator is in "degree" mode, however,
the calculator will first automatically convert x to radians
before performing the abv-mentioned trig functions. Similarly, if
the calculator is in "radian" mode, the inverse trig functions of
arcsine, arccosine, and arctangent will produce a radian result.
But if the calculator is in "degree" mode, the radian results
will be automatically converted to degrees.
I assigned the backslash to the reciprocal operator because
finding the reciprocal of a number is related to division for
which the key assignment is the slash. I have assigned the
exclamation point to the factorial operator because in
mathematical notation, the exclamation point is used for this
I assigned the at sign to the square-root operator because
the at sign is shift-2, and 2 is related to the concept of square
Finding the square of a number occurs so frequently in
scientific calculations, that I thought it advisable to assign a
special operator to compute the square of x rather than entering
x, the caret (for y to the x power) and a 2. This is not
necessary, but it is a convenience. I have assigned ~ (tilde)
to this operator, mostly because the tilde is just to the left
of the number row. Shift-2 is no longer available, having been
assigned to the square-root operator.
The change sign operator is the unary minus sign. I have
assigned the underline character (shift-minus) to this operator
because the relationship to the binary minus sign is
I will refer to the scientific calculator that NFB currently
sells as the "old calculator," which tells you of my commitment
to the one on which I am now working. On the old calculator, the
hyperbolic sine, cosine, and tangent functions were implemented.
The inverses of these three hyperbolic functions were not. On the
new calculator, I do not plan to provide direct keys for the
three hyperbolic functions or for their inverses. However, a
separate area will be reserved in the new calculator for storing
and executing canned programs. If desired, the programs for these
hyperbolic functions and their inverses could be included among
these canned programs.
Now I come to a philosophical issue. As I indicated in my last
posting, binary operators will be entered in infix notation, that
is, a binary operator comes between the two operands on which it
operates. This is the way in which we all learned to do
arithmetic and the way that is most comfortable to most people.
As you know, most, although not all, calculators operate using
Reverse Polish Notation (RPN), also known as postfix notation
among the more elite. What I am proposing amounts to a hybrid
calculator in which infix notation is used for binary operators,
but RPN is used for unary operators. This means that a unary
operator comes after the operand which it affects, as implied
by the phrase "postfix notation." For unary operators, this
arrangement is very intuitive. For example, consider the
hypothetical case in which someone wishes to calculate the
negative of the square root of the common logarithm of the
tangent of 60 degrees. In infix notation, a rat's nest of
parentheses would be required as follows:
(Recall that the underline is the unary minus operator and that
the at-sign is the square-root operator.) Entering and keeping
track of all those parentheses is a chore not suited to the way
people think, although to a calculator, it's duck soup. On the
other hand, using postfix notation, the same problem would be
more easily solved as follows:
Is there a conflict in using infix notation for binary operators
and postfix notation for unary operators in the same calculation?
In my professional opinion, the answer is no. As a simple
illustration, suppose we wish to find the 12th root of 2. This is
an interesting number to piano technicians like Tim, because if
one starts with the frequency of a tone and applies this
multiplier to it, one obtains the frequency of the next higher
half-tone. By applying this multiplier 12 times to the original
frequency, the result is a frequency which is the double of the
original and thus is the frequency of a tone one octave higher
than the original tone. To compute the 12th root of 2, recall
that this expression must first be rewritten as 2 to the
one-twelfth power. With this change, the infix form of the
calculation would be:
Using a mixture of infix and postfix notation, we could do the
calculation as follows:
(Recall that the backslash is the reciprocal operator.)
Some Loose Ends: The y to the x Operator
Recall that the binary operator y to the x power is assigned
to the caret or ^ key (shift-6). Suppose we were to calculate
What we be the result? Following the flowchart I presented in
the last posting, you will observe that, since the second caret
has the same rank as the first one, the first y to the x power
will be computed before the second one. Thus, the calculator
would first compute 2 to the 3rd power getting a result of 8, and
then it will compute 8 to the 4th power to get a result of 4096.
Although most calculators will produce this result, this violates
the delicate sensibilities of us pure mathematicians. The
principle of mathematical recursion can best be summed up by the
Big fleas have little fleas
Upon their backs to bite 'em,
And little fleas have lesser fleas,
And so ad infinitum.
Before one can get rid of the little fleas, one must get rid
of the lesser fleas. In the above example, exponents at a higher
level are lesser fleas than those at a lower level, and must be
resolved first. Thus, to obtain the result in the approved
mathematical fashion, we must first compute 3 to the 4th power
to get a result of 81, and then compute 2 to the 81st power
to obtain a huge number of the order of magnitude of 10 to the
24th power. In the old calculator, I attended to this anomaly.
Whenever a caret was detected, I tested to see whether there was
already another caret at the top of the operator stack. If there
was, I did not perform a reduction as called for in the
flowchart, but pushed the new caret onto the old one. I plan
to do the same in this new calculator.
The number Pi
You may wonder why I chose Ctrl-p for the Pythagorean
operator, while a plain p was unassigned. The reason is simple. A
plain p is used to enter the number pi into the calculator. This
number is stored to 15 places as:
and behaves like any other number. Pi occurs so often in
scientific calculations that it is worthwhile to enter that
number automatically when needed by pressing p. This guarantees
that pi is entered quickly and without error that is so likely
when such a long number must be keyed in by hand.
Add Degrees, Minutes, seconds
Just as Add h.ms is assigned to Ctrl-h, I plan to assign the
Add d.ms op}ator & assign x to ,ctrl-;d4 d.ms, of course, stands
for degrees, minutes, seconds. This operator behaves exactly like
the Add h.ms operator, except that when the addition produces a
number of degrees greater than 360, that number is reduced modulo
So far, I have done no programming or even pseudocoding. I am
still in the planning stages. I thought I would share my thinking
so far with my colleagues. You'll hear from me again as soon as
the flak from this submission dies down.
Abrafam Nemeth, Ph.D.
This archive was generated by hypermail 2b29 : Sun Dec 02 2012 - 01:30:03 PST