[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

*To*: seul-sci@seul.org*Subject*: [seul-sci] [Fwd: [seul-edu] Fw: gnuplot and GNU Emacs Calc]*From*: "Pete St. Onge" <pete@seul.org>*Date*: Tue, 02 Jan 2001 18:20:47 -0500*Delivery-Date*: Tue, 02 Jan 2001 18:21:44 -0500*Reply-To*: seul-sci@seul.org*Sender*: owner-seul-sci@seul.org

Happy New Year! Sorry to forward a forward, but I thought this might be rather relevant to some on this list. More to come shortly... Pete -- Pete St. Onge -------- Original Message -------- Subject: [seul-edu] Fw: gnuplot and GNU Emacs Calc Date: Tue, 02 Jan 2001 18:03:32 -0500 From: Douglas Loss <dloss@suscom.net> Reply-To: seul-edu@seul.org To: seul-edu@seul.org Here's a long message I received in response to the request in the latest Linux in education report for tutorials on the use of gnuplot: On Tue, 2 Jan 2001, Robert J. Chassell wrote: > GNU Emacs Calc mode runs gnuplot. You can create output for > an ascii terminal or for an X window or for a printer. > > The Calc manual has good lots of documentation. For example, > > The easiest graphics command is `g f' (`calc-graph-fast'). > > > This command takes two vectors of equal length from the > stack. > The vector at the top of the stack represents the "y" > values of > the various data points. The vector in the second-to-top > position > represents the corresponding "x" values. > > This command runs GNUPLOT (if it has not already been > started by > previous graphing commands) and displays the set of data > points. > The points will be connected by lines, and there will also > be some > kind of symbol to indicate the points themselves. > > I use gnuplot and Calc mode to compute least squares linear > regressions and then plot the actual data and the best fit > curve. > > Emacs Calc is a standard part of Emacs, but because of its > size is not > in most standard Emacs distributions (at 832 kilobytes, people > used to > think it huge... :) > > You can get it via ftp from > > alpha.gnu.org:/gnu/calc > > Mirror sites, and an Emacs expression so you can see the > directory > using ange-ftp: > > (dired "/ftp@aeneas.mit.edu:/pub/gnu" nil) > (dired "/ftp@ftp.cs.columbia.edu:/archives/gnu/prep" > nil) > (dired "/ftp@ftp.digex.net:/pub/gnu/" nil) > > > Besides graphing, arithmetic, matrixes operations, and so on, > Calc > simplifies algebraic expressions, does least squares linear > regressions, transcendentals, differentiation, and > integration. > > The Calc manual is in Texinfo format. This means you can read > it on > line in Emacs, or in HTML on a Web site, or print it out as a > (rather > big) nicely typeset book. > > (Actually, the manual is in two parts: a tutorial and a > reference > manual; you can print it as either one or as two books.) > > > Here are some notes > > > How to show mathematical expressions in different formats > ========================================================= > > > The `d N' (`calc-normal-language') command selects the usual > notation for Calc formulas > > `d B' (`calc-big-language') > > `d C' (`calc-c-language') > > `d T' (`calc-tex-language') > > For example: > > (a+1)/b + c^2 > > to > a + 1 2 > ----- + c > b > > and to > > (a + 1) / b + c ** 2 > > in place of `sqrt((a+1)/b + c^2)'. > > > Here is example for solving a quadratic equation of the form > for the > value of x, given a, b, and c: > > ax^2 + bx + c = 0 > > These following are all the same, but interconverted from one > to > another display mode using Emacs Calc. > > > Emacs Calc `Big' mode: > > ___________ > | 2 > (-b) +/- \| b - 4 ac > x = ---------------------- > 2 a > > > Emacs Calc `Normal' mode: > > x = (-b +/- sqrt(b^2 - 4 ac) / 2 a) > > Emacs Calc `TeX' mode: > > x = {-b \pm \sqrt{b^2 - 4 ac} \over 2 a} > > > Working in an email buffer: > --------------------------- > > Suppose you have this expression in your mail buffer: > > 0.6666-(4/15)*sqrt(10*pi^2*r^3/(D^2*G*m*epsilon)-1) > > In the mail buffer in which I am composing the message, I type > `M-# d' > (i.e., Press alt key and # key at the same time, then press > the d key) > > This duplicates the expression. I then type: > > M-# e > > to turn on Embedded Calc mode, and then type `m f' to keep the > fraction from being automatically converted to a float, and > then type > `d B', which converts the duplicated expression to this: > > ____________________ > | 2 3 > 4 | 10 pi r > 0.6666 - -- | -------------- - 1 > 15 | 2 > \| D G m epsilon > > which I find easier to read. (Also, I may type `d o' to > specify what > format to use for fractions, and `m s' to prevent early > evaluation of > symbolic forms. Just type them to see what happens.) > > Actually, after typing `m f' and `m B' the first time, each > time I > duplicate an expression like: > > (Q/(x*(1-e)^2))^(1/4) > > the duplicate is inserted in my email buffer in `big' mode. > > Q 1/4 > (----------) > 2 > x*(1 - e) > > (This is not as easy to read as the preceding expression, but > is easier than > the `flat' format.) > > > > > How to operate on each of a column of numbers > ============================================= > > > 21 April 1993, > Edward J. Hartnett asks: > > ... what would I do > to perform a simple mathematical manipulation on each, > specifically I > want to multiply each element by 174 and pop another vector > back into > my original document, so if I had: > > 1 > 2 > 3 > > I would be able to get > > 1 174 > 2 348 > 3 522 > > > Use the Calc mapping and yank commands; see File: calc.info, > Node: Mapping, and Node: Yanking Into Buffers, for more > information. > > You can record the sequence of commands in a keyboard macro; > or use > the `generate.el' library from the archives to create a elisp > function > that does the job, based on your keystrokes. The advantage of > an > elisp function is that you can edit it easily. > > > Commands Comments > > > M-# g grab the column as a vector and insert in > *Calc* buffer > > 174 insert number you want to multiply each > element by > > V M * Vector action, Mapped over each element, > Multiplication > > v u unpack vector so each element is on the stack > separately > See File: calc.info, Node: Packing and > Unpacking > > This results in separate items in the stack, each of which is > an > element of the original column, multiplied by 174. The *Calc* > buffer > looks like this: > > 3: 174 > 2: 348 > 1: 522 > > > You can yank the elements out of the *Calc* buffer in two ways > (with > my calc-version 2.02). > > If point in your working buffer is in the left most (i.e., > first > column) `C-u 3 M-# y' yanks out the top three elements of the > stack, > producing a column like this: > > 174 > 348 > 522 > > On the other hand, if point in your working buffer is not in > the left > most (i.e., not in the first column) `C-u 3 M-# y' yanks out > the top > three elements of the stack, and the line numbers, too: > > 3: 174 > 2: 348 > 1: 522 > > I don't understand why this is so and my documentation does > not > explain this. I don't know how this works in other versions > of Calc. > In any case, you want the column without the line numbers. > > You can copy your column to where ever you want it using Emacs > rectangle commands. > > I have bound `kill-rectangle' to `C-c k' and `yank-rectangle' > to > `yank-rectangle', which makes it very easy to move a rectangle > from > one place to another. Place point and mark around the column, > type > `M-x kill-rectangle', move mark to the upper left hand corner > of where > you want to insert the rectangle and type `M-x > yank-rectangle'. > > > > > Two other useful commands: > > V [ turn off brackets in vector in *Calc* buffer > See File: calc.info, Node: Vector and > Matrix Formats > > V , turn off commas in vector in *Calc* buffer > > > > > > > How to show "fixed-point" notation with two digits after the > decimal point > =========================================================================== > > > type > > M-2 d f > > To show "normal" notation with three significant digits, > type > > M-3 d n > > "scientific notation" d s > > "engineering notation" d e > > > To set precision: > > p 12 > > 12 is the default precision. Display format does not > effect precision. > > To measure angles in degrees: m d To measure angles in > radians: m r > > To convert degrees to radians: c r To convert radians to > degrees: c d > > To convert to "hexadecimal", or "base-16" form, > type: > > d r 16 <RET> > > Use `d r 2 <RET>' to see it in binary > Use `d r 10<RET>' to see it in base 10 > > > > Best wishes. > > -- > Robert J. Chassell bob@rattlesnake.com > Rattlesnake Enterprises > http://www.rattlesnake.com > -- Doug Loss The art of medicine consists of amusing the dloss@suscom.net patient while nature cures the disease. (570) 326-3987 Voltaire

- Next by Date:
**[seul-sci] Goings-on at SEUL/sci** - Next by thread:
**[seul-sci] Goings-on at SEUL/sci** - Index(es):