Go to the previous, next section.

Getting Started

This chapter provides a general overview of Calc, the GNU Emacs Calculator: What it is, how to start it and how to exit from it, and what are the various ways that it can be used.

What is Calc?

Calc is an advanced calculator and mathematical tool that runs as part of the GNU Emacs environment. Very roughly based on the HP-28/48 series of calculators, its many features include:

Calc tries to include a little something for everyone; as a result it is large and might be intimidating to the first-time user. If you plan to use Calc only as a traditional desk calculator, all you really need to read is the "Getting Started" chapter of this manual and possibly the first few sections of the tutorial. As you become more comfortable with the program you can learn its additional features. In terms of efficiency, scope and depth, Calc cannot replace a powerful tool like Mathematica. But Calc has the advantages of convenience, portability, and availability of the source code. And, of course, it's free!

About This Manual

This document serves as a complete description of the GNU Emacs Calculator. It works both as an introduction for novices, and as a reference for experienced users. While it helps to have some experience with GNU Emacs in order to get the most out of Calc, this manual ought to be readable even if you don't know or use Emacs regularly.

The manual is divided into three major parts: the "Getting Started" chapter you are reading now, the Calc tutorial (chapter 2), and the Calc reference manual (the remaining chapters and appendices).

If you are in a hurry to use Calc, there is a brief "demonstration" below which illustrates the major features of Calc in just a couple of pages. If you don't have time to go through the full tutorial, this will show you everything you need to know to begin. See section A Demonstration of Calc.

The tutorial chapter walks you through the various parts of Calc with lots of hands-on examples and explanations. If you are new to Calc and you have some time, try going through at least the beginning of the tutorial. The tutorial includes about 70 exercises with answers. These exercises give you some guided practice with Calc, as well as pointing out some interesting and unusual ways to use its features.

The reference section discusses Calc in complete depth. You can read the reference from start to finish if you want to learn every aspect of Calc. Or, you can look in the table of contents or the Concept Index to find the parts of the manual that discuss the things you need to know.

Every Calc keyboard command is listed in the Calc Summary, and also in the Key Index. Algebraic functions, M-x commands, and variables also have their own indices. @c{Each} In the printed manual, each paragraph that is referenced in the Key or Function Index is marked in the margin with its index entry.

You can access this manual on-line at any time within Calc by pressing the h i key sequence. Outside of the Calc window, you can press M-# i to read the manual on-line. Also, you can jump directly to the Tutorial by pressing h t or M-# t, or to the Summary by pressing h s or M-# s. Within Calc, you can also go to the part of the manual describing any Calc key, function, or variable using h k, h f, or h v, respectively. See section Help Commands.

Printed copies of this manual are also available from the Free Software Foundation.

Notations Used in This Manual

This section describes the various notations that are used throughout the Calc manual.

In keystroke sequences, uppercase letters mean you must hold down the shift key while typing the letter. Keys pressed with Control held down are shown as C-x. Keys pressed with Meta held down are shown as M-x. Other notations are RET for the Return key, SPC for the space bar, TAB for the Tab key, DEL for the Delete key, and LFD for the Line-Feed key.

(If you don't have the LFD or TAB keys on your keyboard, the C-j and C-i keys are equivalent to them, respectively. If you don't have a Meta key, look for Alt or Extend Char. You can also press ESC or C-[ first to get the same effect, so that M-x, ESC x, and C-[ x are all equivalent.)

Sometimes the RET key is not shown when it is "obvious" that you must press RET to proceed. For example, the RET is usually omitted in key sequences like M-x calc-keypad RET.

Commands are generally shown like this: p (calc-precision) or M-# k (calc-keypad). This means that the command is normally used by pressing the p key or M-# k key sequence, but it also has the full-name equivalent shown, e.g., M-x calc-precision.

Commands that correspond to functions in algebraic notation are written: C (calc-cos) [cos]. This means the C key is equivalent to M-x calc-cos, and that the corresponding function in an algebraic-style formula would be `cos(x)'.

A few commands don't have key equivalents: calc-sincos [sincos].

A Demonstration of Calc

This section will show some typical small problems being solved with Calc. The focus is more on demonstration than explanation, but everything you see here will be covered more thoroughly in the Tutorial.

To begin, start Emacs if necessary (usually the command emacs does this), and type M-# c (or ESC # c) to start the Calculator. (See section Starting Calc, if this doesn't work for you.)

Be sure to type all the sample input exactly, especially noting the difference between lower-case and upper-case letters. Remember, RET, TAB, DEL, and SPC are the Return, Tab, Delete, and Space keys.

RPN calculation. In RPN, you type the input number(s) first, then the command to operate on the numbers.

Type 2 RET 3 + Q to compute @c{$\sqrt{2+3} = 2.2360679775$} the square root of 2+3, which is 2.2360679775.

Type P 2 ^ to compute @c{$\pi^2 = 9.86960440109$} the value of `pi' squared, 9.86960440109.

Type TAB to exchange the order of these two results.

Type - I H S to subtract these results and compute the Inverse Hyperbolic sine of the difference, 2.72996136574.

Type DEL to erase this result.

Algebraic calculation. You can also enter calculations using conventional "algebraic" notation. To enter an algebraic formula, use the apostrophe key.

Type ' sqrt(2+3) RET to compute @c{$\sqrt{2+3}$} the square root of 2+3.

Type ' pi^2 RET to enter @c{$\pi^2$} `pi' squared. To evaluate this symbolic formula as a number, type =.

Type ' arcsinh($ - $$) RET to subtract the second-most-recent result from the most-recent and compute the Inverse Hyperbolic sine.

Keypad mode. If you are using the X window system, press M-# k to get Keypad mode. (If you don't use X, skip to the next section.)

Click on the 2, ENTER, 3, +, and SQRT "buttons" using your left mouse button.

Click on PI, 2, and y^x.

Click on INV, then ENTER to swap the two results.

Click on -, INV, HYP, and SIN.

Click on <- to erase the result, then click OFF to turn the Keypad Calculator off.

Grabbing data. Type M-# x if necessary to exit Calc. Now select the following numbers as an Emacs region: "Mark" the front of the list by typing control-SPC or control-@ there, then move to the other end of the list. (Either get this list from the on-line copy of this manual, accessed by M-# i, or just type these numbers into a scratch file.) Now type M-# g to "grab" these numbers into Calc.

1.23  1.97
1.6   2
1.19  1.08

The result `[1.23, 1.97, 1.6, 2, 1.19, 1.08]' is a Calc "vector." Type V R + to compute the sum of these numbers.

Type U to Undo this command, then type V R * to compute the product of the numbers.

You can also grab data as a rectangular matrix. Place the cursor on the upper-leftmost `1' and set the mark, then move to just after the lower-right `8' and press M-# r.

Type v t to transpose this @c{$3\times2$} 3x2 matrix into a @c{$2\times3$} 2x3 matrix. Type v u to unpack the rows into two separate vectors. Now type V R + TAB V R + to compute the sums of the two original columns. (There is also a special grab-and-sum-columns command, M-# :.)

Units conversion. Units are entered algebraically. Type ' 43 mi/hr RET to enter the quantity 43 miles-per-hour. Type u c km/hr RET. Type u c m/s RET.

Date arithmetic. Type t N to get the current date and time. Type 90 + to find the date 90 days from now. Type ' <25 dec 87> RET to enter a date, then - 7 / to see how many weeks have passed since then.

Algebra. Algebraic entries can also include formulas or equations involving variables. Type ' [x + y = a, x y = 1] RET to enter a pair of equations involving three variables. (Note the leading apostrophe in this example; also, note that the space between `x y' is required.) Type a S x,y RET to solve these equations for the variables x and y.

Type d B to view the solutions in more readable notation. Type d C to view them in C language notation, and d T to view them in the notation for the TeX typesetting system. Type d N to return to normal notation.

Type 7.5, then s l a RET to let a = 7.5 in these formulas. (That's a letter l, not a numeral 1.)

Help functions. You can read about any command in the on-line manual. Type M-# c to return to Calc after each of these commands: h k t N to read about the t N command, h f sqrt RET to read about the sqrt function, and h s to read the Calc summary.

Press DEL repeatedly to remove any leftover results from the stack. To exit from Calc, press q or M-# c again.

Using Calc

Calc has several user interfaces that are specialized for different kinds of tasks. As well as Calc's standard interface, there are Quick Mode, Keypad Mode, and Embedded Mode.

Calc must be installed before it can be used. See section Installation, for instructions on setting up and installing Calc. We will assume you or someone on your system has already installed Calc as described there.

Starting Calc

On most systems, you can type M-# to start the Calculator. The notation M-# is short for Meta-#. On most keyboards this means holding down the Meta (or Alt) and Shift keys while typing 3.

Once again, if you don't have a Meta key on your keyboard you can type ESC first, then #, to accomplish the same thing. If you don't even have an ESC key, you can fake it by holding down Control or CTRL while typing a left square bracket (that's C-[ in Emacs notation).

M-# is a prefix key; when you press it, Emacs waits for you to press a second key to complete the command. In this typing 3.

Once again, if you don't have a Meta key on your keyboard you can type ESC first, then #, to accomplish the same thing. If you don't even have an ESC key, you can fake it by holding down Control or CTRL while typing a left square bracket (that's C-[ in Emacs notation).

M-# is a prefix key; when you press it, Emacs waits for you to press a second key to complete the command. In this