11714 |
Calc also allows apostrophes and @code{#} signs in variable names. |
Calc also allows apostrophes and @code{#} signs in variable names. |
11715 |
(The Calc variable @code{foo} corresponds to the Emacs Lisp variable |
(The Calc variable @code{foo} corresponds to the Emacs Lisp variable |
11716 |
@code{var-foo}, but unless you access the variable from within Emacs |
@code{var-foo}, but unless you access the variable from within Emacs |
11717 |
Lisp, you don't need to worry about it.) |
Lisp, you don't need to worry about it. Variable names in algebraic |
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.) |
11724 |
|
|
11725 |
In a command that takes a variable name, you can either type the full |
In a command that takes a variable name, you can either type the full |
11726 |
name of a variable, or type a single digit to use one of the special |
name of a variable, or type a single digit to use one of the special |
11733 |
stack, enter its name as an algebraic expression using the apostrophe |
stack, enter its name as an algebraic expression using the apostrophe |
11734 |
(@key{'}) key. |
(@key{'}) key. |
11735 |
|
|
|
xxx |
|
|
Variable names in algebraic formulas implicitly have |
|
|
@samp{var-} prefixed to their names. The @samp{#} character in variable |
|
|
names used in algebraic formulas corresponds to a dash @samp{-} in the |
|
|
Lisp variable name. If the name contains any dashes, the prefix @samp{var-} |
|
|
is @emph{not} automatically added. Thus the two formulas @samp{foo + 1} |
|
|
and @samp{var#foo + 1} both refer to the same variable. |
|
|
|
|
11736 |
@kindex = |
@kindex = |
11737 |
@pindex calc-evaluate |
@pindex calc-evaluate |
11738 |
@cindex Evaluation of variables in a formula |
@cindex Evaluation of variables in a formula |
11884 |
need to write @samp{(5%)-2} to get the former interpretation. |
need to write @samp{(5%)-2} to get the former interpretation. |
11885 |
|
|
11886 |
@cindex Function call notation |
@cindex Function call notation |
11887 |
A function call is, e.g., @samp{sin(1+x)}. Function names follow the same |
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 |
@code{foo} corresponds to the Emacs Lisp function @code{calcFunc-foo}, |
11889 |
used (instead of @samp{var-}) for the internal Lisp form. |
but unless you access the function from within Emacs Lisp, you don't |
11890 |
Most mathematical Calculator commands like |
need to worry about it.) Most mathematical Calculator commands like |
11891 |
@code{calc-sin} have function equivalents like @code{sin}. |
@code{calc-sin} have function equivalents like @code{sin}. |
11892 |
If no Lisp function is defined for a function called by a formula, the |
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 |
call is left as it is during algebraic manipulation: @samp{f(x+y)} is |
30740 |
key could invoke a command, which in turn calls an algebraic function, |
key could invoke a command, which in turn calls an algebraic function, |
30741 |
which might have one or more special display formats. A single @kbd{Z P} |
which might have one or more special display formats. A single @kbd{Z P} |
30742 |
command will save all of these definitions. |
command will save all of these definitions. |
30743 |
|
To save an algebraic function, type @kbd{'} (the apostrophe) |
30744 |
To save a command or function without its key binding (or if there is |
when prompted for a key, and type the function name. To save a command |
30745 |
no key binding for the command or function), type @kbd{'} (the apostrophe) |
without its key binding, type @kbd{M-x} and enter a function name. (The |
30746 |
when prompted for a key. Then, type the function name, or backspace |
@samp{calc-} prefix will automatically be inserted for you.) |
30747 |
to change the @samp{calcFunc-} prefix to @samp{calc-} and enter a |
(If the command you give implies a function, the function will be saved, |
30748 |
command name. (If the command you give implies a function, the function |
and if the function has any display formats, those will be saved, but |
30749 |
will be saved, and if the function has any display formats, those will |
not the other way around: Saving a function will not save any commands |
30750 |
be saved, but not the other way around: Saving a function will not save |
or key bindings associated with the function.) |
|
any commands or key bindings associated with the function.) |
|
30751 |
|
|
30752 |
@kindex Z E |
@kindex Z E |
30753 |
@pindex calc-user-define-edit |
@pindex calc-user-define-edit |
31187 |
@kbd{Z F @key{RET} spam @key{RET}} defines the new command as |
@kbd{Z F @key{RET} spam @key{RET}} defines the new command as |
31188 |
@kbd{M-x calc-spam}, with no keyboard equivalent. |
@kbd{M-x calc-spam}, with no keyboard equivalent. |
31189 |
|
|
31190 |
The third prompt is for a function name. The default is to use the same |
The third prompt is for an algebraic function name. The default is to |
31191 |
name as the command name but with @samp{calcFunc-} in place of |
use the same name as the command name but without the @samp{calc-} |
31192 |
@samp{calc-}. This is the name you will use if you want to enter your |
prefix. (If this is of the form @samp{User-m}, the hyphen is removed so |
31193 |
|
it won't be taken for a minus sign in algebraic formulas.) |
31194 |
|
This is the name you will use if you want to enter your |
31195 |
new function in an algebraic formula. Suppose we enter @kbd{yow @key{RET}}. |
new function in an algebraic formula. Suppose we enter @kbd{yow @key{RET}}. |
31196 |
Then the new function can be invoked by pushing two numbers on the |
Then the new function can be invoked by pushing two numbers on the |
31197 |
stack and typing @kbd{z m} or @kbd{x spam}, or by entering the algebraic |
stack and typing @kbd{z m} or @kbd{x spam}, or by entering the algebraic |