Math-Intensive Reports with GNU Emacs and Calc, Part 2
One aspect of Calc that is difficult to simulate properly for publication is its interactive behavior. In order to explain how to use Calc interactively in the static medium of the printed page, I had to resort in a couple of places to the trick of showing a line twice. The first is what I typed in the editing buffer before invoking Calc. The second is what I got back on the same line after invoking Calc. Therefore, if I run Calc a second time on the article file, it won't come out identical. This isn't generally a problem when preparing a report, because one is normally using Calc instead of trying to demonstrate it.
Emacs
General description: www.gnu.org/software/software.html
FTP mirror list & instructions for downloading: www.gnu.org/order/ftp.html
Emacs Wiki: www.emacswiki.org/cgi-bin/wiki.pl
NTEmacs
Download: ftp.gnu.org/gnu/windows/emacs
FAQ: www.cs.washington.edu/~voelker/ntemacs.html
Calc
Download: ftp.gnu.org/gnu/calc
Manual: www.cl.cam.ac.uk/texinfodoc/calc_toc.html
Cygwin Tools
Download: sources.redhat.com/cygwin
User's Guide: sources.redhat.com/cygwin/cygwin-ug-net/cygwin-ug-net.html
Emacs Lisp
The Emacs Lisp Archive: archive.cis.ohio-state.edu/pub/emacs-lisp
The Emacs Lisp List: thalamus.wustl.edu/wonglab/stephen/ell/ell.html
AucTeX
Download code and documentation: mirrors.sunsite.dk/auctex/www/auctex
Octave
Download code and documentation: www.octave.org
email: clhiii@attglobal.net
- « first
- ‹ previous
- 1
- 2
- 3
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Sponsored by AMD
Built-in forensics, incident response, and security with Red Hat Enterprise Linux 6
Every security policy provides guidance and requirements for ensuring adequate protection of information and data, as well as high-level technical and administrative security requirements for a system in a given environment. Traditionally, providing security for a system focuses on the confidentiality of the information on it. However, protecting the data integrity and system and data availability is just as important. For example, when processing United States intelligence information, there are three attributes that require protection: confidentiality, integrity, and availability.
Learn more about catching the bad guy in this free white paper.
Sponsored by DLT Solutions
| Designing Electronics with Linux | May 22, 2013 |
| Dynamic DNS—an Object Lesson in Problem Solving | May 21, 2013 |
| Using Salt Stack and Vagrant for Drupal Development | May 20, 2013 |
| Making Linux and Android Get Along (It's Not as Hard as It Sounds) | May 16, 2013 |
| Drupal Is a Framework: Why Everyone Needs to Understand This | May 15, 2013 |
| Home, My Backup Data Center | May 13, 2013 |
- New Products
- Linux Systems Administrator
- Senior Perl Developer
- Technical Support Rep
- UX Designer
- Web & UI Developer (JavaScript & j Query)
- Designing Electronics with Linux
- Dynamic DNS—an Object Lesson in Problem Solving
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- Using Salt Stack and Vagrant for Drupal Development
- Nice article, thanks for the
10 hours 33 min ago - I once had a better way I
16 hours 19 min ago - Not only you I too assumed
16 hours 37 min ago - another very interesting
18 hours 30 min ago - Reply to comment | Linux Journal
20 hours 23 min ago - Reply to comment | Linux Journal
1 day 3 hours ago - Reply to comment | Linux Journal
1 day 3 hours ago - Favorite (and easily brute-forced) pw's
1 day 5 hours ago - Have you tried Boxen? It's a
1 day 11 hours ago - seo services in india
1 day 15 hours ago
Enter to Win an Adafruit Pi Cobbler Breakout Kit for Raspberry Pi

It's Raspberry Pi month at Linux Journal. Each week in May, Adafruit will be giving away a Pi-related prize to a lucky, randomly drawn LJ reader. Winners will be announced weekly.
Fill out the fields below to enter to win this week's prize-- a Pi Cobbler Breakout Kit for Raspberry Pi.
Congratulations to our winners so far:
- 5-8-13, Pi Starter Pack: Jack Davis
- 5-15-13, Pi Model B 512MB RAM: Patrick Dunn
- 5-21-13, Prototyping Pi Plate Kit: Philip Kirby
- Next winner announced on 5-27-13!
Featured Jobs
| Linux Systems Administrator | Houston and Austin, Texas | Host Gator |
| Senior Perl Developer | Austin, Texas | Host Gator |
| Technical Support Rep | Houston and Austin, Texas | Host Gator |
| UX Designer | Austin, Texas | Host Gator |
| Web & UI Developer (JavaScript & j Query) | Austin, Texas | Host Gator |
Free Webinar: Hadoop
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Some of key questions to be discussed are:
- What is the “typical” Hadoop cluster and what should be installed on the different machine types?
- Why should you consider the typical workload patterns when making your hardware decisions?
- Are all microservers created equal for Hadoop deployments?
- How do I plan for expansion if I require more compute, memory, storage or networking?



Comments
Re: Math-Intensive Reports with GNU Emacs and Calc, Part 2
The author seemingly does not have worked extensively with calc. calc-2.02f does not work too well with Emacs-21. There are a lot of problems with symbolic simplifications, and some quirks with regard to input, scrolling and display.
For that reason, Emacs-21 users should, if at all, get calc directly from the Emacs CVS archive at Savannah.gnu.org where it is maintained as part of the next new-feature release of Emacs (probably 21.4). That version works quite better.
It is a pity that calc's author Dave Gillespie has stopped working on calc while still having a significantly faster (calc-2 does not even use Emacs' floating point variables!) and more extensive version of calc up his sleeves and already in use privately. If anybody manages to wheedle out those floppy disks or whatever else he has been storing this work on...
Re: Math-Intensive Reports with GNU Emacs and Calc, Part 2
You're correct, in that at the time I wrote the article I was quite inexperienced with Calc. Yes, I had noticed some problems on the symbolic side when using 2.02f with Emacs-21 (my setup). I thought it might be me, but you have confirmed the existence of a general problem. Thanks! And I also thank you for the pointer to the CVS version--and for the intelligence about Dave Gillespie's newer version. I, too, hope he takes steps to release it to the public.
But my article's emphasis was mostly on straight-ahead numerical evaluation, as that accounts for 95% or more of my typical usage. My setup works quite well for that, and I would advise anybody whose patterns of usage resembles mine not to be put off too much by the issues you quite correctly raise in your letter.
Thanks for the comments.
Charles Hethcoat, author.
Re: Math-Intensive Reports with GNU Emacs and Calc, Part 2
The auther writes:
"The only problem I had with it as a publication tool is that your input file requires #-style comment lines for documentation,
Re: Math-Intensive Reports with GNU Emacs and Calc, Part 2
Hi, everyone. I didn't realize until today that my article was already on-line! I appreciate the nice feedback.
Concerning the syntax of Calc: I repeat, I'm still fairly new to it, but my reading of the manual leads me to believe that it's probably configurable within elisp, but I haven't tried to figure out how. For my purposes, the `=>' is fine. In any event, you certainly can post-process these marks to taste within or without Emacs.
The only thing to keep in mind is whether you may need to re-process the file with Calc later on. (Remember my discussion of design changes?) You don't want to leave your master file damaged with respect to Calc's ability to read and process the formulas.
So if you create a filter to fix up the syntax, try to create the corresponding "unfilter" as well. Better still, create a processing pipeline to first /copy/ your file to another name and work on that one. Now your original remains untouched. When the need arises to update your original, just rerun your pipeline.
Charles Hethcoat
Re: Math-Intensive Reports with GNU Emacs and Calc, Part 2
You're right, Emacs certainly can auto-convert those comments. One would need to use something like:
M-x replace-regexp ^# RET RET
to remove all #s at the starts of words, and then
M-x replace-regexp ^[^$] RET # SPACE RET
to put them back again. (This assumes all lines start either with a Calc $ or a comment #, which may be incorrect - I haven't used Calc myself.)
But the author was referring to Octave, not to Emacs+Calc. He wrote:
"you need to perform some downstream editing with tools like sed or awk. Not at all difficult on UNIX but not easy on Windows, and the additional processing requires more steps than the combination of Emacs+Calc."
So the fact that it needs processing that could be easily done in Emacs may be precisely his point...
calc math syntax constraint
Thanks a lot. Very interesting article.
One question. Is there a way to get free of the calc package syntax constraint? I mean that in my report, i want to use the '=' caracter for assignments as well as for 'evaluates to' operations. For example, I want to see things like:
c = sqrt( a^2 + b^2 ) = 5.14003891036
and NOT:
c := sqrt(a^2 + b^2) => 5.14003891036
Is it possible, or are we stuck with one and only one syntax?
Re: calc math syntax constraint
Ok, done a bit of reading and the following should work
M-x replace-regexp RET:=|=>RET=RET
Do what you need to do to print the file then Ctrl-_ will set things back to how they were .
Hope that's of help
Euan
Re: calc math syntax constraint
BAH! Bloody stripped the backslash!
M-x replace-regexp RET :=BACKSLASH|=>RET=RET
Re: calc math syntax constraint
One possible solution is to run a regex-replace on the document prior to printing. I'm fairly new to Emacs so not too sure of the syntax for regex. In Vi it would look something like this:
1,$ s/=>|:=/=/g
Which tranlates to search the whole file for => or := and replace with =.
Once you've published it you can then hit Ctrl_ to undo the regex.
If anyone's read this and knows how to do it in Emacs regex then please post :-)
Re: calc math syntax constraint
oops, regex missing a backslash. Should read:
1,$ s/=>|:=/=/g
Sorry,
Euan
Re: calc math syntax constraint
OK, for reasons unknown the backlsash gets stripped when I post. Here we go once more:
1,$ s/=>BACKSLASH|:=/=/g
>sigh<
Re: calc math syntax constraint
Not that i know of... This syntax is used as a programming language one, rather than a symbolic one. And, as such, it has been elaborated since the early days of Pascal...