Chris Wellons on Emacs Calc

In a nice piece of ironic serendipity, I found this reference to an old Chris Wellons post on Calc while reading my feed with Chris Wellons’ excellent feed reader, elfeed.

As I written a several times, I really like calc and am always amazed at its power. I have a shortcut key for it in Emacs but usually end up just using “quick” mode. That’s mostly because the power of calc comes at the cost of a certain complexity and I don’t use it often enough to internalize its interface. It’s not that calc has a stack based RPN interface—my oldest “computer” was a programmable HP RPN calculator—it’s the sheer number of functions and their sometimes abstruse commands that I find difficult.

Getting better at calc is perpetually on my TODO list. One year it was even a New Year’s resolution but, alas, life intervened and I failed. Reading Wellons’ post, which is a series of examples showing the power of calc, has inspired me to once again try to really learn it. That’s probably going to involve using it more often than I normally would even if that use is “just for practice.” If you have the slightest use for a calculator or sometimes want to do symbolic mathematics, you should take a look at the post. It may inspire you, too, to spend some time learning it.

Update [2017-12-16 Sat 16:19]: Fixed link.

This entry was posted in General and tagged . Bookmark the permalink.
  • Wrong link, I think this is what you probably mean:

    • jcs

      Yes, fixed. Thanks.

  • Of course I don't remember how to do it now but I used to show my students how you could use calc-mode as a symbolic algebra system and set the output to TeX so they could just embed it in their homework.

    • jcs

      Here you go: Calc TeX and LaTeX mode. One of the things that earns you karma is that you educate your students to realize that maybe things like Eclipse aren't really the answer--or at least the only answer--for a practicing software engineer.

      • jcs

        Ooooh. Video idea.

      • Eclipse???? I don't think any teacher hate's their students that much!!!

        • jcs

          Happily, I speak entirely from ignorance as I've never used Eclipse or any other IDE. It was the first example that popped into my mind. I've been using vi/Vim and then Emacs so long I wouldn't know what to do with those flashing lights and buttons.

          • I've played with eclipse and talked to friends who live in it. If you are working in the Java ecosystem and you're 100% working on a large or large projects, all in Java and have a HUGE screen you can live in it 24/7 and be pretty productive.

            Once you go outside of it's wheelhouse though......

  • Phil

    A useful calc facility I've learned and repeatedly used in recent time is grabbing a rectangle from the current buffer into a calc vector, and then doing some vector operation (typically summing the values).

    That I learned this at all was on account of this blog -- (and the several steps of indirection involved there :) as I'd never encountered `calc-dispatch` until then.

    * C-x * invokes `calc-dispatch`
    * r creates a vector from the marked rectangle
    * V R invokes `calc-reduce` on that vector
    * ? shows you the available operators you can then use (e.g. `+` to sum)

    • jcs

      Your comment perfectly captures why I find it so hard to get good with calc: bazillions of not-at-all obvious commands to do pretty much whatever mathematical operation you need.

      I have F10 set to calc-dispatch and then usually invoke quick mode with a q. I'll probably never learn it all but I'd like to learn enough to do routine operations such as the one you describe.

      I know about calc-reduce but haven't internalized it enough to make it a natural thing to do the way you have.

      • Phil

        Agreed -- it took me a while to remember that sequence, as I wanted to use it occasionally but not regularly . I didn't forget that it was possible to do, but I can recall trying to work out what the calc-reduce command / key sequence was on several occasions, because I couldn't remember what to do once I had the vector...

        • Phil

          ...and I've just realised that calc-dispatch has keys specifically for summing rectangles -- : and _ call calc-grab-sum-down and calc-grab-sum-across respectively.

  • Phil

    And fresh from reddit we have: Andrew Hyatt’s emacs calc tutorials (sourced from an Emacs community I've never even looked at before).

    • jcs

      Nice. Maybe I'll do a post to point others to it. Another nice piece of serendipity that reddit should mention that now.

  • Mike F

    Is there any way to get the region summing functionality, with result displayed in the echo area of the minibuffer only? Would prefer to have no extra windows/frames/buffers opened as the result of a sum.

    • jcs

      At least with my two side-by-side windows configuration, the calc buffer splits the other window and then disappears when I type q (for quit). After the q, everything is back to the way it was before invoking calc.