Math-Intensive Reports with GNU Emacs and Calc, Part 1

Learning some of the secrets of Emacs and its applications for creating magic with numbers and calculations.
Calc Does Units

Notice that my example kept track of units. It's able to do so because Calc also can perform symbolic algebra (a subject far too large for this small article) and treats the symbol "in" (inches) as an undetermined factor. Special operations are available to convert units. Calc knows about units and their conversion. For example, how many pints does a lake having 11,000 acre-feet of water contain? To find out, I first write out the volume in the given units:

$ WaterVolume := 11000. acre ft $

Now, if I type the expression WaterVolume => and evaluate it, I get this:

$ WaterVolume => 11000. acre ft $

Exactly what I typed in. Next, by putting the cursor over the acre unit, selecting (with j s and <codej m commands) the units expression (11000. acre ft) and invoking u c (units-convert), Calc will ask me what type of unit should be used in the conversion. I respond pt. Then Calc immediately changes the previous expression to this:

$ WaterVolume => 28674925714.3 pt $

Obviously, Calc knows how to convert an acre-foot to pints, and doing so is much quicker than describing it.

You don't have to use units at all if you don't want to. If you carefully define all your units up front and use them consistently throughout your report, Calc won't have to do any units munging. But it is useful for converting weird commercial units; it can be handy for converting, say, gas pipeline flow rates in MMSCFD into pounds mass per second.

More examples of Emacs/Calc magic will be presented in Part 2 of this article.

Resources

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

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

______________________

Webcast
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.

Learn More

Sponsored by AMD

White Paper
Red Hat White Paper: Using an Open Source Framework to Catch the Bad Guy

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.

Learn More

Sponsored by DLT Solutions