Eev and Maxima
1. eepitch-maximaI use eepitch to send lines from Emacs to Maxima; see the figure below for the main idea, and my presentation at the EmacsConf2021 for the details. The definition of eepitch-maxima in eev is the simplest possible - just this:
I tried to write variants that used Fermin MF's maxima-mode instead of just comint, but his maxima-mode behaved in weird ways when it had to send empty lines, and we couldn't fix that easily... so I gave up. 2. find-angg-es-linksThe video below explains a way to run my executable notes on Maxima with eev without downloading anything extra: Click on the timestamps below to go to the best points of the (subtitles of the) video. The part that starts at 15:04 shows the demo in the third screenshot.
3. Maxima for studentsMy presentation at the EmacsConf 2024 was titled "Emacs, eev, and Maxima - Now!", where the "Now!" meant this:
My students are using the instructions and the "map" below to install WSL, Debian, Emacs, eev, and Maxima,
I teach Calculus 2 and Calculus 3, and the students are arriving on C2 without knowing how to take a particular case of a formula - which is obviously something that they will have to practice a lot... and now I can show them a screenshot like this, and send a link like this one in our Telegram channel:
And then one operation that we use a lot becames less abstract - they see that the [:=] that we use in class can be translated to Maxima using an infix operator "_s_", that is defined here - and they get something that they can practice at home. 4. Lazy nounsMaxima has a way to make certain operations "less active": for
example, The "noun version" of My students in Calculus 2 have so little practice with taking
particular cases that seeing a figure like that, that shows a
demonstration of the formula of the derivative of the inverse function
and its particular case that calculates 5. Elisp hyperlinksMy notes on Maxima in maxima.e contain lots of elisp hyperlinks like these ones,
that are htmlized in special ways. They are explained in these other pages: find-maximanode, find-maximamsg. 6. Embedding in LaTeXA newer update: see this page. An older update: my current way of LaTeXing Maxima code uses Lpeg. Its main module is here, Maxima2.lua, and it produces output like this from this input (plus tweaking). The rest of this section describes an older way. Here is an example of how I am embedding Maxima code in LaTeX files; the trick that makes eepitch ignore a prefix is explained here. If I execute that eepitch block skipping the lines "load" and "display2d" I get a human-friendly output, as in the first screenshot below; if I execute the lines "load" and "display2d" I get an output that I can process with M-x emaxima-conv (that calls emaxima.lua) to obtain this LaTeX code, that becomes this in the PDF. This trick is based on the answers that I got for this question that I sent to Maxima mailing list; note that 1) I am using this copy of emaxima.sty that has two lines commented out, and 2) my emaxima.lua is a quick hack, and it should be converted to elisp at some point. 7. "Physicist's notation"First version: In 2022jan10 I sent to the Maxima mailing list this big e-mail, that had two parts. In the first part I asked about the (internal) differences between using expressions, like "f : x^2", and using functions, like "g(x) := x^3"; the code associated to that part is here. In the second part I asked if, and how, Maxima supports "physicists' notation" - where "physicists' notation" ("PN") is my informal name for a notation that is common in old books like this one by Silvanus Thompson. In PN variables and functions can share the same names, variables can be "dependent", some arguments can be omitted, and several abbreviations are standard - for example, if y=y(x) then the default meaning for y1 is y1=y(x1)=y(x0+Δx). It turns out that YES, Maxima supports physicists' notation, and it's easy to translate calculations in PN to Maxima if we use gradef and subst in the right way to translate between PN and "mathematician's notation". I recorded a 20s video demo-ing this - it's here, and its code is here. The slides on PN that I prepared for my course on Calculus 3 are here. Second version (sep/2023): my sample space is small - about 25 people - but apparently in Brazil,
...so "no one" here knows how write an "elaborator", in this sense, that could translate "Calculus+" into "Calculus-". I grew up in Group A and my native language is "Calculus-", but now in my day job I'm teaching integration using books that use "Calculus+", and I thought that the best way to handle my embarassment for not speaking "Calculus+" well enough would be to formalize how that translation can be done. I'm sort of working on that, and I'm starting by writing some of its functions in Maxima; my functions are here: pn1.mac. That file is a bare prototype at the moment, but to me it feels like the right way to treat dependent variables and differentials as abbreviations. Here is a screenshot: 8. SubstitutionMy first attempts to understand how Maxima implements the "#$expr$" syntax in Lisp are here: 1, 2, 3. Then Stavros Macrakis explained how I could define "dosimp" and "doeval" and I produced the example below. Its code is here. My long e-mail explaining why I am teaching substitution in this way is here (includes gossip). 9. LispTree (and LuaTree)LispTree displays Maxima objects as trees. For example, if we run
it shows the definition of format as a tree in two different styles:
Its page is here.
10. Maxima by ExampleUpdate: See my page on (My)Qdraw. The best place for learning Maxima from examples is a (free) book whose name is - ta-daaa! - Maxima by Example. It is divided into chapters, and my script to download a local copy of it is here. Its chapter 13 is about qdraw, that is a front-end to Maxima's plot and draw commands. I find qdraw much easier to use than plot and draw; for example, the code for drawing the Lissajous figure below - with velocity and acceleration vectors! - is just this. The second screenshot shows a trajectory P(t) = (cos t, sin t), the parabola Q(t) = P(0) + t·P'(0) + t2/2·P''(0), and my favorite trick - the boxes - for drawing parabolas by hand. Its code is here. 11. QdrawUpdate: See my page on (My)Qdraw. Qdraw is easy to extend. I generated the animation below with these files:
Click on the animation to enlarge it; click here to see it in flipbook format. 12. Debugging the Lisp (with Sly)Most people use Slime and Swank to debug the Lisp code of Maxima. I couldn't make Slime work with eepitch, so instead of Slime and Swank I'm using Sly, Slynk, and an eepitch-sly defined in this way, and I had to adapt these instructions. My code to use Sly and Slynk in Maxima is here: ~/.maxima/startsly.lisp. My tutorial for making Sly work with Maxima is here: (find-try-sly-intro). Its last section -
shows - very briefly at the moment 🙁 - how we can use Sly to navigate Maxima's source files with `M-.', and how to get backtraces; in a backtrace we can inspect each stack frame, inspect the frame's local variables with the inspector, and even eval expressions in that frame. See also these pages: 2025-calling-lua-from-common-lisp.html, eev-sly.html. |