From bacchus.pa.dec.com!decwrl!uunet!allbery Mon Oct 15 17:37:18 PDT 1990 Article: 1875 of comp.sources.misc Path: bacchus.pa.dec.com!decwrl!uunet!allbery From: daveg@csvax.cs.caltech.edu (David Gillespie) Newsgroups: comp.sources.misc Subject: v15i043: Patch for GNU Emacs Calc, version 1.04 -> 1.05, part 16/20 Message-ID: <108590@uunet.UU.NET> Date: 15 Oct 90 01:20:05 GMT Sender: allbery@uunet.UU.NET Lines: 1212 Approved: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc) X-UNIX-From: daveg@csvax.cs.caltech.edu Posting-number: Volume 15, Issue 43 Submitted-by: daveg@csvax.cs.caltech.edu (David Gillespie) Archive-name: calc-1.05/part16 #!/bin/sh # this is part 16 of a multipart archive # do not concatenate these parts, unpack them in order with /bin/sh # file calc.patch continued # CurArch=16 if test ! -r s2_seq_.tmp then echo "Please unpack part 1 first!" exit 1; fi ( read Scheck if test "$Scheck" != $CurArch then echo "Please unpack part $Scheck next!" exit 1; else exit 0; fi ) < s2_seq_.tmp || exit 1 sed 's/^X//' << 'SHAR_EOF' >> calc.patch X+ form @kbd{k @var{X}} (@code{calc-utp@var{x}}) [@code{utp@var{x}}] X+ and @kbd{I k @var{X}} [@code{ltp@var{x}}], for various letters X+ @var{x}. The arguments to the algebraic functions are the value of X+ the random variable first, then whatever other parameters define the X+ distribution. Note these are among the few Calc functions where the X+ order of the arguments in algebraic form differs from the order of X+ arguments as found on the stack. (The random variable comes last on X+ the stack, so that you can type, e.g., @kbd{2 @key{RET} 1 @key{RET} 2.5 X+ k N X @key{DEL} 2.8 k N -}, using @kbd{X @key{DEL}} to recover the X+ original arguments but substitute a new value for @samp{x}.) X+ X+ @kindex k C X+ @pindex calc-utpc X+ @tindex utpc X+ @tindex ltpc X+ The @samp{utpc(x,v)} function uses the chi-square distribution with X+ @samp{v} degrees of freedom. It is the probability that a model is X+ correct if its chi-square statistic is @samp{x}. X+ X+ @kindex k F X+ @pindex calc-utpf X+ @tindex utpf X+ @tindex ltpf X+ The @samp{utpf(F,v1,v2)} function uses the F distribution, used in X+ various statistical tests. The parameters @samp{v1} and @samp{v2} X+ are the degrees of freedom in the numerator and denominator, X+ respectively, used in computing the statistic @samp{F}. X+ X+ @kindex k N X+ @pindex calc-utpn X+ @tindex utpn X+ @tindex ltpn X+ The @samp{utpn(x,m,s)} function uses a normal (Gaussian) distribution X+ with mean @samp{m} and standard deviation @samp{s}. It is the X+ probability that such a normal-distributed random variable would X+ exceed @samp{x}. X+ X+ @kindex k P X+ @pindex calc-utpp X+ @tindex utpp X+ @tindex ltpp X+ The @samp{utpp(n,x)} function uses a Poisson distribution with X+ mean @samp{x}. It is the probability that @samp{n} or more such X+ Poisson random events will occur. X+ X+ @kindex k T X+ @pindex calc-ltpt X+ @tindex utpt X+ @tindex ltpt X+ The @samp{utpt(t,v)} function uses the Student's ``t'' distribution X+ with @samp{v} degrees of freedom. It is the probability that a X+ t-distributed random variable will be greater than @samp{t}. X+ (Note: This computes the distribution function @samp{A(t|v)} X+ where @samp{A(0|v) = 1} and @samp{A(infinity|v) -> 0}. The X+ @code{UTPT} operation on the HP-48 uses a different definition X+ which returns half of Calc's value: @samp{UTPT(t,v) = .5*utpt(t,v)}.) X+ X @node Binary Functions, Matrix Functions, Scientific Functions, Top X @chapter Binary Number Functions X X*************** X*** 6550,6556 **** X numeric prefix argument, the number is rotated the specified number of X bits to the left or right. X X! @node Matrix Functions, Algebra, Binary Functions, Top X @chapter Vector and Matrix Functions X X Many of the commands described here begin with the @kbd{v} prefix. X--- 9535,9541 ---- X numeric prefix argument, the number is rotated the specified number of X bits to the left or right. X X! @node Matrix Functions, Graphics, Binary Functions, Top X @chapter Vector and Matrix Functions X X Many of the commands described here begin with the @kbd{v} prefix. X*************** X*** 6562,6567 **** X--- 9547,9553 ---- X @menu X * Building Vectors:: X * Extracting Elements:: X+ * Manipulating Vectors:: X * Vector and Matrix Arithmetic:: X * Reducing and Mapping:: X * Vector and Matrix Formats:: X*************** X*** 6641,6647 **** X @pindex calc-ident X The @kbd{v i} (@code{calc-ident}) function builds an identity matrix of X the specified size. It is a convenient form of @code{calc-diag} where the X! diagonal element is always one. X X @kindex v x X @pindex calc-index X--- 9627,9634 ---- X @pindex calc-ident X The @kbd{v i} (@code{calc-ident}) function builds an identity matrix of X the specified size. It is a convenient form of @code{calc-diag} where the X! diagonal element is always one. If no prefix argument is given, this X! command prompts for one. X X @kindex v x X @pindex calc-index X*************** X*** 6649,6656 **** X The @kbd{v x} (@code{calc-index}) [@code{index}] function builds a vector X of consecutive integers from 1 to @var{n}, where @var{n} is the numeric X prefix argument. If you do not provide a prefix argument, you will be X! prompted to enter a suitable number. X X @kindex v b X @pindex calc-build-vector X @tindex cvec X--- 9636,9659 ---- X The @kbd{v x} (@code{calc-index}) [@code{index}] function builds a vector X of consecutive integers from 1 to @var{n}, where @var{n} is the numeric X prefix argument. If you do not provide a prefix argument, you will be X! prompted to enter a suitable number. If @var{n} is negative, the result X! is a vector of negative integers from @var{n} to -1. X X+ With a prefix argument of just @kbd{C-u}, the @kbd{v x} command takes X+ three values from the stack: @var{n}, @var{start}, and @var{incr} (with X+ @var{incr} at top-of-stack). Counting starts at @var{start} and increases X+ by @var{incr} for successive vector elements. If @var{start} or @var{n} X+ is in floating-point format, the resulting vector elements will also be X+ floats. Note that @var{start} and @var{incr} may in fact be any kind X+ of numbers or formulas. X+ X+ When @var{start} and @var{incr} are specified, a negative @var{n} has a X+ different interpretation: It causes a geometric instead of arithmetic X+ sequence to be generated. For example, @samp{index(-3, a, b)} produces X+ @samp{[a, a b, a b^2]}. If you omit @var{incr} in the algebraic form, X+ @samp{index(@var{n}, @var{start})}, the default value for @var{incr} X+ is one for positive @var{n} or two for negative @var{n}. X+ X @kindex v b X @pindex calc-build-vector X @tindex cvec X*************** X*** 6658,6718 **** X vector of @var{n} copies of the value on the top of the stack, where @var{n} X is the numeric prefix argument. In algebraic formulas, @samp{cvec(x,n,m)} X can also be used to build an @var{n}-by-@var{m} matrix of copies of @var{x}. X! X! @kindex v a X! @pindex calc-arrange-vector X! @tindex arrange X! @cindex Arranging a matrix X! @cindex Reshaping a matrix X! @cindex Flattening a matrix X! The @kbd{v a} (@code{calc-arrange-vector}) [@code{arrange}] function X! rearranges a vector to have a certain number of columns and rows. The X! numeric prefix argument specifies the number of columns; if you do not X! provide an argument, you will be prompted for the number of columns. X! The vector or matrix on the top of the stack is @dfn{flattened} into a X! plain vector. If the number of columns is nonzero, this vector is X! then formed into a matrix by taking successive groups of @var{n} elements. X! If the number of columns does not evenly divide the number of elements X! in the vector, the last row will be short and the result will not be X! suitable for use as a matrix. For example, with the matrix X! @samp{[[1, 2], [3, 4]]} on the stack, @kbd{v a 4} produces X! @samp{[[1, 2, 3, 4]]} (a 1x4 matrix), @kbd{v a 1} produces X! @samp{[[1], [2], [3], [4]]} (a 4x1 matrix), @kbd{v a 2} produces X! @samp{[[1, 2], [3, 4]]} (the original 2x2 matrix), @kbd{v a 3} produces X! @samp{[[1, 2, 3], [4]]} (not a matrix), and @kbd{v a 0} produces X! the flattened list @samp{[1, 2, 3, 4]}. X! X! @kindex v s X! @kindex I v s X! @pindex calc-sort X! @tindex sort X! @tindex rsort X! The @kbd{v s} (@code{calc-sort}) [@code{sort}] function sorts the elements of X! a vector into increasing order. Non-real vector elements are sorted X! according to a kind of lexicographic ordering. The @kbd{I v s} [@code{rsort}] X! function sorts a vector into decreasing order. X! X! @kindex v h X! @pindex calc-histogram X! The @kbd{v h} (@code{calc-histogram}) [@code{histogram}] function builds a X! histogram of a vector of numbers. Vector elements are assumed to be X! integers or real numbers in the range [0..@var{n}) for some ``number of X! bins'' @var{n}, which is the numeric prefix argument given to the X! command. The result is a vector of @var{n} counts of how many times X! each value appeared in the original vector. Non-integers in the input X! are rounded down to integers. Any vector elements outside the specified X! range are ignored. (You can tell if elements have been ignored by checking X! that the elements in the result vector add up to the length of the input X! vector.) X X! With the Hyperbolic flag, @kbd{v h} pulls two vectors from the stack. X! The second-to-top vector is the list of numbers as before. The top X! vector is an equal-sized list of ``weights'' to attach to the elements X! of the data vector. For example, if the first data element is 4.2 and X! the first weight is 10, then 10 will be added to bin 4 of the result X! vector. Without the hyperbolic flag, every element has a weight of one. X X! @node Extracting Elements, Vector and Matrix Arithmetic, Building Vectors, Matrix Functions X @section Extracting Vector and Matrix Elements X X @kindex v r X--- 9661,9687 ---- X vector of @var{n} copies of the value on the top of the stack, where @var{n} X is the numeric prefix argument. In algebraic formulas, @samp{cvec(x,n,m)} X can also be used to build an @var{n}-by-@var{m} matrix of copies of @var{x}. X! (Interactively, just use @kbd{v b} twice: once to build a row, then again X! to build a matrix of copies of that row.) X X! @pindex calc-head X! @pindex caic-tail X! @tindex head X! @tindex tail X! The @code{calc-head} [@code{head}] function returns the first element X! of a vector. The @code{calc-tail} [@code{tail}] function returns the X! vector with its first element removed. In both cases, the argument X! must be a non-empty vector. X! X! @pindex calc-cons X! @tindex cons X! The @code{calc-cons} [@code{cons}] function takes a value @var{h} and a X! vector @var{t} from the stack, and produces the vector whose head is X! @var{h} and whose tail is @var{t}. This is similar to @kbd{|}, except X! if @var{h} is itself a vector, @kbd{|} will concatenate the two vectors X! whereas @code{cons} will insert @var{h} at the front of the vector @var{t}. X X! @node Extracting Elements, Manipulating Vectors, Building Vectors, Matrix Functions X @section Extracting Vector and Matrix Elements X X @kindex v r X*************** X*** 6725,6730 **** X--- 9694,9711 ---- X The matrix or vector is replaced by the specified row or element in the X form of a vector or scalar, respectively. X X+ @cindex Permutations, applying X+ With a prefix argument of @kbd{C-u} only, @kbd{v r} takes the index of X+ the element or row from the top of the stack, and the vector or matrix X+ from the second-to-top position. If the index is itself a vector of X+ integers, the result is a vector of the corresponding elements of the X+ input vector, or a matrix of the corresponding rows of the input matrix. X+ This command can be used to obtain any permutation of a vector. X+ X+ With @kbd{C-u}, if the index is an interval form with integer components, X+ it is interpreted as a range of indices and the corresponding subvector or X+ submatrix is returned. X+ X @tindex mrrow X Given a negative prefix argument, @kbd{v r} instead deletes one row or X element from the matrix or vector on the top of the stack. Thus X*************** X*** 6749,6754 **** X--- 9730,9760 ---- X extract the row as a vector, then @kbd{v c} to extract the column element X from that vector. X X+ @kindex v s X+ @pindex calc-subvector X+ @tindex subvec X+ The @kbd{v s} (@code{calc-subvector}) [@code{subvec}] command extracts X+ a subvector of a vector. The arguments are the vector, the starting X+ index, and the ending index, with the ending index in the top-of-stack X+ position. The starting index indicates the first element of the vector X+ to take. The ending index indicates the first element @emph{past} the X+ range to be taken. Thus, @samp{subvec([a, b, c, d, e], 2, 4)} produces X+ the subvector @samp{[b, c]}. You could get the same result using X+ @samp{mrow([a, b, c, d, e], [2 .. 4))}. X+ X+ If either the start or the end index is zero or negative, it is X+ interpreted as relative to the end of the vector. Thus X+ @samp{subvec([a, b, c, d, e], 2, -2)} also produces @samp{[b, c]}. In X+ the algebraic form, the end index can be omitted in which case it X+ is taken as zero, i.e., elements from the starting element to the X+ end of the vector are used. X+ X+ @xref{Selecting Subformulas}, for an alternative way to operate on X+ vectors one element at a time. X+ X+ @node Manipulating Vectors, Vector and Matrix Arithmetic, Extracting Elements, Matrix Functions X+ @section Manipulating Vectors X+ X @kindex v l X @pindex calc-vlength X @tindex vlen X*************** X*** 6757,6763 **** X Note that matrices are just vectors of vectors for the purposes of this X command.@refill X X! @node Vector and Matrix Arithmetic, Reducing and Mapping, Extracting Elements, Matrix Functions X @section Vector and Matrix Arithmetic X X Basic arithmetic operations like addition and multiplication are defined X--- 9763,9933 ---- X Note that matrices are just vectors of vectors for the purposes of this X command.@refill X X! @kindex v f X! @pindex calc-vector-find X! @tindex find X! The @kbd{v f} (@code{calc-vector-find}) [@code{find}] command searches X! along a vector for the first element equal to a given target. The target X! is on the top of the stack; the vector is in the second-to-top position. X! If a match is found, the result is the index of the matching element. X! Otherwise, the result is zero. The numeric prefix argument, if given, X! allows you to select any starting index for the search. X! X! @kindex v a X! @pindex calc-arrange-vector X! @tindex arrange X! @cindex Arranging a matrix X! @cindex Reshaping a matrix X! @cindex Flattening a matrix X! The @kbd{v a} (@code{calc-arrange-vector}) [@code{arrange}] command X! rearranges a vector to have a certain number of columns and rows. The X! numeric prefix argument specifies the number of columns; if you do not X! provide an argument, you will be prompted for the number of columns. X! The vector or matrix on the top of the stack is @dfn{flattened} into a X! plain vector. If the number of columns is nonzero, this vector is X! then formed into a matrix by taking successive groups of @var{n} elements. X! If the number of columns does not evenly divide the number of elements X! in the vector, the last row will be short and the result will not be X! suitable for use as a matrix. For example, with the matrix X! @samp{[[1, 2], [3, 4]]} on the stack, @kbd{v a 4} produces X! @samp{[[1, 2, 3, 4]]} (a 1x4 matrix), @kbd{v a 1} produces X! @samp{[[1], [2], [3], [4]]} (a 4x1 matrix), @kbd{v a 2} produces X! @samp{[[1, 2], [3, 4]]} (the original 2x2 matrix), @kbd{v a 3} produces X! @samp{[[1, 2, 3], [4]]} (not a matrix), and @kbd{v a 0} produces X! the flattened list @samp{[1, 2, 3, 4]}. X! X! @cindex Sorting data X! @kindex V S X! @kindex I V S X! @pindex calc-sort X! @tindex sort X! @tindex rsort X! The @kbd{V S} (@code{calc-sort}) [@code{sort}] command sorts the elements of X! a vector into increasing order. Non-real vector elements are sorted X! according to a kind of lexicographic ordering. Useful properties of X! this ordering are that variables are sorted into alphabetical order, X! and one vector is less or greater than another if the first corresponding X! unequal elements are less or greater, respectively. Since quoted strings X! are stored by Calc internally as vectors of ASCII character codes X! (@pxref{Strings}), this means strings are also sorted in alphabetical X! order by this command. X! X! The @kbd{I V S} [@code{rsort}] command sorts a vector into decreasing order. X! X! @cindex Permutation, inverse of X! @cindex Inverse of permutation X! @cindex Index tables X! @cindex Rank tables X! @kindex V G X! @kindex I V G X! @pindex calc-grade X! @tindex grade X! @tindex rgrade X! The @kbd{V G} (@code{calc-grade}) [@code{grade}, @code{rgrade}] command X! produces an index table or permutation vector which, if applied to the X! input vector (as the index of @kbd{C-u v r}, say), would sort the vector. X! A permutation vector is just a vector of integers from 1 to @var{n}, where X! each integer occurs exactly once. One application of this is to sort a X! matrix of data rows using one column as the sort key; extract that column, X! grade it with @kbd{V G}, then use the result to reorder the original matrix X! with @kbd{C-u v r}. Another interesting property of the @code{V G} command X! is that, if the input is itself a permutation vector, the result will X! be the inverse of the permutation. The inverse of an index table is X! a rank table, whose @var{k}th element says where the @var{k}th original X! vector element will rest when the vector is sorted. To get a rank X! table, just use @kbd{V G V G}. X! X! With the Inverse flag, @kbd{I V G} produces an index table that would X! sort the input into decreasing order. Note that @kbd{V S} and @kbd{V G} X! use a ``stable'' sorting algorithm, i.e., any two elements which are equal X! will not be moved out of their original order. Generally there is no way X! to tell with @kbd{V S}, since two elements which are equal look identical, X! but with @kbd{V G} this can be an important issue. In the matrix-of-rows X! example, suppose you have names and telephone numbers as two columns and X! you wish to sort by phone number primarily, and by name when the numbers X! are equal. You can sort the data matrix by names first, and then again X! by phone numbers. Because the sort is stable, any two rows with equal X! phone numbers will remain sorted by name even after the second sort. X! X! @cindex Histograms X! @kindex V H X! @pindex calc-histogram X! @tindex histogram X! The @kbd{V H} (@code{calc-histogram}) [@code{histogram}] command builds a X! histogram of a vector of numbers. Vector elements are assumed to be X! integers or real numbers in the range [0..@var{n}) for some ``number of X! bins'' @var{n}, which is the numeric prefix argument given to the X! command. The result is a vector of @var{n} counts of how many times X! each value appeared in the original vector. Non-integers in the input X! are rounded down to integers. Any vector elements outside the specified X! range are ignored. (You can tell if elements have been ignored by noting X! that the elements in the result vector don't add up to the length of the X! input vector.) X! X! @kindex H V H X! With the Hyperbolic flag, @kbd{V H} pulls two vectors from the stack. X! The second-to-top vector is the list of numbers as before. The top X! vector is an equal-sized list of ``weights'' to attach to the elements X! of the data vector. For example, if the first data element is 4.2 and X! the first weight is 10, then 10 will be added to bin 4 of the result X! vector. Without the hyperbolic flag, every element has a weight of one. X! X! @kindex v t X! @pindex calc-transpose X! @tindex trn X! The @kbd{v t} (@code{calc-transpose}) [@code{trn}] command computes X! the transpose of the matrix at the top of the stack. If the argument X! is a plain vector, it is treated as a row vector and transposed into X! a one-column matrix. X! X! @kindex v v X! @pindex calc-reverse-vector X! @tindex rev X! The @kbd{v v} (@code{calc-reverse-vector}) [@code{vec}] command reverses X! a vector end-for-end. Given a matrix, it reverses the order of the rows. X! (To reverse the columns instead, just use @kbd{v t v v v t}. The same X! principle can be used to apply other vector commands to the columns of X! a matrix.) X! X! @kindex v m X! @pindex calc-mask-vector X! @tindex vmask X! The @kbd{v m} (@code{calc-mask-vector}) [@code{vmask}] command uses X! one vector as a mask to extract elements of another vector. The mask X! is in the second-to-top position; the target vector is on the top of X! the stack. These vectors must have the same length. The result is X! the same as the target vector, but with all elements which correspond X! to zeros in the mask vector deleted. Thus, for example, X! @samp{vmask([1, 0, 1, 0, 1], [a, b, c, d, e])} produces @samp{[a, c, e]}. X! X! @kindex v e X! @pindex calc-expand-vector X! @tindex vexp X! The @kbd{v e} (@code{calc-expand-vector}) [@code{vexp}] command X! expands a vector according to another mask vector. The result is a X! vector the same length as the mask, but with nonzero elements replaced X! by successive elements from the target vector. The length of the target X! vector is normally the number of nonzero elements in the mask. If the X! target vector is longer, its last few elements are lost. If the target X! vector is shorter, the last few nonzero mask elements are left X! unreplaced in the result. Thus @samp{vexp([2, 0, 3, 0, 7], [a, b])} X! produces @samp{[a, 0, b, 0, 7]}. X! X! @kindex H v e X! With the Hyperbolic flag, @kbd{v e} takes a filler value from the X! top of the stack; the mask and target vectors come from the third and X! second elements of the stack. This filler is used where the mask is X! zero: @samp{vexp([2, 0, 3, 0, 7], [a, b], z)} produces X! @samp{[a, z, c, z, 7]}. X! X! Another variation on the masking idea is to combine @samp{[a, b, c, d, e]} X! with the mask @samp{[1, 0, 1, 0, 1]} to produce @samp{[a, 0, c, 0, e]}. X! You can accomplish this with @kbd{V M a &}, mapping the logical ``and'' X! operation across the two vectors. @xref{Logical Operations}. Note that X! the @code{? :} operation also discussed there allows other types of X! masking using vectors. X! X! @node Vector and Matrix Arithmetic, Reducing and Mapping, Manipulating Vectors, Matrix Functions X @section Vector and Matrix Arithmetic X X Basic arithmetic operations like addition and multiplication are defined X*************** X*** 6771,6784 **** X @code{re}, @code{im}, @code{polar}, @code{rect}, @code{clean}, X @code{float}, @code{frac}. @xref{Function Index}.@refill X X- @kindex v t X- @pindex calc-transpose X- @tindex trn X- The @kbd{v t} (@code{calc-transpose}) [@code{trn}] command computes X- the transpose of the matrix at the top of the stack. If the argument X- is a plain vector, it is treated as a row vector and transposed into X- a one-column matrix. X- X @kindex V J X @pindex calc-conj-transpose X The @kbd{V J} (@code{calc-conj-transpose}) [@code{ctrn}] command computes X--- 9941,9946 ---- X*************** X*** 6790,6796 **** X The @kbd{A} (@code{calc-abs}) [@code{abs}] command computes the X Frobenius norm of a vector or matrix argument. This is the square X root of the sum of the squares of the absolute values of the X! elements of the vector or matrix.@refill X X @kindex v n X @pindex calc-rnorm X--- 9952,9960 ---- X The @kbd{A} (@code{calc-abs}) [@code{abs}] command computes the X Frobenius norm of a vector or matrix argument. This is the square X root of the sum of the squares of the absolute values of the X! elements of the vector or matrix. If the vector is interpreted as X! a point in two- or three-dimensional space, this is the distance X! from that point to the origin.@refill X X @kindex v n X @pindex calc-rnorm X*************** X*** 6819,6828 **** X right-handed cross product of two vectors, each of which must have X exactly three elements. X X! @kindex V I X! @pindex calc-inv X! @tindex inv X! The @kbd{V I} (@code{calc-inv}) [@code{inv}] command computes the X inverse of a square matrix. If the matrix is singular, the inverse X operation is left in symbolic form. Matrix inverses are recorded so X that once an inverse (or determinant) of a particular matrix has been X--- 9983,9992 ---- X right-handed cross product of two vectors, each of which must have X exactly three elements. X X! @kindex & (matrices) X! @pindex calc-inv (matrices) X! @tindex inv (matrices) X! The @kbd{&} (@code{calc-inv}) [@code{inv}] command computes the X inverse of a square matrix. If the matrix is singular, the inverse X operation is left in symbolic form. Matrix inverses are recorded so X that once an inverse (or determinant) of a particular matrix has been X*************** X*** 6829,6837 **** X computed, the inverse and determinant of the matrix can be recomputed X quickly in the future. X X! If the argument to @kbd{V I} is a plain number @samp{x}, this X! command simply computes @samp{1/x}. The same operation is also X! available on the @kbd{&} key. X X @kindex V D X @pindex calc-mdet X--- 9993,10000 ---- X computed, the inverse and determinant of the matrix can be recomputed X quickly in the future. X X! If the argument to @kbd{&} is a plain number @samp{x}, this X! command simply computes @samp{1/x}. X X @kindex V D X @pindex calc-mdet X*************** X*** 6915,6921 **** X derives from Lisp notation and the theory of functions. Note that there X is no actual Calc function called @code{lambda}; the whole point is that X the @code{lambda} expression is used in its symbolic form, not evaluated X! for an answer.) X X @kindex V R X @pindex calc-reduce X--- 10078,10087 ---- X derives from Lisp notation and the theory of functions. Note that there X is no actual Calc function called @code{lambda}; the whole point is that X the @code{lambda} expression is used in its symbolic form, not evaluated X! for an answer.) (Actually, @code{lambda} does have one one special X! property: Its arguments are never evaluated; for example, putting X! @samp{lambda(x, x*(2+3))} on the stack will not simplify the @samp{2+3} X! until the @code{lambda} is actually applied to some value of @samp{x}.) X X @kindex V R X @pindex calc-reduce X*************** X*** 6929,6934 **** X--- 10095,10108 ---- X In general, reducing @code{f} over the vector @samp{[a, b, c, d]} produces X @samp{f(f(f(a, b), c), d)}. X X+ @kindex H V R X+ @tindex accum X+ The @kbd{H V R} command does an accumulation operation. Here Calc does X+ the corresponding reduction operation, but instead of producing only X+ the final result, it produces a vector of all the intermediate results. X+ Accumulating @code{+} over the vector @samp{[a, b, c, d]} produces the X+ vector @samp{[a, a + b, a + b + c, a + b + c + d]}. X+ X @kindex V M X @pindex calc-map X @tindex map X*************** X*** 6944,6949 **** X--- 10118,10145 ---- X the function requires. If you give an undefined name, you will be prompted X for the number of arguments to use.@refill X X+ @kindex V O X+ @pindex calc-outer-product X+ @tindex outer X+ The @kbd{V O} (@code{calc-outer-product}) command applies a given binary X+ operator to all possible pairs of elements from two vectors, to produce X+ a matrix. For example, @kbd{V O *} with @samp{[a, b]} and @samp{[x, y]} X+ on the stack produces a multiplication table @samp{[[a x, a y], [b x, b y]]}. X+ X+ @kindex V I X+ @pindex calc-inner-product X+ @tindex inner X+ The @kbd{V I} (@code{calc-inner-product}) command computes the generalized X+ inner product of two vectors or matrices, given a ``multiplicative'' X+ operator and an ``additive operator.'' These can each actually be any X+ binary operators; if they are @samp{*} and @samp{+}, respectively, the X+ result is a standard matrix multiplication. Each element of the result X+ is obtained by mapping the multiplicative operator across a row of the X+ lefthand matrix and a column of the righthand matrix, and then reducing X+ with the additive operator. Just as for the standard @kbd{*} command, X+ this can also do a vector-matrix or matrix-vector inner product, or a X+ generalized dot product of two plain vectors. X+ X @tindex add X @tindex sub X @tindex mul X*************** X*** 6953,6963 **** X @tindex mod X @tindex vconcat X In algebraic formulas, these operations can be expressed as X! @samp{apply(@var{oper}, @var{vec})}, X! @samp{reduce(@var{oper}, @var{vec})}, and X! @samp{map(@var{oper}, @var{v1}, @var{v2}, ...)}. X For example, @samp{map(gcd, [10,20,30], x)}. X! If @var{vec}, or all of the @var{v}'s, X are non-vectors, the expression is left in symbolic form. Here, @var{oper} X is any function name like @code{max} or @code{gcd}, or a @code{lambda} X expression as described above. Operators that are X--- 10149,10166 ---- X @tindex mod X @tindex vconcat X In algebraic formulas, these operations can be expressed as X! X! @example X! apply(@var{oper}, @var{vec}) X! reduce(@var{oper}, @var{vec}) X! accum(@var{oper}, @var{vec}) X! map(@var{oper}, @var{v1}, @var{v2}, ...) X! outer(@var{oper}, @var{vec1}, @var{vec2}) X! inner(@var{mul-oper}, @var{add-oper}, @var{vec1}, @var{vec2}) X! @end example X! X For example, @samp{map(gcd, [10,20,30], x)}. X! If any of the @var{vec}'s, or all of the @var{v}'s, X are non-vectors, the expression is left in symbolic form. Here, @var{oper} X is any function name like @code{max} or @code{gcd}, or a @code{lambda} X expression as described above. Operators that are X*************** X*** 7021,7027 **** X have set a mapping mode, that mode stays in effect until you change it. X The default mode is map-by-elements. The mapping mode is also used by X the @code{calc-reduce} command, as described in the next section. X! The mapping mode has no effect if the arguments are plain vectors. X X Use @kbd{m e} to select map-by-elements mode. In this mode, the operator X is applied to each element of the argument matrix, or to corresponding X--- 10224,10232 ---- X have set a mapping mode, that mode stays in effect until you change it. X The default mode is map-by-elements. The mapping mode is also used by X the @code{calc-reduce} command, as described in the next section. X! The mapping mode has no effect if the arguments are plain vectors, X! and it also has no effect on @kbd{V A}, @kbd{H V R}, @kbd{V O}, or X! @kbd{V I} commands. X X Use @kbd{m e} to select map-by-elements mode. In this mode, the operator X is applied to each element of the argument matrix, or to corresponding X*************** X*** 7060,7065 **** X--- 10265,10273 ---- X As another example, you could concatenate two matrices horizontally by X mapping @samp{|} (vector concatenation) by rows. X X+ The corresponding algebraic function names are @code{map}, @code{mapr}, X+ @code{mapc}, @code{mapa}, and @code{mapd}, respectively. X+ X @node Reducing Matrices, , Mapping Matrices, Reducing and Mapping X @subsection Reducing Matrices X X*************** X*** 7106,7112 **** X @section Vector and Matrix Display Formats X X Commands for controlling vector and matrix display use the @kbd{v} prefix X! instead of the usual @kbd{d} prefix. X X @kindex v < X @pindex calc-matrix-left-justify X--- 10314,10322 ---- X @section Vector and Matrix Display Formats X X Commands for controlling vector and matrix display use the @kbd{v} prefix X! instead of the usual @kbd{d} prefix. Note that matrix display is also X! influenced by the @kbd{d O} (@code{calc-flat-language}) mode; X! @pxref{Normal Language Modes}. X X @kindex v < X @pindex calc-matrix-left-justify X*************** X*** 7133,7139 **** X be used in preparation for yanking a matrix into a buffer running X Mathematica. (In fact, the Mathematica language mode uses this mode; X @pxref{Mathematica Language Mode}.) Note that, regardless of the X! display mode, either brackets and braces may be used to enter vectors, X and parentheses may never be used for this purpose.@refill X X @kindex v , X--- 10343,10349 ---- X be used in preparation for yanking a matrix into a buffer running X Mathematica. (In fact, the Mathematica language mode uses this mode; X @pxref{Mathematica Language Mode}.) Note that, regardless of the X! display mode, either brackets or braces may be used to enter vectors, X and parentheses may never be used for this purpose.@refill X X @kindex v , X*************** X*** 7141,7194 **** X The @kbd{v ,} (@code{calc-vector-commas}) command turns commas on and X off in vector and matrix display.@refill X X! @node Algebra, Units, Matrix Functions, Top X @chapter Algebra X X! The commands for operating on algebraic formulas use the @kbd{a} key X! prefix. @xref{Editing Stack Entries}, to see how to manipulate formulas X! using regular Emacs editing commands. X X! Many of these commands prompt for a variable name or formula. If you X! answer the prompt with a blank line, the variable or formula is taken X! from top-of-stack, and the normal argument for the command is taken X! from second-to-top. X X When doing algebraic work, you may find several of the Calculator's X! modes to be helpful, including algebraic-simplification mode (@kbd{m A}), X algebraic-entry mode (@kbd{m a}), fraction mode (@kbd{m f}), and X symbolic mode (@kbd{m s}). @xref{Mode Settings}, for discussions X of these modes. You may also wish to select ``big'' display mode (@kbd{d B}). X! @xref{Normal Language Modes}. X X @menu X * Algebraic Manipulation:: X- * Rewrite Rules:: X- * Logical Operations:: X * Calculus:: X @end menu X X! @node Algebraic Manipulation, Rewrite Rules, Algebra, Algebra X @section Algebraic Manipulation X X @kindex a s X @pindex calc-simplify X! The @kbd{a s} (@code{calc-simplify}) command applies various algebraic X! rules to simplify a formula. This generally entails combining like X! terms of sums and products. The result will be a formula which is X! mathematically equivalent to the original one, but somewhat simpler. X X @kindex a e X @pindex calc-simplify-extended X! The @kbd{a e} (@code{calc-simplify-extended}) command is like @kbd{a s} X except that it applies some additional simplifications which are not X ``safe'' in all cases. For example, powers are simplified according X to the rule @samp{(a^b)^c = a^(b c)}, even though this is not always X! true (consider @samp{sqrt(a^2)} for negative @samp{a}). The symbolic X integrator uses @code{calc-simplify-extended}; one effect of this is X that the integrator's results must be used with caution. Where an X integral table will often attach conditions like ``for positive @samp{a} X! only,'' Calc (and most other symbolic integration programs) will simply X! produce an unqualified result. X X @kindex a x X @pindex calc-expand X--- 10351,11489 ---- X The @kbd{v ,} (@code{calc-vector-commas}) command turns commas on and X off in vector and matrix display.@refill X X! @kindex v . X! @pindex calc-full-vectors X! The @kbd{v .} (@code{calc-full-vectors}) command turns abbreviated X! display of long vectors on and off. In this mode, vectors of six X! or more elements, or matrices of six or more rows or columns, will X! be displayed in an abbreviated form that displays only the first X! three elements and the last element: @samp{[a, b, c, ..., z]}. X! When very large vectors are involved this will substantially X! improve Calc's display speed. X! X! @kindex t . X! @pindex calc-full-trail-vectors X! The @kbd{t .} (@code{calc-full-trail-vectors}) command controls a X! similar mode for recording vectors in the Trail. If you turn on X! this mode, vectors of six or more elements and matrices of six or X! more rows or columns will be abbreviated when they are put in the X! Trail. The @kbd{t y} (@code{calc-trail-yank}) command will be X! unable to recover those vectors. If you are working with very X! large vectors, this mode will improve the speed of all operations X! that involve the trial. X! X! @kindex v / X! @pindex calc-break-vectors X! The @kbd{v /} (@code{calc-break-vectors}) command turns multi-line X! vector display on and off. Normally, matrices are displayed with one X! row per line but all other types of vectors are displayed in a single X! line. This mode causes all vectors, whether matrices or not, to be X! displayed with a single element per line. Sub-vectors within the X! vectors will still use the normal linear form. X! X! @node Graphics, Algebra, Matrix Functions, Top X! @chapter Graphics X! X! The commands for graphing data begin with the @kbd{g} prefix key. X! Calc uses GNUPLOT 2.0 to do graphics. These commands will only work X! if GNUPLOT is available on your system. While GNUPLOT sounds like X! a relative of GNU Emacs, it is actually completely unrelated. X! However, it is free software and can be obtained from the Free X! Software Foundation's machine @samp{prep.ai.mit.edu}. X! X! @vindex calc-gnuplot-name X! If you have GNUPLOT installed on your system but Calc is unable to X! find it, you may need to set the @code{calc-gnuplot-name} variable X! in your @file{.emacs} file. You may also need to set some Lisp X! variables to show Calc how to run GNUPLOT on your system; these X! are described at under @kbd{g D} and @kbd{g O} below. If you are X! using the X window system, Calc will configure GNUPLOT for you X! automatically. X! X! @kindex g f X! @pindex calc-graph-fast X! The easiest graphics command is @kbd{g f} (@code{calc-graph-fast}). X! This command takes two vectors of equal length from the stack. X! The vector at the top of the stack represents the ``y'' values of X! the various data points. The vector in the second-to-top position X! represents the corresponding ``x'' values. This command runs X! GNUPLOT (if it has not already been started by previous graphing X! commands) and displays the set of data points. The points will X! be connected by lines, and there will also be some kind of symbol X! to indicate the points themselves. X! X! The ``x'' entry may instead be an interval form, in which case suitable X! ``x'' values are interpolated between the minimum and maximum values of X! the interval (whether the interval is open or closed is ignored). X! X! The ``y'' entry may be any formula instead of a vector. Calc effectively X! uses @kbd{N} (@code{calc-eval-num}) to evaluate variables in the formula; X! the result of this must be a formula in a single (unassigned) variable. X! The formula is plotted with this variable taking on the various ``x'' X! values. Graphs of formulas by default use lines without symbols at the X! computed data points. Note that if neither ``x'' nor ``y'' is a vector, X! Calc guesses at a reasonable number of data points to use. See the X! @kbd{g N} command below. X! X! If ``y'' is a formula of the form @samp{xy(X, Y)}) then the result is a X! parametric plot. The two arguments of the fictitious @code{xy} function X! are used as the ``x'' and ``y'' coordinates of the curve, respectively. X! In this case the ``x'' vector or interval you specified is not directly X! visible in the graph. For example, if ``x'' is the interval @samp{[0..360]} X! and ``y'' is the formula @samp{xy(sin(t), cos(t))}, the resulting graph X! will be a circle. X! X! Also, ``x'' and ``y'' may each be variable names, in which case Calc X! looks for suitable vectors, intervals, or formulas stored in those X! variables. X! X! The ``x'' and ``y'' values for the data points (as pulled from the vectors, X! calculated from the formulas, or interpolated from the intervals) should X! be real numbers (integers, fractions, or floats). If either the ``x'' X! value or the ``y'' value of a given data point is not a real number, that X! data point will be omitted from the graph. The points on either side X! of the invalid point will @emph{not} be connected by a line. X! X! @cindex @code{PlotRejects} variable X! If you store an empty vector in the variable @code{PlotRejects} X! (i.e., @kbd{[ ] s PlotRejects}), Calc will append information to X! this record for every data point which was rejected because its X! ``x'' or ``y'' values were not real numbers. The result will be X! a matrix where each row holds the curve number, data point number, X! ``x'' value, and ``y'' value for a rejected data point. X! X! @kindex g c X! @pindex calc-graph-clear X! To clear the graphics display, type @kbd{g c} (@code{calc-graph-clear}). X! If the GNUPLOT output device is an X window, the window will go away. X! Effects on other kinds of output devices will vary. You don't need X! to use @kbd{g c} if you don't want to---if you give another @kbd{g f} X! or @kbd{g p} command later on, it will reuse the existing graphics X! window if there is one. X! X! The @kbd{g f} command is really shorthand for the following commands: X! @kbd{C-u g d g a g p}. You can gain more control over your graph X! by using these commands directly. X! X! @kindex g a X! @pindex calc-graph-add X! The @kbd{g a} (@code{calc-graph-add}) command adds the ``curve'' X! represented by the two values on the top of the stack to the current X! graph. You can have any number of curves in the same graph. When X! you give the @kbd{g p} command, all the curves will be drawn superimposed X! on the same axes. X! X! The @kbd{g a} command (and many others that affect the current graph) X! will cause a special buffer, @samp{*Gnuplot Commands*}, to be displayed X! in another window. This buffer is a template of the commands that will X! be sent to GNUPLOT when it is time to draw the graph. The first X! @kbd{g a} command adds a @code{plot} command to this buffer. Succeeding X! @kbd{g a} commands add extra curves onto that @code{plot} command. X! Other graph-related commands put other GNUPLOT commands into this X! buffer. In normal usage you never need to work with this buffer X! directly, but you can if you wish. The only constraint is that there X! must be only one @code{plot} command, and it must be the last command X! in the buffer. If you want to save and later restore a complete graph X! configuration, you can use regular Emacs commands to save and restore X! the contents of the @samp{*Gnuplot Commands*} buffer. X! X! If the values on the stack are not variable names, @kbd{g a} will invent X! variable names for them and store the values in those variables. X! The ``x'' and ``y'' variables are what go into the @code{plot} command X! in the template. If you add a curve that uses a certain variable and X! then later change that variable, you can replot the graph without having X! to delete and re-add the curve. That's because the variable name, not X! the vector, interval or formula itself, is what was added by @kbd{g a}. X! X! With a numeric prefix argument, the @kbd{g a} command interprets X! the value on the top of the stack as a vector of ``y'' values X! (which must each be either vectors, functions, or variable names). X! Each of these values, matched with the same common ``x'' value, X! is added as a separate curve to the current graph. For example, X! to plot @samp{sin(n x)} for integers @samp{n} from 1 to 5, you could X! use @kbd{v x} to create a vector of integers (@samp{n}), then @kbd{V M '} X! or @kbd{V M $} to map @samp{sin(n x)} across this vector. The X! resulting vector of formulas is suitable for use as the ``y'' argument X! to a @kbd{g a} command. A numeric prefix argument on @kbd{g f} has X! the same effect as one on @kbd{g a}. X! X! @kindex g d X! @pindex calc-graph-delete X! The @kbd{g d} (@code{calc-graph-delete}) command deletes the most X! recently added curve from the graph. It has no effect if there are X! no curves in the graph. With a numeric prefix argument of any kind, X! it deletes all of the curves from the graph. X! X! @kindex g j X! @pindex calc-graph-juggle X! This @kbd{g j} (@code{calc-graph-juggle}) command moves the curve X! at the end of the list (the ``most recently added curve'') to the X! front of the list. The next-most-recent curve is thus exposed for X! @kbd{g d} or similar commands to use. With @kbd{g j} you can work X! with any curve in the graph even though curve-related commands only X! affect the last curve in the list. X! X! @kindex g p X! @pindex calc-graph-plot X! The @kbd{g p} (@code{calc-graph-plot}) command uses GNUPLOT to draw X! the graph described in the @samp{*Gnuplot Commands*} buffer. Any X! GNUPLOT parameters which are not defined by commands in this buffer X! are reset to their default values. The variables named in the @code{plot} X! command are written to a temporary data file and the variable names X! are then replaced by the file name in the template. The resulting X! plotting commands are fed to the GNUPLOT program. See the documentation X! for the GNUPLOT program for more specific information. All temporary X! files are removed when plotting is finished. X! X! If you give a formula for ``y'', Calc will remember all the values that X! it calculates for the formula so that later plots can reuse these values. X! Calc throws out these saved values when you change any circumstances X! that may affect the data, such as switching from Degrees to Radians X! mode, or changing the value of a parameter in the formula. You can X! force Calc to recompute the data from scratch by giving a negative X! numeric prefix argument to @kbd{g p}. X! X! Calc uses a fairly rough step size when graphing formulas over intervals. X! This is to ensure quick response. You can ``refine'' a plot by giving X! a positive numeric prefix argument to @kbd{g p}. Calc goes through X! the data points it has computed and saved from previous plots of the X! function, and computes and inserts a new data point midway between X! each of the existing points. X! X! @kindex g P X! @pindex calc-graph-print X! The @kbd{g P} (@code{calc-graph-print}) command is like @kbd{g p}, X! except that it sends the output to a printer instead of to the X! screen. More precisely, @kbd{g p} looks for @samp{set terminal} X! or @samp{set output} commands in the @samp{*Gnuplot Commands*} buffer; X! lacking these it uses the default settings. However, @kbd{g P} X! ignores @samp{set terminal} and @samp{set output} commands and X! uses a different set of default values. All of these values are X! controlled by the @kbd{g D} and @kbd{g O} commands discussed below. X! Provided everything is set up properly, @kbd{g p} will plot to X! the screen unless you have specified otherwise and @kbd{g P} will X! always plot to the printer. X! X! @kindex g g X! @pindex calc-graph-grid X! The @kbd{g g} (@code{calc-graph-grid}) command turns the ``grid'' X! on and off. It is off by default; tick marks appear only at the X! edges of the graph. With the grid turned on, dotted lines appear X! across the graph at each tick mark. Note that this command only X! changes the setting in @samp{*Gnuplot Commands*}; to see the effects X! of the change you must give another @kbd{g p} command. X! X! @kindex g k X! @pindex calc-graph-key X! The @kbd{g k} (@code{calc-graph-key}) command turns the ``key'' X! on and off. The key is a chart in the corner of the graph that X! shows the correspondence between curves and line styles. It is X! off by default, and is only really useful if you have several X! curves on the same graph. X! X! @kindex g N X! @pindex calc-graph-num-points X! The @kbd{g N} (@code{calc-graph-num-points}) command allows you X! to select the number of data points in the graph. This only affects X! curves where neither ``x'' nor ``y'' is specified as a vector. X! Enter a blank line to revert to the default value (initially 15). X! With a numeric prefix argument this command changes or, if you enter X! a blank line, displays the default number of points used for all X! graphs that don't specify it explicitly. X! X! Data points in the graph of a function are normally computed to a X! precision of five digits, regardless of the current precision at X! the time. This is usually more than adequate, there are cases where X! it will not be. For example, plotting @samp{1 + x} for @samp{x} in the X! interval @samp{[0 .. 1e-6]} will round all the data points down X! to 1.0! Putting the command @samp{set precision @var{n}} in the X! @samp{*Gnuplot Commands*} buffer will cause the data to be computed X! at precision @var{n} instead of 5. Since this is such a rare case, X! there is no keystroke-based command to set the precision. X! X! @kindex g h X! @pindex calc-graph-header X! The @kbd{g h} (@code{calc-graph-header}) command sets the title X! for the graph. This will show up centered above the graph. X! The default title is blank (no title). X! X! @kindex g n X! @pindex calc-graph-name X! The @kbd{g n} (@code{calc-graph-name}) command sets the title of an X! individual curve. Like the other curve-manipulating commands, it X! affects the most recently added curve, i.e., the last curve on the X! list in the @samp{*Gnuplot Commands*} buffer. To set the title of X! the other curves you must first juggle them to the end of the list X! with @kbd{g j}, or edit the @samp{*Gnuplot Commands*} buffer by hand. X! Curve titles appear in the key; if the key is turned off they are X! not used. X! X! @kindex g t X! @kindex g T X! @pindex calc-graph-title-x X! @pindex calc-graph-title-y X! The @kbd{g t} (@code{calc-graph-title-x}) and @kbd{g T} X! (@code{calc-graph-title-y}) commands set the titles on the ``x'' X! and ``y'' axes, respectively. These titles appear next to the X! tick marks on the left and bottom edges of the graph, respectively. X! Calc does not have commands to control the tick marks themselves, X! but you can edit them into the @samp{*Gnuplot Commands*} buffer if X! you wish. See the GNUPLOT documentation for details. X! X! @kindex g r X! @kindex g R X! @pindex calc-graph-range-x X! @pindex calc-graph-range-y X! The @kbd{g r} (@code{calc-graph-range-x}) and @kbd{g R} X! (@code{calc-graph-range-y}) commands set the range of values on the X! ``x'' and ``y'' axes, respectively. You are prompted to enter a X! suitable range. This should be either a pair of numbers of the X! form, @samp{@var{min}:@var{max}}, or a blank line to revert to the X! default behavior of setting the range based on the range of values X! in the data, or @samp{$} to take the range from the top of the stack. X! Ranges on the stack can be represented as either interval forms or X! vectors: @samp{[@var{min} .. @var{max}]} or @samp{[@var{min}, @var{max}]}. X! X! @kindex g l X! @kindex g L X! @pindex calc-graph-log-x X! @pindex calc-graph-log-y X! The @kbd{g l} (@code{calc-graph-log-x}) and @kbd{g L} (@code{calc-graph-log-y}) X! commands allow you to set either or both of the axes of the graph to X! be logarithmic instead of linear. X! X! @kindex g s X! @pindex calc-graph-line-style X! The @kbd{g s} (@code{calc-graph-line-style}) command turns the connecting X! lines on or off for the most recently added curve, and optionally selects X! the style of lines to be used for that curve. Plain @kbd{g s} simply X! toggles the lines on and off. With a numeric prefix argument, @kbd{g s} X! turns lines on and sets a particular line style. Line style numbers X! start at one and their meanings vary depending on the output device. X! GNUPLOT guarantees that there will be at least six different line styles X! available for any device. X! X! @kindex g S X! @pindex calc-graph-point-style X! The @kbd{g S} (@code{calc-graph-point-style}) command similarly turns X! the symbols at the data points on or off, or sets the point style. X! If you turn both lines and points off, the data points will show as X! tiny dots. X! X! @kindex g D X! @pindex calc-graph-device X! The @kbd{g D} (@code{calc-graph-device}) command sets the device X! (or ``terminal'') name to be used by @kbd{g p} commands on this X! graph. It does not affect the permanent default device name. X! If you enter a blank name, the device name reverts to the default. X! Enter @samp{?} to see a list of supported devices. X! X! With a positive numeric prefix argument, @kbd{g D} instead sets X! the default device name, used by all plots in the future which do X! not override it with a plain @kbd{g D} command. If you enter a X! blank line this command shows you the current default. The special X! name @code{default} signifies that Calc should choose @code{x11} if X! the X window system is in use (as indicated by the presence of a X! @code{DISPLAY} environment variable), or otherwise @code{postscript}. X! This is the initial default value. X! X! With a negative numeric prefix argument, @kbd{g P} sets or displays X! the device name used by @kbd{g P} (@code{calc-graph-print}). This X! is initially @code{postscript}. X! X! @kindex g O X! @pindex calc-graph-output X! The @kbd{g O} (@code{calc-graph-output}) command sets the name of X! the output file used by GNUPLOT. For some devices, notably @code{x11}, X! there is no output file and this information is not used. Many other X! ``devices'' are really file formats like @code{postscript}; in these X! cases the output in the desired format goes into the file you name X! with @kbd{g O}. X! X! Once again, @kbd{g O} with a positive or negative prefix argument X! sets the default or printer output file names, respectively. In each X! case you can specify @code{auto}, which causes Calc to invent a temporary X! file name for each @kbd{g p} (or @kbd{g P}) command. This temporary file X! will be deleted once it has been displayed or printed. If the output file X! name is not @code{auto}, the file is not automatically deleted. X! X! The default and printer devices and output files can be saved X! permanently by the @kbd{m m} (@code{calc-save-modes}) command. The X! default number of data points (see @kbd{g N}) and the X geometry X! (see @kbd{g X}) are also saved. Other graph information is @emph{not} X! saved; you can save a graph's configuration simply by saving the contents X! of the @samp{*Gnuplot Commands*} buffer. X! X! @vindex calc-gnuplot-plot-command X! @vindex calc-gnuplot-default-device X! @vindex calc-gnuplot-default-output X! @vindex calc-gnuplot-print-command X! @vindex calc-gnuplot-print-device X! @vindex calc-gnuplot-print-output X! If you are installing Calc you may wish to configure the default and X! printer devices and output files for the whole system. The relevant X! Lisp variables are @code{calc-gnuplot-default-device} and @code{-output}, X! and @code{calc-gnuplot-print-device} and @code{-output}. The output X! file names must be either strings as described above, or Lisp X! expressions which are evaluated on the fly to get the output file name. X! X! Other important Lisp variables are @code{calc-gnuplot-plot-command} and X! @code{calc-gnuplot-print-command}, which give the system commands to X! display or print the output of GNUPLOT, respectively. These may be X! @code{nil} if no command is necessary, or strings which can include X! @samp{%s} to signify the name of the file to be displayed or printed. X! These variables may instead contain Lisp expressions which are evaluated X! to display or print the output. X! X! @kindex g x X! @pindex calc-graph-display X! The @kbd{g x} (@code{calc-graph-display}) command lets you specify X! on which X window system display your graphs should be drawn. Enter X! a blank line to see the current display name. This command has no X! effect unless the current device is @samp{x11}. X! X! @kindex g X X! @pindex calc-graph-geometry X! The @kbd{g X} (@code{calc-graph-geometry}) command is a similar X! command for specifying the position and size of the X window. X! The normal value is @samp{default}, which generally means your X! window manager will let you place the window interactively. X! Entering @samp{800x500+0+0} would create an 800-by-500 pixel X! window in the upper-left corner of the screen. X! X! There is another buffer called @samp{*Gnuplot Trail*} that holds a X! transcript of the session with GNUPLOT. This shows the commands Calc X! has ``typed'' to GNUPLOT and the responses it received. Calc tries to X! notice when an error message has appeared here and display the buffer X! for you when this happens. You can check this buffer yourself if you X! suspect something has gone wrong. X! X! @kindex g C X! @pindex calc-graph-command X! The @kbd{g C} (@code{calc-graph-command}) command prompts you to X! enter any line of text, then simply sends that line to the current X! GNUPLOT process. The @samp{*Gnuplot Trail*} buffer looks deceptively X! like a Shell buffer but you can't type commands in it yourself. X! Instead, you must use @kbd{g C} for this purpose. SHAR_EOF echo "End of part 16, continue with part 17" echo "17" > s2_seq_.tmp exit 0