XCALC(1) XCALC(1)
NAME
xcalc - scientific calculator for X
SYNOPSIS
xcalc [-display display] [-bw pixels] [-stip] [-rv]
[-rpn] [-analog]
[-geometry geometry]
DESCRIPTION
xcalc is a scientific calculator desktop accessory that
can emulate a TI-30, an HP-10C, and a slide rule.
OPTIONS
-display displayname
specifies the X server to contact.
-geometry geometry
specifies the size and placement of the top-level
window. By default, the minimum size will be used.
Note that your window manager may require you to
place it explicitly.
-fg color
specifies the foreground color to use.
-bg color
specifies the background color to use.
-bw pixels
specifies the border width in pixels.
-stip
indicates that the background of the calculator
should be drawn using a stipple of the foreground
and background colors. On monochrome displays,
this makes for a nicer display.
-rv
indicates that reverse video should be used.
-rpn
indicates that reverse polish notation should be
used. In this mode, the calculator will look and
behave like an HP-10C; without this flag, it will
emulate a TI-30.
-analog
indicates that a slide rule should be used.
- 1 -
XCALC(1) XCALC(1)
OPERATION
Pointer Usage:
Most operations are done with Button1 (usually
leftmost button on the pointer). The only exception
is that pressing the AC key on the TI calculator with
Button3 (usually on the right) exits the calculator.
Key Usage (Normal mode):
The number keys, the +/- key, and the +, -, *, /, and
= keys perform the basic arithmetic operations. It
should be noted that the operators obey the standard
rules of precedence. Thus, entering 3+4*5= results
in 23, not 35. The parentheses can be used to
override this. For example, (1+2+3)*(4+5+6)= results
in 6*15=90. The following are the nonobvious keys:
1/x
Replaces the number in the display with its
reciprocal.
x^2
Squares the number in the display.
SQRT
Takes the square root of the number in the display.
CE/C
When pressed once, clears the number in the display
without clearing the state of the machine. Allows
you to re-enter a number that you have entered
incorrectly. Pressing it twice clears the state.
AC
Clears everything: the display, the state, the
memory. Pressing it with the right button, exits
the program.
INV
Inverts the meaning of the function keys. See the
individual function keys for details.
sin
Computes the sine of the number in the display, as
interpreted by the current DRG mode (see DRG
below). If inverted, it computes the arcsine.
cos
Computes the cosine, or arccosine when inverted.
tan
Computes the tangent, or arctangent when inverted.
- 2 -
XCALC(1) XCALC(1)
DRG
Changes the DRG mode, as indicated by DEG, RAD, or
GRAD at the bottom of the number window of the
calculator. When in DEG mode, numbers in the
display are taken as degrees. In RAD mode, numbers
are in radians, and in GRAD mode, numbers are in
gradients. When inverted, the DRG key converts
degrees to radians to gradients and vice-versa.
For example, put the calculator into DEG mode, and
type 45 INV DRG. The display should now show
something along the lines of 785398, which is 45
degrees converted to radians.
e
The constant e (2.7182818...).
EE
Used for entering exponential numbers. For
example, to enter -2.3E-4, type:
2 . 3 +/- EE 4 +/-
log
Calculates the log (base 10) of the number in the
display. When inverted, it raises 10.0 to the
number in the display. For example, typing 3 INV
log should result in 1000.
ln
Calculates the log (base e) of the number in the
display. When inverted, it raises e to the number
in the display. For example, typing e ln should
result in 1.
y^x
Raises the number on the left to the power of the
number on the right. For example 2 y^x 3 = results
in 8, which is 2^3. For a further example, (1+2+3)
y^x (1+2) = equals 6 y^x 3 which equals 216.
PI
The constant pi. (3.1415927....)
x!
Computes the factorial of the number in the
display. The number in the display must be an
integer in the range 0-170. Depending on your math
library, it might overflow before that.
STO
Copies the number in the display to the memory
location.
- 3 -
XCALC(1) XCALC(1)
RCL
Copies the number from the memory location to the
display.
SUM
Adds the number in the display to the number in the
memory location.
EXC
Swaps the number in the display with the number in
the memory location.
Key Usage (RPN mode):
The number keys, CHS (change sign), +, -, *, /, and
ENTR keys all do exactly what you would expect them
to do. Many of the remaining keys are the same as
in normal mode. The following are the differences:
<-
A backspace key that can be used while typing a
number. It will erase digits from the display.
ON
Clears everything: the display, the state, the
memory. Pressing it with the right button exits
the program.
INV
Inverts the meaning of the function keys. This
would be the f key on an HP calculator, but xcalc
does not have the resolution to display multiple
legends on each key. See the individual function
keys for details.
10^x
Raises 10.0 to the number in the top of the stack.
When inverted, it calculates the log (base 10) of
the number in the display.
e^x
Raises e to the number in the top of the stack.
When inverted, it calculates the log (base e) of
the number in the display.
STO
Copies the number in the top of the stack to a
memory location. There are 10 memory locations.
The desired memory location is specified by
pressing STO followed by a digit key that
corresponds to the memory location.
- 4 -
XCALC(1) XCALC(1)
RCL
Pushes the number from the specified memory
location onto the stack.
SUM
Adds the number on top of the stack to the number
in the specified memory location.
x:y
Exchanges the numbers in the top two stack
positions.
R v
Rolls the stack downward. When inverted, it rolls
the stack upward.
The blank keys were used for programming functions on
the HP11-C. Their functionality has not been
duplicated here.
KEYBOARD EQUIVALENTS
If the pointer is in the xcalc window, you can use the
keyboard to speed entry, as almost all of the
calculator keys have a keyboard equivalent. The number
keys, the operator keys, and the parentheses all have
the obvious equivalent. The less-obvious equivalents
are:
n: +/- !: x!
p: PI e: EE
l: ln ^: y^x
i: INV s: sin
c: cos t: tan
d: DRG BS, DEL: CE/C (<- in RPN mode)
CR: ENTR q: quit
COLOR USAGE
xcalc uses a lot of colors, given the opportunity. In
the default case, it just uses two colors (Foreground
and Background) for everything. However, you can
specify different colors to be used for the number
keys, the operator (+-*/=) keys, the function keys, the
display, and the icon.
X DEFAULTS
Resource names are all capitalized.
BorderWidth
specifies the width of the border. The default is
2.
- 5 -
XCALC(1) XCALC(1)
ReverseVideo
indicates that reverse video should be used.
Stipple
indicates that the background should be stippled.
The default is on for monochrome displays and off
for color displays.
Mode
specifies the default mode. Allowable values are
rpn, analog.
Foreground
specifies the default color used for borders and
text.
Background
specifies the default color used for the
background.
NKeyFore, NKeyBack
specifies the colors used for the number keys.
OKeyFore, OKeyBack
specifies the colors used for the operator keys.
FKeyFore, FKeyBack
specifies the colors used for the function keys.
DispFore, DispBack
specifies the colors used for the display.
IconFore, IconBack
specifies the colors used for the icon.
EXAMPLES
If you are running on a monochrome display, you should
not need any .Xdefaults entries for xcalc. On a color
display, you might want to try the following in normal
mode:
xcalc.Foreground: Black
xcalc.Background: LightSteelBlue
xcalc.NKeyFore: Black
xcalc.NKeyBack: White
xcalc.OKeyFore: Aquamarine
xcalc.OKeyBack: DarkSlateGray
xcalc.FKeyFore: White
xcalc.FKeyBack: #900
xcalc.DispFore: Yellow
xcalc.DispBack: #777
xcalc.IconFore: Red
- 6 -
XCALC(1) XCALC(1)
xcalc.IconBack: White
SEE ALSO
xrdb(1)
BUGS
The calculator does not resize.
The slide rule and HP mode may or may not work
correctly.
This application should be implemented with the X
Toolkit. It would make a very good example of a
compound widget.
AUTHORS
John Bradley, University of Pennsylvania
Mark Rosenstein, MIT Project Athena
- 7 -