Skip to content

Instantly share code, notes, and snippets.

@anler
Last active February 22, 2016 12:13
Show Gist options
  • Save anler/7562535 to your computer and use it in GitHub Desktop.
Save anler/7562535 to your computer and use it in GitHub Desktop.
Emacs calc tutorial

Emacs Calc Tutorial

Getting help

h h See all the help at once.

Working with the stack

. Denotes the top of the stack

It is possible to move the . marker upwards through the stack, temporarily hiding some numbers from commands like +. This is called stack truncation, see Truncating the Stack, if you are interested.

n Change sign of the number in the top of the stack Q Square root of the number in the top of the stack NOTE These commands replace the top of the stack with the result of the calculation.

U Undo operations on the stack. D Redo operations on the stack.

<RET> If you press <RET> when you're not entering a number, the effect is to duplicate the top number on the stack. <SPC> Does the same <RET> does.

<TAB> Exchanges the top two elements of the stack. M-<TAB> Rotates the top three elements of the stack.

<DEL> Removes the top of the stack. M-0 <DEL> Removes the entire stack.

The Trail

The Trails records everything we did since we loaded the Calculator.

t d Display/Hide the Trail.

There should be a little ‘>’ arrow (the trail pointer) resting on the last trail entry.

t ] Reset the trail pointer. t p Move the trail pointer to the previous entry. t n Move the trail pointer to the next entry. t y Yank an entry number back onto the stack. t r Trail search reverse. Use C-s or C-r to continue the search forwards or backwards.

Calculator commands

All calculator commands begin with the word calc-. You can type x directly which is just like the regular M-x key except that it types the calc- prefix for you.

The notation (a, b) represents a complex number.

' Enter algebraic expression.

m a Activates/Deactivates the Algebraic mode. In Algebraic mode, when you press any key that would normally begin entering a number (such as a digit, a decimal point, or the _ key), or if you press ( or [, Calc automatically begins an algebraic entry.

vector-mean u M Calculate the mean of a vector.

f h hypot Calculate hypotenuse using Pythagorean Theorem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment