**CoCalc2** is a free RPN scientific calculator.
CoCalc2 is available as a Java applet
Since it is a Java applet, you can use it in any Java-enabled
browser in Windows 3.x/95/98/Me/NT/2000/XP, MacOS, OS/2, and
most versions of Unix.
CoCalc2 is free for personal use (but please do not alter or resell it).

After reading this documentation, you can shrink the browser window so that only the calculator is visible.

**Download** -
If you want to install CoCalc2 on your computer,
download these files (right-click and Save-Link-As these files:
http://www.cohort.com/CoCalc2.html and
http://www.cohort.com/CoCalc2.class
) and use your browser
to view your copy of the calculator (bookmark `CoCalc2.html`)
even when you aren't connected to the WWW.

**Trouble?**
If you don't see a calculator at the top of this page within a few seconds after
all of the files are loaded, make sure your browser
supports Java and that Java is enabled (e.g., in Netscape, make sure
`Edit | Preferences | Advanced | Enable Java` is checked).
If you are using
CoCalc2 from files on your computer, make sure
`CoCalc2.class` is in the same directory as
`CoCalc2.html`.

**"Can I put CoCalc on my web page?"** Yes, if you:

- Credit CoHort Software and include a link to the
CoHort Software home page.
For example, you might include a paragraph like:
Here is a free RPN scientific calculator available as a Java applet. CoCalc is free for personal use (but please do not alter or resell it). Try CoCalc now. Or, download these files ( http://www.cohort.com/CoCalc.html and http://www.cohort.com/CoCalc.class ) and use your browser to view your copy of the calculator (

Please change the http references to the CoCalc files on your server.`CoCalc.html`) even when you aren't connected to the WWW.There is also a large text version of CoCalc, called CoCalc2. Try CoCalc2 now. Or, download these files ( http://www.cohort.com/CoCalc2.html and http://www.cohort.com/CoCalc2.class ) and use your browser to view your copy of the calculator (

`CoCalc2.html`) even when you aren't connected to the WWW. - Distribute the files for free and without making any changes to them.
- Send us an email message with your web site address (so we can see the reference) and your email address (so we can notify you of updates). We won't use this information for any other purpose.

**Disclaimer: ** This code is provided "as is",
and comes without any warranty, expressed
or implied; without even the implied warranty of fitness for a
particular purpose. CoHort Software shall not be liable for any damages,
whether direct, indirect, special, incidental or consequential arising
from the use of the software or from the inability to use the software
or from a failure of the software to operate in a manner desired by
the user.

Return to the calculator.

- CoPlot - for making publication-quality 2D and 3D graphs, maps, and technical drawings.
- CoStat - for statistical analysis.

web site: www.cohort.com

email: info@cohort.com

CoHort Software, 798 Lighthouse Ave, PMB 320, Monterey, CA 93940, USA.

phone (800)728-9878 (best if between 9 a.m. and 5 p.m. Pacific time)

fax (831)647-1054

Our web site will always have the latest version of CoCalc.

Return to the calculator.

Browsers are programs designed to let you view HTML documents on the
World Wide Web, but they can also be used to view HTML documents that
exist on your hard disk even when you are not actively connected to the web.
The big advantage to running CoCalc in a browser that supports
Java (like Netscape, WebExplorer, or InternetExplorer) is that you can
simultaneously see this documentation. To use a browser:

1) Run the browser.

2) Use `File, Open File,` and click on `CoCalc.html`
(or CoCalc2.html) in whatever directory you put it in.
`CoCalc.class` (or CoCalc2.class) needs to be in
this directory, too.

Applet viewers are programs that run Java applets.
The slight advantages to running CoCalc in an applet viewer are: 1)
lower memory requirements, 2) the window is automatically
the perfect size for the calculator. One quirk is that you
get another window (a text-based Java "console") which you can
minimize to get it out of the way. To use an applet viewer:

1) Run the viewer with the name of the applet:
`appletviewer CoCalc.html` (or CoCalc2.html)

For further simplicity, you might want to put this in a
batch file called
CoCalc.bat (or CoCalc2.bat) or make an icon which does this.

Return to the calculator.

Return to the calculator.

**Upgrades:** If you want to be put on an email mailing list
to be notified when there is a new version of CoCalc, send email to
info@cohort.com with the words
"subscribe CoCalc" plus your email address on one line in the body of the
message.

Return to the calculator.

1.01 released 11/18/96 - Fixed y^x (which acted like x^y).

1.02 released 8/27/97 -

Added support for keystrokes (which may not work with Java 1.1 and higher).

Fixed the button-down line draw error (which may occur with Java 1.1 and higher).

1.03 released 2000-1-21 - Added CoCalc2 (a large text version).

1.04 released 2000-9-19 - small documentation changes.

Return to the calculator.

On ordinary, non-RPN
calculators, you do calculations by pressing buttons in the order that
you would write an equation on paper (e.g., `5 - 2 =` ).
On RPN calculators,
you enter the numbers and and then do something to them
(e.g., `5 Enter
2 - `). You will note that RPN calculators don't have an
`=` button or
parentheses buttons, but they do have an `Enter` button.

If you aren't used to it, RPN seems odd at first. But when you get used to it and use it for non-trivial calculations, you will see that it is a wonderful system.

Return to the calculator.

To enter a number with an exponent: after entering the mantissa of the
number, press `eex`, and then enter the exponent. For example,
to enter 4.56*10^5, press `4 . 5 6 eex 5`. The display will
show `4.56e5`, which is the program's notation the numbers with
exponents.

To make a number negative, type the number and then press `chs`
(change sign). For example, to enter -4.56, press `4 . 5 6 chs`.
You can press `chs` repeatedly to add/remove the minus sign.

To make an exponent negative, press `chs` (change sign) after
you have entered the exponent. For example,
to enter 4.56*10^-5, press `4 . 5 6 eex 5 chs`. The display will
show `4.56e-5`, which is the program's notation the numbers with
exponents.

For many of the buttons, you can also type the similarly named keys.
This works for the following keys:
`0 1 2 3 4 5 6 7 8 9 a A b B c C d D e E f F
^ ! % . / x - + Enter backspace`.
The buttons that they correspond to should be obvious.
**Warning: ** note that '-' corresponds to the subtraction button ('-');
to change the sign of a number, you must use the 'chs' button.

Return to the calculator.

When you
have finished entering a number, you can do something to the number
(e.g., press a button that does something to the value in the x register,
like `10^x`), or you can enter another number (press `Enter`
and then start entering the next number.

Many buttons are commands that use the values in the x and y registers,
e.g., `+`. When you use these, the result is placed in x, and the
values
in the z and t registers are move down: `y= previous z, z= previous t`.
The t register is not changed.

There are 3 important keys for manipulating the numbers in the stack:

`Enter`- this button pushes all of the values upwards. The x value stays in x and is also pushed into y; y goes into z; z goes into t; and t goes into oblivion. For example,`press 1 Enter 2 Enter Enter`.`rollDn`- this rolls down all of the registers. The t value moves to z; z moves to y; y moves to x; x moves to t. For example, press`3 Enter 4 rollDn rollDn rollDn rollDn`.`x<->y`- this button swaps the values in the x and y registers. For example, press`5 Enter 6 x<->y`.

Automatic stack lift: After you use a command (e.g., `ln` or
`+`), you can immediately enter another number; you don't need
to press `Enter` to lift all of the values in the stack.
After a command, if you press a digit, CoCalc
will automatically lift the stack (as if you had pressed `Enter`).

Return to the calculator.

Here are some simple equations and the buttons you need to press to do the calculation in CoCalc:

Problem: `square root(9)=`

Solution: press `9 sqrt`

Problem: `8/5=`

Solution: press `8 Enter 5 /`

Problem: `4 + (5*6) =`

Solution 1) Press: `4 Enter 5 Enter 6 * +`.

Solution 2) Press: `5 Enter 6 * 4 +`. Note that you don't have to
press `Enter` before typing `4`; the stack is automatically
lifted when you start typing a number after doing an operation.

Problem: `3*sin(1.5degrees)=`

Solution 0) For either method, press `Deg` so the calculations will be
done in degree mode.

Solution 1) Press: `3 Enter 1.5 sin *`.

Solution 2) Press: `1.5 sin 3 *`.

Problem: `(16/5.6 + .5) / (pi*.8^2 + 4)`

Solution: press `16 Enter 5.6 / .5 + pi Enter .8 x^2 * 4 + /`

For more complicated equations or if you repeatedly use a constant,
you may want to store values in a storage register.

Problem: Convert several length measurements (in inches) into centimeters.

Solution: Press `2.54 Store 0`,
then repeatedly press `(a number) Recall 0 *`

Return to the calculator.

The `Deg` and `Rad`
radio buttons let you choose which mode will be used for subsequent
trigonometric operations (`sin, cos, tan, asin, acos, atan,
->Rec, ->Pol`).

The `->Deg` and `->Rad`
buttons let you convert an angle value in the x register from
radians to degrees, or from degrees to radians, respectively.

Return to the calculator.

For all of these options, the numbers stored in the registers are not changed; the numbers are just displayed in different ways.

`Fix` - This format always shows a fixed number of digits
to the right of the decimal place.
To select the `Fix` display mode and specify the number of
digits to the right of the decimal point,
press `Fix` and then the desired number of digits, `0 - F`.
For example, 98765.12345 appears as `98765.123`
if you use `Fix 3`.
The last digit is rounded.
If the number is too big or too small, scientific notation will be used.

`Sci` - Scientific notation always displays the number
with one digit to the left of the decimal place, some specified
number of digits to the right, and an exponent.
To select the `Sci` display mode and specify the number of digits
to the right of the decimal point,
press `Sci` and then the desired number of digits, `0 - F`.
For example, 98765.12345 appears as `9.877e+004`
if you use `Sci 3`.
The last digit is rounded.

`Eng` - Engineering notation is similar to scientific
notation, except that the exponent is constrained to be a multiple
of 3.
To select the `Eng` display mode and specify the number of
digits to the right of the decimal point,
press `Eng` and then the desired number of digits, `0 - F`.
For example, 98765.12345 appears as `98.765e+003`
if you use `Sci 3`.
The last digit is rounded.
[HP calculator purists: no, this is not exactly the way HP does it. But
this way makes the decimal points line up nicely.]

`Hex` - The Hex option displays the numbers in the registers
by displaying rounded values in base 16.
Hexadecimal, as base 16 is called, is widely
used by computer programmers. When you are typing in numbers in this mode,
you can use digits 0 - 9 and
additional hex digits (A, B, C, D, E, and F) which stand for the base
10 numbers: 10, 11,
12, 13, 14, and 15, respectively. Because the calculator only works
with integer hexadecimal numbers,
you can't use the . or `eex` keys in Hex mode. Negative numbers
are displayed with a '-' sign, which avoids a problem: there
are two common ways to store negative numbers in Hex notation
(two's complement and one's complement) and the number of digits is different
for 16, 32, and 64 bit numbers.
To select the `Hex` display mode, press `Hex`.

`Bin` - The Bin option displays the numbers in the registers
by displaying rounded values in base 2.
Binary, as base 2 is called, is widely
used by computer programmers. When you are typing in numbers in this mode,
you can only use digits 0 and 1. Because the calculator only works
with integer binary numbers,
you can't use the . or `eex` keys in Bin mode.
Negative numbers
are displayed with a '-' sign, which avoids a problem: there
are two common ways to store negative numbers in Bin notation
(two's complement and one's complement) and the number of digits is different
for 16, 32, and 64 bit numbers.
Since binary notation is not very dense, you will get an error message
if a number is too long to display.
To select the `Bin` display mode, press `Bin`.

Return to the calculator.

To store the current x value, press `store` and the
number of the register into which you want to store it (`0 - F`),
e.g., `store 4`.

To recall a stored number and put it in x (as if you typed it in), press
`recall` and the number of the register from which you are getting
it (`0 - F`), e.g., `recall 4`.

You can set all of the storage registers to 0 by pressing `clrReg`.

Registers 0 - 5 are used by the statistics procedures to hold
various sums. So, before using the statistics procedures,
use `clrReg`. Until you are done with statistics don't store
anything in registers 0 - 5.

Return to the calculator.

- Initialize the statistics system by pressing
`clrReg`. Storage registers 0 - 5 are used by the statistics procedures to hold various sums. So, while using the statistics procedures, don't store anything new in registers 0 - 5. - For each x,y pair of numbers, type the y value, press
`Enter`, type the x value, and press`Sig+`. When you press`Sig+`, the program increments the storage registers (`s0=s0+1, s1=s1+x, s2=s2+x^2, s3=s3+y, s4=s4+y^2, s5=s5+xy,`) and displays the s0 value in x. These values will be used to calculate various statistics. - When you are done entering the data, press any of the statistics keys:
`mean`- Sets`x=the mean of the x values, y=the mean of the y values, z=z, t=t.``S.D.`- Sets`x=the standard deviation of the x values, y=the standard deviation of the y values, z=z t=t.``L.R.`- Linear Regression:`x=intercept, y=slope, z=z, t=t`.`x^,r`- Given a y value in the x register, this sets`x=expected x, y=correlation coefficient (r), z=z, t=t.``y^,r`- Given an x value in the x register, this sets`x=expected y, y=correlation coefficient (r), z=z, t=t.`

All of the discussion above presumes you have x,y pairs. However,
most of the statistics procedures (`Sig+, Sig-, mean, S.D.`)
can be used if you just have x values.

Return to the calculator.

**Precision:**All registers (x,y,z,t and storage) are 64 bit doubles that have roughly 17-18 significant decimal digits and a range of +/-1e300. The +/-1e300 limit is slightly smaller than the true range of doubles; CoCalc restricts it to help avoid numeric errors.**Integer precision:**Calculations that are done on rounded values (e.g.,`div, mod, <<, >>, and, or, xor, not`) are done on 64 bit integers (called "long's"). Unfortunately, since the precision of doubles is slightly less than the precision of long's, the full range of long's is not available. This should only be a problem in truly extreme cases (e.g., numbers greater than 1e17).**Errors:**CoCalc tries to catch and prevent numeric overflows, division by 0, sqrt, log or ln of a negative number, and other errors. Any calculation that leads to a value greater than +/-1e300 (and some that lead to +/-1e295) lead to an error message. Any calculation done with a error value leads to an error (e.g.,`1+error=error`).**Clearing Errors:**You can clear an error value in the x register by pressing`clx`**Round-off errors:**Computers are not good at exactly storing decimal values. After a series of calculations this often leads to the situation where the internal value of a number is not exactly what you expect (e.g., what appears as`100.0000`may be`99.9999999999`internally). Usually, this doesn't matter, because the numbers are rounded when they are displayed (e.g.,`Fix 4`will show you`100.0000`). But if you subsequently use`int`the result will be`99`and the result of`frac`will appear as`1`(although it is 0.9999999999 internally)! There isn't much you can do about this; just be aware of it.

Return to the calculator.

- .
- While you are typing in a number, this appends '.' to the number.
- %
- Set
`x=x*y/100, y=y, z=z, t=t`. Note that the y, z, and t registers are unchanged. For example, to calculate 15% of $30, press`30 Enter 15 %`. - ->Deg
- Change x from Radians to Degrees:
Sets
`x= x / 2pi * 360`. This assumes that the original x value is an angle in Radians or Degrees, depending on the current Rad or Deg setting. See Degrees vs. Radians. - ->Pol
- Converts from rectangular coordinates(x,y)
to Polar coordinates (x=radius, y=theta):
Set
`x=sqrt(x^2+y^2), y=arcTan2(y,x), z=z, t=t`. The y result is an angle in Radians or Degrees, depending on the current Rad or Deg setting. See Degrees vs. Radians. - ->Rad
- Change x from Degrees to Radians:
Sets
`x= x * 360 / 2pi`. See Degrees vs. Radians. - ->Rec
- Converts from polar coordinates (x=radius, y=theta)
to Rectangular coordinates:
set
`x=x*cos(y), y=x*sin(y), z=z, t=t`. This assumes that the original y value is an angle in Radians or Degrees, depending on the current Rad or Deg setting. See Degrees vs. Radians. - /
- Set
`x=x/y, y=z, z=t, t=t`. - x
- (Multiply) Set
`x=x*y, y=z, z=t, t=t`. - -
- Set
`x=x-y, y=z, z=t, t=t`. - +
- Set
`x=x+y, y=z, z=t, t=t`. - <-
- When you are typing in a number, this backspaces. It removes the rightmost character in the number (which is usually the last digit entered).
- >>
- Set
`x=round(y) shiftRight round(x), y=z, z=t, t=t`. Shifting right is like doing an integer division by 2, x times. For example,`16 Enter 2 >>`returns 4. - <<
- Set
`x=round(y) shiftLeft round(x), y=z, z=t, t=t`. Shifting left is like doing an integer multiplication by 2, x times. For example,`4 Enter 2 <<`returns 16. - 0
- While you are typing in a number, this appends '0' to the number.
- 1
- While you are typing in a number, this appends '1' to the number.
- 1/x
- Set
`x=1/x, y=y, z=z, t=t.` - 10^x
- Set x=10 to the x. Also called common antilog.
- 2
- While you are typing in a number, this appends '2' to the number.
- 3
- While you are typing in a number, this appends '3' to the number.
- 4
- While you are typing in a number, this appends '4' to the number.
- 5
- While you are typing in a number, this appends '5' to the number.
- 6
- While you are typing in a number, this appends '6' to the number.
- 7
- While you are typing in a number, this appends '7' to the number.
- 8
- While you are typing in a number, this appends '8' to the number.
- 9
- While you are typing in a number, this appends '9' to the number.
- A
- While you are typing in a number in Hex mode, this appends 'A' to the number.
- acos
- Set
`x=arccos(x), y=y, z=z, t=t.`The result is an angle in Radians or Degrees, depending on the current Rad or Deg setting. See Degrees vs. Radians. - and
- Set
`x=round(y) and round(x), y=z, z=t, t=t.``and`compares the two numbers bit by bit. If the both bits are 1's, the resulting number has a 1 for that bit. - asin
- Set
`x=arcsin(x), y=y, z=z, t=t.`The result is an angle in Radians or Degrees, depending on the current Rad or Deg setting. See Degrees vs. Radians. - atan
- Set
`x=arctan(x), y=y, z=z, t=t.`The result is an angle in Radians or Degrees, depending on the current Rad or Deg setting. See Degrees vs. Radians. - B
- While you are typing in a number in Hex mode, this appends 'B' to the number.
- Bin
- Display rounded numbers in binary format. See Display Options.
- C
- While you are typing in a number in Hex mode, this append 'C' to the number.
- chs
- Change the sign of x (or its exponent). See Entering Numbers.
- clrReg
- Clears the storage registers (0-F). Do it before doing Statistics. See Statistics.
- clx
- clear x: Set
`x=0, y=y, z=z, t=t.` - CoCalc
- Refresh the screen, and show some information about CoCalc, including the version number.
- cos
- Set
`x=cos(x), y=y, z=z, t=t.`This assumes that the original x value is an angle in Radians or Degrees, depending on the current Rad or Deg setting. See Degrees vs. Radians. - D
- While you are typing in a number in Hex mode, this appends 'D' to the number.
- Deg
- Trigonometric functions will be done in degrees. See Degrees vs. Radians.
- div
- Set
`x=round(y) integerDivide round(x), y=z, z=t, t=t.`Div is the result of an integer division. See`Mod`. For example,`7 Enter 3 div`returns 2. - E
- While you are typing in a number in Hex mode, this appends 'E' to the number.
- e^x
- Set x=e to the x. Also called natural antilog. e is a constant approximately equal to 2.71828183.
- eex
- If in
`Fix/Sci/Eng`modes, enter an exponent for x. See Entering Numbers. - Eng
- Display numbers in engineering notation (with 0 - F digits). See Display Options.
- Enter
- Set
`x=x. y=x, z=y, t=z.`See The Stack. - F
- While you are typing in a number in Hex mode, this appends 'E' to the number in x.
- Fix
- Display a fixed number of decimal digits (0 - F). See Display Options.
- frac
- Set
`x=the fractional part of x, y=y, z=z, t=t.` - Help
- For a description of a button,
press
`Help`then press another button. - Hex
- Display rounded numbers in hexadecimal format. See Display Options.
- int
- Set
`x=the integer part of x, y=y, z=z, t=t.` - L.R.
- Linear Regression: Sets
`x=intercept, y=slope, z=z, t=t.`See Statistics. - last x
- Set
`x=last x, y=x, z=y, t=z.`The 'last x' is saved when you do an operation (e.g.,`ln, +`) so you can recover the x value that existed before the operation. - ln
- Set
`x=the natural log (base e) of x.` - log
- Set
`x=the natural log (base 10) of x.` - mean
- Sets
`x=mean of x's, y=mean of y's, z=z, t=t.`See Statistics. - mod
- Set
`x=round(y) modulus round(x), y=z, z=t, t=t.`Modulus is the remainder of an integer division. See`Div`. For example,`7 Enter 3 mod`returns 1. - n!
- Set
`x=factorial(round(x))`, e.g., 4!=1*2*3*4. - not
- Set
`x=64bit 2's complement of round(x), y=y, z=z, t=t.` - or
- Set
`x=round(y) or round(x), y=z, z=t, t=t.``or`compares the two numbers bit by bit. If either of the bits is a 1, the resulting number has a 1 for that bit. - pi
- Set
`x=3.14159265359, y=x, z=y, t=z.` - Rad
- Trigonometric functions will be done in radians. See Degrees vs. Radians.
- recall
- Recall x from a stored value (slots
`0 - F`). For example, to recall the value in slot 5 and put it in x, press`recall 5`. See Storage Registers. - roll Dn
- roll down: Sets
`x=y, y=z, z=t, t=x.`See The Stack. - S.D.
- Sets
`x=standard deviation of the x's, y=standard deviation of the y's, z=z, t=t.`See Statistics. - Sci
- Display numbers in scientific notation (with 0 - F digits). See Display Options.
- Sig-
- Set storage registers:
`s0=s0-1, s1=s1-x, s2=s2-x^2, s3=s3-y, s4=s4-y^2, s5=s5-xy; x=s0.`See Statistics. - Sig+
- Set storage registers:
`s0=s0+1, s1=s1+x, s2=s2+x^2, s3=s3+y, s4=s4+y^2, s5=s5+xy; x=s0.`See Statistics. - sin
- Set
`x=sin(x), y=y, z=z, t=t.`This assumes that the original x value is an angle in Radians or Degrees, depending on the current Rad or Deg setting. See Degrees vs. Radians. - store
- Store x in a slot (
`0 - F`). For example, to store the x value in slot 5, press`store 5`. See Storage Registers. - tan
- Set
`x=tan(x), y=y, z=z, t=t.`This assumes that the original x value is an angle in Radians or Degrees, depending on the current Rad or Deg setting. See Degrees vs. Radians. - x^0.5
- Set
`x=square root of x, y=y, z=z, t=t.` - x<->y
- Swap the x and y register values,
`z=z, t=t.`See The Stack. - x^2
- Set
`x=x^2, y=y, z=z, t=t.` - x^,r
- Given a y value in the x register,
this sets
`x=expected x, y=correlation coefficient (r), z=z, t=t.`See Statistics. - xor
- Set
`x=round(y) xor round(x), y=z, z=t, t=t.``xor`compares the two numbers bit by bit. If one bit is 0 and the other is 1, the resulting number has a 1 for that bit. - y^x
- Set
`x=y^x, y=z, z=t, t=t.` - y^,r
- Given a x value in the x register,
this sets
`x=expected y, y=correlation coefficient (r), z=z, t=t.`See Statistics.

Return to the calculator.

This is the end of the CoCalc documentation.