Calc Update

I've written before that I've started learning Calc. That last post was after I'd worked through the introductory material (which is, itself, quite dense). I've now completed the first three sections of the tutorial covering

  • Basic Tutorial (RPN, stack, algebraic notation, Undo/Redo, Modes)
  • Arithmetic Tutorial (arithmetic and scientific functions)
  • Vector/Matrix/List Tutorial (operations on vectors and matrices)

It may seem that my progress is slow—that last post was two weeks ago—but there's a huge amount of material, especially in the last section. The basic and arithmetic tutorials are pretty much what you'd expect although you'd probably be surprised at how many different functions there are. The last section is astounding. For example, there is a function to calculate the dot product of two vectors but even if there weren't you could do the same operation using the map and reduce functions. In Elisp (but not Calc) terms that would be

(reduce #'+ (cl-mapcar #'* V1 V2))

There are lots of examples that don't have a simple, single command so these functions turn out to be really powerful and useful.

The tutorial has exercises, some of which could be from the Euler Project. They're not all that hard, thankfully, but some of them require careful thinking about before you can solve them. They're really useful for helping to cement some of the functions and techniques in your head.

I've already started using Calc in my day-to-day work. Where before I'd bring up a Lisp REPL or try to make do with Elisp, I now just pop into Calc and perform whatever calculations I need. It's nice that I don't have to worry about overflow and things like that. The only downside is that I still haven't internalized all the function codes. They are generally one or two characters and while some—like *, +, …—are obvious others are less so. For example VC is the cross product of two vectors and HL is \log_{10}. Fortunately, there's a cheat sheet that lists the most common commands.

I'm really enjoying working through the tutorial and am learning a lot. I'll post another status report when I've worked through more of the tutorial.

This entry was posted in General and tagged , . Bookmark the permalink.
  • abo-abo

    You know what's got consistent naming and the shortest answers on projecteuler? J: http://www.jsoftware.com/help/dictionary/partsofspeech.htm. There's a comint adaptation of j-console for Emacs as well as an org-babel back end.

    • jcs

      Looks interesting. So many languages, so little time.

  • grimnebulin2

    Calc is awesome. Last week I was looking over a co-worker's shoulder as he did some work on his Mac, and he needed to divide two large numbers for some reason. I watched impatiently as he laboriously located the calculator utility, then clicked each of the individual buttons for the digits and operators with his mouse. I thought "Damn, I could have had the answer in literally two seconds using Calc."

    • jcs

      Yup. As I said, I used to have to fire off Lisp and bring up a REPL for that sort of thing. Now I instantaneously pop into Calc and get the answer in a couple of seconds, just as you said. The Mac calculator app is nice enough but it can't compare to the ease and power of Calc.