Mercurial > emacs
comparison man/calc.texi @ 90070:95879cc1ed20
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-81
Merge from emacs--cvs-trunk--0
Patches applied:
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-748
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-749
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-750
Merge from gnus--rel--5.10
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-751
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-753
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-754
Merge from gnus--rel--5.10
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-755
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-757
Update from CVS
* miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-78
Merge from emacs--cvs-trunk--0
* miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-79
- miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-80
Update from CVS
* miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-81
Merge from emacs--cvs-trunk--0
* miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-82
Update from CVS
author | Miles Bader <miles@gnu.org> |
---|---|
date | Sun, 02 Jan 2005 09:13:19 +0000 |
parents | eac554634bfa 1b8fc7489fa8 |
children | f6b4d0ebf147 |
comparison
equal
deleted
inserted
replaced
90069:fa0a5c4db2c8 | 90070:95879cc1ed20 |
---|---|
2664 We don't have enough space here to show all the zeros! They won't | 2664 We don't have enough space here to show all the zeros! They won't |
2665 fit on a typical screen, either, so you will have to use horizontal | 2665 fit on a typical screen, either, so you will have to use horizontal |
2666 scrolling to see them all. Press @kbd{<} and @kbd{>} to scroll the | 2666 scrolling to see them all. Press @kbd{<} and @kbd{>} to scroll the |
2667 stack window left and right by half its width. Another way to view | 2667 stack window left and right by half its width. Another way to view |
2668 something large is to press @kbd{`} (back-quote) to edit the top of | 2668 something large is to press @kbd{`} (back-quote) to edit the top of |
2669 stack in a separate window. (Press @kbd{M-# M-#} when you are done.) | 2669 stack in a separate window. (Press @kbd{C-c C-c} when you are done.) |
2670 | 2670 |
2671 You can enter non-decimal numbers using the @kbd{#} symbol, too. | 2671 You can enter non-decimal numbers using the @kbd{#} symbol, too. |
2672 Let's see what the hexadecimal number @samp{5FE} looks like in | 2672 Let's see what the hexadecimal number @samp{5FE} looks like in |
2673 binary. Type @kbd{16#5FE} (the letters can be typed in upper or | 2673 binary. Type @kbd{16#5FE} (the letters can be typed in upper or |
2674 lower case; they will always appear in upper case). It will also | 2674 lower case; they will always appear in upper case). It will also |
5586 r 1 a r tsc @key{RET} a r merge @key{RET} a r sinsqr @key{RET} a s | 5586 r 1 a r tsc @key{RET} a r merge @key{RET} a r sinsqr @key{RET} a s |
5587 @end group | 5587 @end group |
5588 @end smallexample | 5588 @end smallexample |
5589 | 5589 |
5590 To edit a variable, type @kbd{s e} and the variable name, use regular | 5590 To edit a variable, type @kbd{s e} and the variable name, use regular |
5591 Emacs editing commands as necessary, then type @kbd{M-# M-#} or | 5591 Emacs editing commands as necessary, then type @kbd{C-c C-c} to store |
5592 @kbd{C-c C-c} to store the edited value back into the variable. | 5592 the edited value back into the variable. |
5593 You can also use @w{@kbd{s e}} to create a new variable if you wish. | 5593 You can also use @w{@kbd{s e}} to create a new variable if you wish. |
5594 | 5594 |
5595 Notice that the first time you use each rule, Calc puts up a ``compiling'' | 5595 Notice that the first time you use each rule, Calc puts up a ``compiling'' |
5596 message briefly. The pattern matcher converts rules into a special | 5596 message briefly. The pattern matcher converts rules into a special |
5597 optimized pattern-matching language rather than using them directly. | 5597 optimized pattern-matching language rather than using them directly. |
6379 type "1" | 6379 type "1" |
6380 calc-kbd-pop # Restore values (Z ') | 6380 calc-kbd-pop # Restore values (Z ') |
6381 @end smallexample | 6381 @end smallexample |
6382 | 6382 |
6383 @noindent | 6383 @noindent |
6384 Press @kbd{M-# M-#} to finish editing and return to the Calculator. | 6384 Press @kbd{C-c C-c} to finish editing and return to the Calculator. |
6385 | 6385 |
6386 @smallexample | 6386 @smallexample |
6387 @group | 6387 @group |
6388 1: 20 1: 3.597739 | 6388 1: 20 1: 3.597739 |
6389 . . | 6389 . . |
11710 A @dfn{variable} is somewhere between a storage register on a conventional | 11710 A @dfn{variable} is somewhere between a storage register on a conventional |
11711 calculator, and a variable in a programming language. (In fact, a Calc | 11711 calculator, and a variable in a programming language. (In fact, a Calc |
11712 variable is really just an Emacs Lisp variable that contains a Calc number | 11712 variable is really just an Emacs Lisp variable that contains a Calc number |
11713 or formula.) A variable's name is normally composed of letters and digits. | 11713 or formula.) A variable's name is normally composed of letters and digits. |
11714 Calc also allows apostrophes and @code{#} signs in variable names. | 11714 Calc also allows apostrophes and @code{#} signs in variable names. |
11715 The Calc variable @code{foo} corresponds to the Emacs Lisp variable | 11715 (The Calc variable @code{foo} corresponds to the Emacs Lisp variable |
11716 @code{var-foo}. Commands like @kbd{s s} (@code{calc-store}) that operate | 11716 @code{var-foo}, but unless you access the variable from within Emacs |
11717 on variables can be made to use any arbitrary Lisp variable simply by | 11717 Lisp, you don't need to worry about it. Variable names in algebraic |
11718 backspacing over the @samp{var-} prefix in the minibuffer. | 11718 formulas implicitly have @samp{var-} prefixed to their names. The |
11719 @samp{#} character in variable names used in algebraic formulas | |
11720 corresponds to a dash @samp{-} in the Lisp variable name. If the name | |
11721 contains any dashes, the prefix @samp{var-} is @emph{not} automatically | |
11722 added. Thus the two formulas @samp{foo + 1} and @samp{var#foo + 1} both | |
11723 refer to the same variable.) | |
11719 | 11724 |
11720 In a command that takes a variable name, you can either type the full | 11725 In a command that takes a variable name, you can either type the full |
11721 name of a variable, or type a single digit to use one of the special | 11726 name of a variable, or type a single digit to use one of the special |
11722 convenience variables @code{var-q0} through @code{var-q9}. For example, | 11727 convenience variables @code{q0} through @code{q9}. For example, |
11723 @kbd{3 s s 2} stores the number 3 in variable @code{var-q2}, and | 11728 @kbd{3 s s 2} stores the number 3 in variable @code{q2}, and |
11724 @w{@kbd{3 s s foo @key{RET}}} stores that number in variable | 11729 @w{@kbd{3 s s foo @key{RET}}} stores that number in variable |
11725 @code{var-foo}. | 11730 @code{foo}. |
11726 | 11731 |
11727 To push a variable itself (as opposed to the variable's value) on the | 11732 To push a variable itself (as opposed to the variable's value) on the |
11728 stack, enter its name as an algebraic expression using the apostrophe | 11733 stack, enter its name as an algebraic expression using the apostrophe |
11729 (@key{'}) key. Variable names in algebraic formulas implicitly have | 11734 (@key{'}) key. |
11730 @samp{var-} prefixed to their names. The @samp{#} character in variable | |
11731 names used in algebraic formulas corresponds to a dash @samp{-} in the | |
11732 Lisp variable name. If the name contains any dashes, the prefix @samp{var-} | |
11733 is @emph{not} automatically added. Thus the two formulas @samp{foo + 1} | |
11734 and @samp{var#foo + 1} both refer to the same variable. | |
11735 | 11735 |
11736 @kindex = | 11736 @kindex = |
11737 @pindex calc-evaluate | 11737 @pindex calc-evaluate |
11738 @cindex Evaluation of variables in a formula | 11738 @cindex Evaluation of variables in a formula |
11739 @cindex Variables, evaluation | 11739 @cindex Variables, evaluation |
11882 or five modulo minus-two? Calc always interprets the leftmost symbol as | 11882 or five modulo minus-two? Calc always interprets the leftmost symbol as |
11883 an infix operator preferentially (modulo, in this case), so you would | 11883 an infix operator preferentially (modulo, in this case), so you would |
11884 need to write @samp{(5%)-2} to get the former interpretation. | 11884 need to write @samp{(5%)-2} to get the former interpretation. |
11885 | 11885 |
11886 @cindex Function call notation | 11886 @cindex Function call notation |
11887 A function call is, e.g., @samp{sin(1+x)}. Function names follow the same | 11887 A function call is, e.g., @samp{sin(1+x)}. (The Calc algebraic function |
11888 rules as variable names except that the default prefix @samp{calcFunc-} is | 11888 @code{foo} corresponds to the Emacs Lisp function @code{calcFunc-foo}, |
11889 used (instead of @samp{var-}) for the internal Lisp form. | 11889 but unless you access the function from within Emacs Lisp, you don't |
11890 Most mathematical Calculator commands like | 11890 need to worry about it.) Most mathematical Calculator commands like |
11891 @code{calc-sin} have function equivalents like @code{sin}. | 11891 @code{calc-sin} have function equivalents like @code{sin}. |
11892 If no Lisp function is defined for a function called by a formula, the | 11892 If no Lisp function is defined for a function called by a formula, the |
11893 call is left as it is during algebraic manipulation: @samp{f(x+y)} is | 11893 call is left as it is during algebraic manipulation: @samp{f(x+y)} is |
11894 left alone. Beware that many innocent-looking short names like @code{in} | 11894 left alone. Beware that many innocent-looking short names like @code{in} |
11895 and @code{re} have predefined meanings which could surprise you; however, | 11895 and @code{re} have predefined meanings which could surprise you; however, |
12057 buffer (@samp{*Calc Edit*}) for editing the top-of-stack value using | 12057 buffer (@samp{*Calc Edit*}) for editing the top-of-stack value using |
12058 regular Emacs commands. With a numeric prefix argument, it edits the | 12058 regular Emacs commands. With a numeric prefix argument, it edits the |
12059 specified number of stack entries at once. (An argument of zero edits | 12059 specified number of stack entries at once. (An argument of zero edits |
12060 the entire stack; a negative argument edits one specific stack entry.) | 12060 the entire stack; a negative argument edits one specific stack entry.) |
12061 | 12061 |
12062 When you are done editing, press @kbd{M-# M-#} to finish and return | 12062 When you are done editing, press @kbd{C-c C-c} to finish and return |
12063 to Calc. The @key{RET} and @key{LFD} keys also work to finish most | 12063 to Calc. The @key{RET} and @key{LFD} keys also work to finish most |
12064 sorts of editing, though in some cases Calc leaves @key{RET} with its | 12064 sorts of editing, though in some cases Calc leaves @key{RET} with its |
12065 usual meaning (``insert a newline'') if it's a situation where you | 12065 usual meaning (``insert a newline'') if it's a situation where you |
12066 might want to insert new lines into the editing buffer. The traditional | 12066 might want to insert new lines into the editing buffer. |
12067 Emacs ``finish'' key sequence, @kbd{C-c C-c}, also works to finish | |
12068 editing and may be easier to type, depending on your keyboard. | |
12069 | 12067 |
12070 When you finish editing, the Calculator parses the lines of text in | 12068 When you finish editing, the Calculator parses the lines of text in |
12071 the @samp{*Calc Edit*} buffer as numbers or formulas, replaces the | 12069 the @samp{*Calc Edit*} buffer as numbers or formulas, replaces the |
12072 original stack elements in the original buffer with these new values, | 12070 original stack elements in the original buffer with these new values, |
12073 then kills the @samp{*Calc Edit*} buffer. The original Calculator buffer | 12071 then kills the @samp{*Calc Edit*} buffer. The original Calculator buffer |
12074 continues to exist during editing, but for best results you should be | 12072 continues to exist during editing, but for best results you should be |
12075 careful not to change it until you have finished the edit. You can | 12073 careful not to change it until you have finished the edit. You can |
12076 also cancel the edit by pressing @kbd{M-# x}. | 12074 also cancel the edit by killing the buffer with @kbd{C-x k}. |
12077 | 12075 |
12078 The formula is normally reevaluated as it is put onto the stack. | 12076 The formula is normally reevaluated as it is put onto the stack. |
12079 For example, editing @samp{a + 2} to @samp{3 + 2} and pressing | 12077 For example, editing @samp{a + 2} to @samp{3 + 2} and pressing |
12080 @kbd{M-# M-#} will push 5 on the stack. If you use @key{LFD} to | 12078 @kbd{C-c C-c} will push 5 on the stack. If you use @key{LFD} to |
12081 finish, Calc will put the result on the stack without evaluating it. | 12079 finish, Calc will put the result on the stack without evaluating it. |
12082 | 12080 |
12083 If you give a prefix argument to @kbd{M-# M-#} (or @kbd{C-c C-c}), | 12081 If you give a prefix argument to @kbd{C-c C-c}, |
12084 Calc will not kill the @samp{*Calc Edit*} buffer. You can switch | 12082 Calc will not kill the @samp{*Calc Edit*} buffer. You can switch |
12085 back to that buffer and continue editing if you wish. However, you | 12083 back to that buffer and continue editing if you wish. However, you |
12086 should understand that if you initiated the edit with @kbd{`}, the | 12084 should understand that if you initiated the edit with @kbd{`}, the |
12087 @kbd{M-# M-#} operation will be programmed to replace the top of the | 12085 @kbd{C-c C-c} operation will be programmed to replace the top of the |
12088 stack with the new edited value, and it will do this even if you have | 12086 stack with the new edited value, and it will do this even if you have |
12089 rearranged the stack in the meanwhile. This is not so much of a problem | 12087 rearranged the stack in the meanwhile. This is not so much of a problem |
12090 with other editing commands, though, such as @kbd{s e} | 12088 with other editing commands, though, such as @kbd{s e} |
12091 (@code{calc-edit-variable}; @pxref{Operations on Variables}). | 12089 (@code{calc-edit-variable}; @pxref{Operations on Variables}). |
12092 | 12090 |
14137 translated into @code{subscr} calls, so that @samp{a[i]} in C | 14135 translated into @code{subscr} calls, so that @samp{a[i]} in C |
14138 mode is the same as @samp{a_i} in Normal mode. Assignments | 14136 mode is the same as @samp{a_i} in Normal mode. Assignments |
14139 turn into the @code{assign} function, which Calc normally displays | 14137 turn into the @code{assign} function, which Calc normally displays |
14140 using the @samp{:=} symbol. | 14138 using the @samp{:=} symbol. |
14141 | 14139 |
14142 The variables @code{var-pi} and @code{var-e} would be displayed @samp{pi} | 14140 The variables @code{pi} and @code{e} would be displayed @samp{pi} |
14143 and @samp{e} in Normal mode, but in C mode they are displayed as | 14141 and @samp{e} in Normal mode, but in C mode they are displayed as |
14144 @samp{M_PI} and @samp{M_E}, corresponding to the names of constants | 14142 @samp{M_PI} and @samp{M_E}, corresponding to the names of constants |
14145 typically provided in the @file{<math.h>} header. Functions whose | 14143 typically provided in the @file{<math.h>} header. Functions whose |
14146 names are different in C are translated automatically for entry and | 14144 names are different in C are translated automatically for entry and |
14147 display purposes. For example, entering @samp{asin(x)} will push the | 14145 display purposes. For example, entering @samp{asin(x)} will push the |
15262 @kindex Z S | 15260 @kindex Z S |
15263 @pindex calc-edit-user-syntax | 15261 @pindex calc-edit-user-syntax |
15264 The @kbd{Z S} (@code{calc-edit-user-syntax}) command edits the | 15262 The @kbd{Z S} (@code{calc-edit-user-syntax}) command edits the |
15265 syntax table for the current language mode. If you want your | 15263 syntax table for the current language mode. If you want your |
15266 syntax to work in any language, define it in the Normal language | 15264 syntax to work in any language, define it in the Normal language |
15267 mode. Type @kbd{M-# M-#} to finish editing the syntax table, or | 15265 mode. Type @kbd{C-c C-c} to finish editing the syntax table, or |
15268 @kbd{M-# x} to cancel the edit. The @kbd{m m} command saves all | 15266 @kbd{C-x k} to cancel the edit. The @kbd{m m} command saves all |
15269 the syntax tables along with the other mode settings; | 15267 the syntax tables along with the other mode settings; |
15270 @pxref{General Mode Commands}. | 15268 @pxref{General Mode Commands}. |
15271 | 15269 |
15272 @menu | 15270 @menu |
15273 * Syntax Table Basics:: | 15271 * Syntax Table Basics:: |
17218 that Calc would consider to be standard time), then Calc substitutes | 17216 that Calc would consider to be standard time), then Calc substitutes |
17219 the corresponding generalized time zone (like @code{PGT}). | 17217 the corresponding generalized time zone (like @code{PGT}). |
17220 | 17218 |
17221 If your system does not have a suitable @samp{date} command, you | 17219 If your system does not have a suitable @samp{date} command, you |
17222 may wish to put a @samp{(setq var-TimeZone ...)} in your Emacs | 17220 may wish to put a @samp{(setq var-TimeZone ...)} in your Emacs |
17223 initialization file to set the time zone. The easiest way to do | 17221 initialization file to set the time zone. (Since you are interacting |
17222 with the variable @code{TimeZone} directly from Emacs Lisp, the | |
17223 @code{var-} prefix needs to be present.) The easiest way to do | |
17224 this is to edit the @code{TimeZone} variable using Calc's @kbd{s T} | 17224 this is to edit the @code{TimeZone} variable using Calc's @kbd{s T} |
17225 command, then use the @kbd{s p} (@code{calc-permanent-variable}) | 17225 command, then use the @kbd{s p} (@code{calc-permanent-variable}) |
17226 command to save the value of @code{TimeZone} permanently. | 17226 command to save the value of @code{TimeZone} permanently. |
17227 | 17227 |
17228 The @kbd{t J} and @code{t U} commands with no numeric prefix | 17228 The @kbd{t J} and @code{t U} commands with no numeric prefix |
21805 @vindex DistribRules | 21805 @vindex DistribRules |
21806 The @kbd{j D} command is implemented using rewrite rules. | 21806 The @kbd{j D} command is implemented using rewrite rules. |
21807 @xref{Selections with Rewrite Rules}. The rules are stored in | 21807 @xref{Selections with Rewrite Rules}. The rules are stored in |
21808 the Calc variable @code{DistribRules}. A convenient way to view | 21808 the Calc variable @code{DistribRules}. A convenient way to view |
21809 these rules is to use @kbd{s e} (@code{calc-edit-variable}) which | 21809 these rules is to use @kbd{s e} (@code{calc-edit-variable}) which |
21810 displays and edits the stored value of a variable. Press @kbd{M-# M-#} | 21810 displays and edits the stored value of a variable. Press @kbd{C-c C-c} |
21811 to return from editing mode; be careful not to make any actual changes | 21811 to return from editing mode; be careful not to make any actual changes |
21812 or else you will affect the behavior of future @kbd{j D} commands! | 21812 or else you will affect the behavior of future @kbd{j D} commands! |
21813 | 21813 |
21814 To extend @kbd{j D} to handle new cases, just edit @code{DistribRules} | 21814 To extend @kbd{j D} to handle new cases, just edit @code{DistribRules} |
21815 as described above. You can then use the @kbd{s p} command to save | 21815 as described above. You can then use the @kbd{s p} command to save |
23581 using a pattern like @samp{as(n)}. The @kbd{s l} command only works | 23581 using a pattern like @samp{as(n)}. The @kbd{s l} command only works |
23582 on variables, but you can use the @kbd{a b} (@code{calc-substitute}) | 23582 on variables, but you can use the @kbd{a b} (@code{calc-substitute}) |
23583 command to substitute actual values for function calls like @samp{as(3)}. | 23583 command to substitute actual values for function calls like @samp{as(3)}. |
23584 | 23584 |
23585 The @kbd{s G} (@code{calc-edit-GenCount}) command is a convenient | 23585 The @kbd{s G} (@code{calc-edit-GenCount}) command is a convenient |
23586 way to create or edit this variable. Press @kbd{M-# M-#} to finish. | 23586 way to create or edit this variable. Press @kbd{C-c C-c} to finish. |
23587 | 23587 |
23588 If you have not stored a value in @code{GenCount}, or if the value | 23588 If you have not stored a value in @code{GenCount}, or if the value |
23589 in that variable is not a positive integer, the regular | 23589 in that variable is not a positive integer, the regular |
23590 @code{s1}/@code{n1} notation is used. | 23590 @code{s1}/@code{n1} notation is used. |
23591 | 23591 |
27845 @vindex q0 | 27845 @vindex q0 |
27846 @vindex q9 | 27846 @vindex q9 |
27847 The @kbd{s s} (@code{calc-store}) command stores the value at the top of | 27847 The @kbd{s s} (@code{calc-store}) command stores the value at the top of |
27848 the stack into a specified variable. It prompts you to enter the | 27848 the stack into a specified variable. It prompts you to enter the |
27849 name of the variable. If you press a single digit, the value is stored | 27849 name of the variable. If you press a single digit, the value is stored |
27850 immediately in one of the ``quick'' variables @code{var-q0} through | 27850 immediately in one of the ``quick'' variables @code{q0} through |
27851 @code{var-q9}. Or you can enter any variable name. The prefix @samp{var-} | 27851 @code{q9}. Or you can enter any variable name. |
27852 is supplied for you; when a name appears in a formula (as in @samp{a+q2}) | |
27853 the prefix @samp{var-} is also supplied there, so normally you can simply | |
27854 forget about @samp{var-} everywhere. Its only purpose is to enable you to | |
27855 use Calc variables without fear of accidentally clobbering some variable in | |
27856 another Emacs package. If you really want to store in an arbitrary Lisp | |
27857 variable, just backspace over the @samp{var-}. | |
27858 | 27852 |
27859 @kindex s t | 27853 @kindex s t |
27860 @pindex calc-store-into | 27854 @pindex calc-store-into |
27861 The @kbd{s s} command leaves the stored value on the stack. There is | 27855 The @kbd{s s} command leaves the stored value on the stack. There is |
27862 also an @kbd{s t} (@code{calc-store-into}) command, which removes a | 27856 also an @kbd{s t} (@code{calc-store-into}) command, which removes a |
28036 variables represent their standard values. Calc displays a warning if | 28030 variables represent their standard values. Calc displays a warning if |
28037 you change the value of one of these variables, or of one of the other | 28031 you change the value of one of these variables, or of one of the other |
28038 special variables @code{inf}, @code{uinf}, and @code{nan} (which are | 28032 special variables @code{inf}, @code{uinf}, and @code{nan} (which are |
28039 normally void). | 28033 normally void). |
28040 | 28034 |
28041 Note that @code{var-pi} doesn't actually have 3.14159265359 stored | 28035 Note that @code{pi} doesn't actually have 3.14159265359 stored |
28042 in it, but rather a special magic value that evaluates to @cpi{} | 28036 in it, but rather a special magic value that evaluates to @cpi{} |
28043 at the current precision. Likewise @code{var-e}, @code{var-i}, and | 28037 at the current precision. Likewise @code{e}, @code{i}, and |
28044 @code{var-phi} evaluate according to the current precision or polar mode. | 28038 @code{phi} evaluate according to the current precision or polar mode. |
28045 If you recall a value from @code{pi} and store it back, this magic | 28039 If you recall a value from @code{pi} and store it back, this magic |
28046 property will be lost. | 28040 property will be lost. |
28047 | 28041 |
28048 @kindex s c | 28042 @kindex s c |
28049 @pindex calc-copy-variable | 28043 @pindex calc-copy-variable |
28050 The @kbd{s c} (@code{calc-copy-variable}) command copies the stored | 28044 The @kbd{s c} (@code{calc-copy-variable}) command copies the stored |
28051 value of one variable to another. It differs from a simple @kbd{s r} | 28045 value of one variable to another. It differs from a simple @kbd{s r} |
28052 followed by an @kbd{s t} in two important ways. First, the value never | 28046 followed by an @kbd{s t} in two important ways. First, the value never |
28053 goes on the stack and thus is never rounded, evaluated, or simplified | 28047 goes on the stack and thus is never rounded, evaluated, or simplified |
28054 in any way; it is not even rounded down to the current precision. | 28048 in any way; it is not even rounded down to the current precision. |
28055 Second, the ``magic'' contents of a variable like @code{var-e} can | 28049 Second, the ``magic'' contents of a variable like @code{e} can |
28056 be copied into another variable with this command, perhaps because | 28050 be copied into another variable with this command, perhaps because |
28057 you need to unstore @code{var-e} right now but you wish to put it | 28051 you need to unstore @code{e} right now but you wish to put it |
28058 back when you're done. The @kbd{s c} command is the only way to | 28052 back when you're done. The @kbd{s c} command is the only way to |
28059 manipulate these magic values intact. | 28053 manipulate these magic values intact. |
28060 | 28054 |
28061 @node Recalling Variables, Operations on Variables, Storing Variables, Store and Recall | 28055 @node Recalling Variables, Operations on Variables, Storing Variables, Store and Recall |
28062 @section Recalling Variables | 28056 @section Recalling Variables |
28091 The @kbd{s e} (@code{calc-edit-variable}) command edits the stored | 28085 The @kbd{s e} (@code{calc-edit-variable}) command edits the stored |
28092 value of a variable without ever putting that value on the stack | 28086 value of a variable without ever putting that value on the stack |
28093 or simplifying or evaluating the value. It prompts for the name of | 28087 or simplifying or evaluating the value. It prompts for the name of |
28094 the variable to edit. If the variable has no stored value, the | 28088 the variable to edit. If the variable has no stored value, the |
28095 editing buffer will start out empty. If the editing buffer is | 28089 editing buffer will start out empty. If the editing buffer is |
28096 empty when you press @kbd{M-# M-#} to finish, the variable will | 28090 empty when you press @kbd{C-c C-c} to finish, the variable will |
28097 be made void. @xref{Editing Stack Entries}, for a general | 28091 be made void. @xref{Editing Stack Entries}, for a general |
28098 description of editing. | 28092 description of editing. |
28099 | 28093 |
28100 The @kbd{s e} command is especially useful for creating and editing | 28094 The @kbd{s e} command is especially useful for creating and editing |
28101 rewrite rules which are stored in variables. Sometimes these rules | 28095 rewrite rules which are stored in variables. Sometimes these rules |
28214 only way to remove a saved variable is to edit your @file{.emacs} file | 28208 only way to remove a saved variable is to edit your @file{.emacs} file |
28215 by hand. (@xref{General Mode Commands}, for a way to tell Calc to | 28209 by hand. (@xref{General Mode Commands}, for a way to tell Calc to |
28216 use a different file instead of @file{.emacs}.) | 28210 use a different file instead of @file{.emacs}.) |
28217 | 28211 |
28218 If you do not specify the name of a variable to save (i.e., | 28212 If you do not specify the name of a variable to save (i.e., |
28219 @kbd{s p @key{RET}}), all @samp{var-} variables with defined values | 28213 @kbd{s p @key{RET}}), all Calc variables with defined values |
28220 are saved except for the special constants @code{pi}, @code{e}, | 28214 are saved except for the special constants @code{pi}, @code{e}, |
28221 @code{i}, @code{phi}, and @code{gamma}; the variables @code{TimeZone} | 28215 @code{i}, @code{phi}, and @code{gamma}; the variables @code{TimeZone} |
28222 and @code{PlotRejects}; | 28216 and @code{PlotRejects}; |
28223 @code{FitRules}, @code{DistribRules}, and other built-in rewrite | 28217 @code{FitRules}, @code{DistribRules}, and other built-in rewrite |
28224 rules; and @code{PlotData@var{n}} variables generated | 28218 rules; and @code{PlotData@var{n}} variables generated |
28226 explicitly naming them in an @kbd{s p} command.) | 28220 explicitly naming them in an @kbd{s p} command.) |
28227 | 28221 |
28228 @kindex s i | 28222 @kindex s i |
28229 @pindex calc-insert-variables | 28223 @pindex calc-insert-variables |
28230 The @kbd{s i} (@code{calc-insert-variables}) command writes | 28224 The @kbd{s i} (@code{calc-insert-variables}) command writes |
28231 the values of all @samp{var-} variables into a specified buffer. | 28225 the values of all Calc variables into a specified buffer. |
28232 The variables are written in the form of Lisp @code{setq} commands | 28226 The variables are written with the prefix @code{var-} in the form of |
28227 Lisp @code{setq} commands | |
28233 which store the values in string form. You can place these commands | 28228 which store the values in string form. You can place these commands |
28234 in your @file{.emacs} buffer if you wish, though in this case it | 28229 in your @file{.emacs} buffer if you wish, though in this case it |
28235 would be easier to use @kbd{s p @key{RET}}. (Note that @kbd{s i} | 28230 would be easier to use @kbd{s p @key{RET}}. (Note that @kbd{s i} |
28236 omits the same set of variables as @w{@kbd{s p @key{RET}}}; the difference | 28231 omits the same set of variables as @w{@kbd{s p @key{RET}}}; the difference |
28237 is that @kbd{s i} will store the variables in any buffer, and it also | 28232 is that @kbd{s i} will store the variables in any buffer, and it also |
28937 The graph is made the same size as the Emacs screen, which on most | 28932 The graph is made the same size as the Emacs screen, which on most |
28938 dumb terminals will be | 28933 dumb terminals will be |
28939 @texline @math{80\times24} | 28934 @texline @math{80\times24} |
28940 @infoline 80x24 | 28935 @infoline 80x24 |
28941 characters. The graph is displayed in | 28936 characters. The graph is displayed in |
28942 an Emacs ``recursive edit''; type @kbd{q} or @kbd{M-# M-#} to exit | 28937 an Emacs ``recursive edit''; type @kbd{q} or @kbd{C-c C-c} to exit |
28943 the recursive edit and return to Calc. Note that the @code{dumb} | 28938 the recursive edit and return to Calc. Note that the @code{dumb} |
28944 device is present only in GNUPLOT 3.0 and later versions. | 28939 device is present only in GNUPLOT 3.0 and later versions. |
28945 | 28940 |
28946 The word @code{dumb} may be followed by two numbers separated by | 28941 The word @code{dumb} may be followed by two numbers separated by |
28947 spaces. These are the desired width and height of the graph in | 28942 spaces. These are the desired width and height of the graph in |
30117 @kindex M-# ` | 30112 @kindex M-# ` |
30118 @pindex calc-embedded-edit | 30113 @pindex calc-embedded-edit |
30119 The @kbd{M-# `} (@code{calc-embedded-edit}) command edits the | 30114 The @kbd{M-# `} (@code{calc-embedded-edit}) command edits the |
30120 embedded formula at the current point as if by @kbd{`} (@code{calc-edit}). | 30115 embedded formula at the current point as if by @kbd{`} (@code{calc-edit}). |
30121 Embedded mode does not have to be enabled for this to work. Press | 30116 Embedded mode does not have to be enabled for this to work. Press |
30122 @kbd{M-# M-#} to finish the edit, or @kbd{M-# x} to cancel. | 30117 @kbd{C-c C-c} to finish the edit, or @kbd{C-x k} to cancel. |
30123 | 30118 |
30124 @node Assignments in Embedded Mode, Mode Settings in Embedded Mode, More About Embedded Mode, Embedded Mode | 30119 @node Assignments in Embedded Mode, Mode Settings in Embedded Mode, More About Embedded Mode, Embedded Mode |
30125 @section Assignments in Embedded Mode | 30120 @section Assignments in Embedded Mode |
30126 | 30121 |
30127 @noindent | 30122 @noindent |
30741 The @kbd{Z P} command also saves the user definition, if any, for the | 30736 The @kbd{Z P} command also saves the user definition, if any, for the |
30742 command bound to the key. After @kbd{Z F} and @kbd{Z C}, a given user | 30737 command bound to the key. After @kbd{Z F} and @kbd{Z C}, a given user |
30743 key could invoke a command, which in turn calls an algebraic function, | 30738 key could invoke a command, which in turn calls an algebraic function, |
30744 which might have one or more special display formats. A single @kbd{Z P} | 30739 which might have one or more special display formats. A single @kbd{Z P} |
30745 command will save all of these definitions. | 30740 command will save all of these definitions. |
30746 | 30741 To save an algebraic function, type @kbd{'} (the apostrophe) |
30747 To save a command or function without its key binding (or if there is | 30742 when prompted for a key, and type the function name. To save a command |
30748 no key binding for the command or function), type @kbd{'} (the apostrophe) | 30743 without its key binding, type @kbd{M-x} and enter a function name. (The |
30749 when prompted for a key. Then, type the function name, or backspace | 30744 @samp{calc-} prefix will automatically be inserted for you.) |
30750 to change the @samp{calcFunc-} prefix to @samp{calc-} and enter a | 30745 (If the command you give implies a function, the function will be saved, |
30751 command name. (If the command you give implies a function, the function | 30746 and if the function has any display formats, those will be saved, but |
30752 will be saved, and if the function has any display formats, those will | 30747 not the other way around: Saving a function will not save any commands |
30753 be saved, but not the other way around: Saving a function will not save | 30748 or key bindings associated with the function.) |
30754 any commands or key bindings associated with the function.) | |
30755 | 30749 |
30756 @kindex Z E | 30750 @kindex Z E |
30757 @pindex calc-user-define-edit | 30751 @pindex calc-user-define-edit |
30758 @cindex Editing user definitions | 30752 @cindex Editing user definitions |
30759 The @kbd{Z E} (@code{calc-user-define-edit}) command edits the definition | 30753 The @kbd{Z E} (@code{calc-user-define-edit}) command edits the definition |
30835 The @kbd{Z E} (@code{calc-user-define-edit}) command on a key that has | 30829 The @kbd{Z E} (@code{calc-user-define-edit}) command on a key that has |
30836 been defined by a keyboard macro tries to use the @code{edit-kbd-macro} | 30830 been defined by a keyboard macro tries to use the @code{edit-kbd-macro} |
30837 command to edit the macro. This command may be found in the | 30831 command to edit the macro. This command may be found in the |
30838 @file{macedit} package, a copy of which comes with Calc. It decomposes | 30832 @file{macedit} package, a copy of which comes with Calc. It decomposes |
30839 the macro definition into full Emacs command names, like @code{calc-pop} | 30833 the macro definition into full Emacs command names, like @code{calc-pop} |
30840 and @code{calc-add}. Type @kbd{M-# M-#} to finish editing and update | 30834 and @code{calc-add}. Type @kbd{C-c C-c} to finish editing and update |
30841 the definition stored on the key, or, to cancel the edit, type | 30835 the definition stored on the key, or, to cancel the edit, kill the |
30842 @kbd{M-# x}. | 30836 buffer with @kbd{C-x k}. |
30843 | 30837 |
30844 If you give a negative numeric prefix argument to @kbd{Z E}, the keyboard | 30838 If you give a negative numeric prefix argument to @kbd{Z E}, the keyboard |
30845 macro is edited in spelled-out keystroke form. For example, the editing | 30839 macro is edited in spelled-out keystroke form. For example, the editing |
30846 buffer might contain the nine characters @w{@samp{1 @key{RET} 2 +}}. When you press | 30840 buffer might contain the nine characters @w{@samp{1 @key{RET} 2 +}}. When you press |
30847 @kbd{M-# M-#}, the @code{read-kbd-macro} feature of the @file{macedit} | 30841 @kbd{C-c C-c}, the @code{read-kbd-macro} feature of the @file{macedit} |
30848 package is used to reinterpret these key names. The | 30842 package is used to reinterpret these key names. The |
30849 notations @code{RET}, @code{LFD}, @code{TAB}, @code{SPC}, @code{DEL}, and | 30843 notations @code{RET}, @code{LFD}, @code{TAB}, @code{SPC}, @code{DEL}, and |
30850 @code{NUL} must be written in all uppercase, as must the prefixes @code{C-} | 30844 @code{NUL} must be written in all uppercase, as must the prefixes @code{C-} |
30851 and @code{M-}. Spaces and line breaks are ignored. Other characters are | 30845 and @code{M-}. Spaces and line breaks are ignored. Other characters are |
30852 copied verbatim into the keyboard macro. Basically, the notation is the | 30846 copied verbatim into the keyboard macro. Basically, the notation is the |
31189 If you want to give the formula a long-style name only, you can press | 31183 If you want to give the formula a long-style name only, you can press |
31190 @key{SPC} or @key{RET} when asked which single key to use. For example | 31184 @key{SPC} or @key{RET} when asked which single key to use. For example |
31191 @kbd{Z F @key{RET} spam @key{RET}} defines the new command as | 31185 @kbd{Z F @key{RET} spam @key{RET}} defines the new command as |
31192 @kbd{M-x calc-spam}, with no keyboard equivalent. | 31186 @kbd{M-x calc-spam}, with no keyboard equivalent. |
31193 | 31187 |
31194 The third prompt is for a function name. The default is to use the same | 31188 The third prompt is for an algebraic function name. The default is to |
31195 name as the command name but with @samp{calcFunc-} in place of | 31189 use the same name as the command name but without the @samp{calc-} |
31196 @samp{calc-}. This is the name you will use if you want to enter your | 31190 prefix. (If this is of the form @samp{User-m}, the hyphen is removed so |
31191 it won't be taken for a minus sign in algebraic formulas.) | |
31192 This is the name you will use if you want to enter your | |
31197 new function in an algebraic formula. Suppose we enter @kbd{yow @key{RET}}. | 31193 new function in an algebraic formula. Suppose we enter @kbd{yow @key{RET}}. |
31198 Then the new function can be invoked by pushing two numbers on the | 31194 Then the new function can be invoked by pushing two numbers on the |
31199 stack and typing @kbd{z m} or @kbd{x spam}, or by entering the algebraic | 31195 stack and typing @kbd{z m} or @kbd{x spam}, or by entering the algebraic |
31200 formula @samp{yow(x,y)}. | 31196 formula @samp{yow(x,y)}. |
31201 | 31197 |
31250 an error message if the key is undefined, or if the key was not defined | 31246 an error message if the key is undefined, or if the key was not defined |
31251 by a @kbd{Z F} command. | 31247 by a @kbd{Z F} command. |
31252 | 31248 |
31253 The @kbd{Z E} (@code{calc-user-define-edit}) command on a key that has | 31249 The @kbd{Z E} (@code{calc-user-define-edit}) command on a key that has |
31254 been defined by a formula uses a variant of the @code{calc-edit} command | 31250 been defined by a formula uses a variant of the @code{calc-edit} command |
31255 to edit the defining formula. Press @kbd{M-# M-#} to finish editing and | 31251 to edit the defining formula. Press @kbd{C-c C-c} to finish editing and |
31256 store the new formula back in the definition, or @kbd{M-# x} to | 31252 store the new formula back in the definition, or kill the buffer with |
31253 @kbd{C-x k} to | |
31257 cancel the edit. (The argument list and other properties of the | 31254 cancel the edit. (The argument list and other properties of the |
31258 definition are unchanged; to adjust the argument list, you can use | 31255 definition are unchanged; to adjust the argument list, you can use |
31259 @kbd{Z G} to grab the function onto the stack, edit with @kbd{`}, and | 31256 @kbd{Z G} to grab the function onto the stack, edit with @kbd{`}, and |
31260 then re-execute the @kbd{Z F} command.) | 31257 then re-execute the @kbd{Z F} command.) |
31261 | 31258 |
35725 @item | 35722 @item |
35726 Variable name may be a single digit or a full name. | 35723 Variable name may be a single digit or a full name. |
35727 | 35724 |
35728 @c 30 | 35725 @c 30 |
35729 @item | 35726 @item |
35730 Editing occurs in a separate buffer. Press @kbd{M-# M-#} (or @kbd{C-c C-c}, | 35727 Editing occurs in a separate buffer. Press @kbd{C-c C-c} (or |
35731 @key{LFD}, or in some cases @key{RET}) to finish the edit, or press | 35728 @key{LFD}, or in some cases @key{RET}) to finish the edit, or kill the |
35732 @kbd{M-# x} to cancel the edit. The @key{LFD} key prevents evaluation | 35729 buffer with @kbd{C-x k} to cancel the edit. The @key{LFD} key prevents evaluation |
35733 of the result of the edit. | 35730 of the result of the edit. |
35734 | 35731 |
35735 @c 31 | 35732 @c 31 |
35736 @item | 35733 @item |
35737 The number prompted for can also be provided as a prefix argument. | 35734 The number prompted for can also be provided as a prefix argument. |