## 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.