Digital Math Workbook: Exploring Options (publ. 2023-12-20)
I've been working through practice problems in the little book "A Student's Guide to the Mathematics of Astronomy". I was doing this on paper at first but found that I was losing a lot of my very limited time correcting small arithmetic mistakes, along with pencil slips, that are only discovered twelve steps after they are made. So I started looking into ideal options for a digital math workbook. So far, I've played around with two approaches:
Emacs Org with Babel Source Blocks
Emacs Org has a feature where you can embed code in SRC blocks, and then execute them in the document, outputting results to another nearby block. Since Emacs has a built-in scientific calculator, with some CAS capabilities, I wondered if this system would work well for this use case.
The reality of the experience is, unfortunately, is a little less exciting than the idea. Babel does have calc support. However, it is almost completely undocumented, and I couldn't figure out how to do the most basic things I wanted to do. In particular, I couldn't figure out how to enter an algebriac expression like one would by pressing the apostrophe key while in Calc itself. Consequently, it seems one must enter all values as very simple stack items. Here is a screen shot:
Emacs org workbook
I like the idea of displaying some of the work RPN style, but I also need to be able to enter in some expressions in algebraic form.
Another difficulty is one must enter variables in the headers, and I don't know yet how to share variables across multiple headers.
One can, alternatively, use an elisp SRC block and use calc-eval to enter in any expression. However, it is kind of ugly because one must, apparently, pass in the variables as parameters, and the expression string uses $1, $2, etc. to refer to the parameters. So the source form of the expression doesn't end up looking much like a normal equation.
Seems like there is potential to this approach, but also a lot more that I would have to figure out, or maybe code myself.
Jupyter
Jupyter is a free software system that can run a math workbook in your browser. I'm having a good experience with this so far. Here is a screen shot:
Jupyter workbook
I don't want to code in Python, frankly, but if one is just entering math equations, it isn't too bad. Supposedly there is a common lisp Jupyter kernel, but I haven't been able to figure out how to get it to run, even from a Jupyter console in the terminal. And I'm not sure where I'm supposed to go for help either, as there doesn't seem to be a Libera chat channel available.
It is not Emacs, either, which makes editing not as fun. But the workbook keyboard shortcuts are very practical once you get them figured out. I noticed in Guix there is an Emacs package for Jupyter, which might be worth a look.