[INCLUDE TH/speedbar.blogme]
[SETFAVICON dednat4/dednat4-icon.png]
[SETFAVICON IMAGES/forthsun.png]
[#
(defun c () (interactive) (find-blogme3-sh0-if "eev-maxima"))
(defun u () (interactive) (find-blogme-upload-links "eev-maxima"))
;; http://anggtwu.net/eev-maxima.html
;; http://anggtwu.net/eev-maxima.html#luatree
;; http://anggtwu.net/eev-maxima.html#physicists-notation
;; http://anggtwu.net/eev-maxima.html#sly
;; file:///home/edrx/TH/L/eev-maxima.html
;;
;; «.index» (to "index")
;; «.eepitch-maxima» (to "eepitch-maxima")
;; «.find-angg-es-links» (to "find-angg-es-links")
;; «.elisp-hyperlinks» (to "elisp-hyperlinks")
;; «.embedding-in-LaTeX» (to "embedding-in-LaTeX")
;; «.physicists-notation» (to "physicists-notation")
;; «.substitution» (to "substitution")
;; «.luatree» (to "luatree")
;; «.maxima-by-example» (to "maxima-by-example")
;; «.sly» (to "sly")
#]
[lua:
require "sandwiches-all" -- (find-blogme3 "sandwiches-all.lua")
def [[ _ 2 shorthand,text R(short_:expand(shorthand), nilify(text) or shorthand) ]]
def [[ __ 1 shorthand short_:expand(shorthand) ]]
def [[ sup 1 body "$body" ]]
def [[ sub 1 body "$body" ]]
def [[ Delta 0 _ "Δ" ]]
def [[ cdot 0 _ "·" ]]
def [[ =/ 0 _ "😕" ]]
short_:add [[
eev -> index.html#eev
org-for-non-users -> 2021-org-for-non-users.html
eev2021-slides -> http://anggtwu.net/LATEX/2021emacsconf.pdf
eev2021 -> http://anggtwu.net/emacsconf2021.html
eepitch => (find-eev-quick-intro "6. Controlling shell-like programs")
eepitch -> eepitch.html
other-targets => (find-eev-quick-intro "6.2. Other targets")
eepitch-langs => (find-eev "eepitch.el" "eepitch-langs")
find-comintprocess => (find-eepitch-intro "2.4. `(eepitch-python)'")
fermin-talk -> https://emacsconf.org/2020/talks/33/
eepitch-pre => (find-eepitch-intro "3.3. `eepitch-preprocess-line'")
mailing-list -> https://sourceforge.net/p/maxima/mailman/maxima-discuss/
maxima.e => (find-es "maxima")
depend-email => (find-es "maxima" "depends-email")
depend-code => (find-es "maxima" "depends-email-code")
reader-1 => (find-es "maxima" "input-string-parser-output")
reader-2 => (find-es "maxima" "parse-string")
reader-3 => (find-es "maxima" "reader")
lambda-simp => (find-es "maxima" "lambda-simp")
dosimp-and-doeval => (find-es "maxima" "dosimp-and-doeval")
subst-c2intro -> http://anggtwu.net/LATEX/2021-2-C2-intro.pdf#page=8
subst-jan17 => (find-es "maxima" "email-subst-2022jan17")
comint => (find-eepitch-intro "2.5. `find-comintprocess'")
]]
def [[ PLEFT 1 body "
$body
" ]]
def [[ FIG 2 target,img "
" ]]
]
[SETHEADSTYLE [LUCIDA]]
[htmlize [J Eev hacks for Maxima]
[# ___ _
# |_ _|_ __ __| | _____ __
# | || '_ \ / _` |/ _ \ \/ /
# | || | | | (_| | __/> <
# |___|_| |_|\__,_|\___/_/\_\
#]
[NAME0 index
«index» (to ".index")
]
[lua:
def [[ section 3 tag,n,title "$n. $title" ]]
def [[ section 3 tag,n,title R("#$tag", "$n. $title") ]]
]
[P [BF Index:]
[LIST3
[section eepitch-maxima 1 eepitch-maxima]
[section find-angg-es-links 2 find-angg-es-links]
[section elisp-hyperlinks 3 Elisp hyperlinks]
[section embedding-in-LaTeX 4 Embedding in LaTeX]
[section physicists-notation 5 "Physicist's notation"]
[section substitution 6 Substitution]
[section luatree 7 Luatree]
[section maxima-by-example 8 Maxima by Example]
[section sly 9 Debugging the Lisp (with Sly)]
]
]
[br]
[# _ _ _
# ___ ___ _ __ (_) |_ ___| |__
# / _ \/ _ \ '_ \| | __/ __| '_ \
# | __/ __/ |_) | | || (__| | | |
# \___|\___| .__/|_|\__\___|_| |_|
# |_|
#]
[NAME0 eepitch-maxima
«eepitch-maxima» (to ".eepitch-maxima")
]
[H2 1. eepitch-maxima]
[P I use [_ eepitch] to send lines from Emacs to Maxima; see the
figure below for the main idea, and my [_ eev2021 presentation] at the
EmacsConf2021 for the details. The [_ eepitch-langs definition of
eepitch-maxima] in eev is the simplest possible - just this:]
[NARROW [P
(defun eepitch-maxima () (interactive) ([_ comint eepitch-comint] "maxima" "maxima"))
]]
[P I tried to write variants that used Fermin MF's [_ fermin-talk
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.]
[PLEFT
[FIG http://anggtwu.net/LATEX/2021emacsconf.pdf
IMAGES/2021emacsconf-small.png]
]
[br]
[# __ _ _
# / _(_)_ __ __| | __ _ _ __ __ _ __ _ ___ ___
# | |_| | '_ \ / _` |_____ / _` | '_ \ / _` |/ _` |_____ / _ \/ __|
# | _| | | | | (_| |_____| (_| | | | | (_| | (_| |_____| __/\__ \
# |_| |_|_| |_|\__,_| \__,_|_| |_|\__, |\__, | \___||___/
# |___/ |___/
#]
[NAME0 find-angg-es-links
«find-angg-es-links» (to ".find-angg-es-links")
]
[H2 2. find-angg-es-links]
[lua:
-- (find-TH "eev-find-angg")
short_:add [[
find-angg-11:29 => (find-2022findeevanggvideo "11:29" "(find-angg-es-links)")
find-angg-15:14 => (find-2022findeevanggvideo "15:14" "we can run this eepitch-maxima")
find-angg-11:30 -> 2022-find-eev-angg.html#11:29
find-angg-15:14 -> 2022-find-eev-angg.html#15:14
]]
]
[P The video below explains a way to run my executable notes on Maxima
with eev [IT without downloading anything extra]. Click on the first
screenshot to go to the page about that video, and [COLOR red click on
the third screenshot] to play the very nice demo that starts at
15:14... or actually to read the subtitles of that part; then click on
the timemark to play the video.]
[P Click on the second screenshot to play (or to read the subtitles
of) the video starting from 11:30. That part has a [COLOR red very
technical] explanation of the "[IT ...without downloading anything
extra]" - not very recommended! [=/]]
[PLEFT
[FIG eev-find-angg.html
IMAGES/2022-find-eev-angg-small.png]
[FIG [__ find-angg-11:30]
IMAGES/2022-find-eev-angg-redef-small.png]
[FIG [__ find-angg-15:14]
IMAGES/2022-find-eev-angg-demo-small.png]
]
[br]
[# _ _ _ _ _ _
# ___| (_)___ _ __ | |__ _ _ _ __ ___ _ __| (_)_ __ | | _____
# / _ \ | / __| '_ \ | '_ \| | | | '_ \ / _ \ '__| | | '_ \| |/ / __|
# | __/ | \__ \ |_) | | | | | |_| | |_) | __/ | | | | | | | <\__ \
# \___|_|_|___/ .__/ |_| |_|\__, | .__/ \___|_| |_|_|_| |_|_|\_\___/
# |_| |___/|_|
#]
[NAME0 elisp-hyperlinks
«elisp-hyperlinks» (to ".elisp-hyperlinks")
]
[lua:
short_:add [[
find-maximamsg => (find-TH "find-maximamsg")
find-maximanode => (find-TH "find-maximanode")
sandwiches => (find-TH "blogme3-sandwiches")
]]
]
[H2 3. Elisp hyperlinks]
[P My notes on Maxima in [_ maxima.e] contain lots of elisp hyperlinks
like these ones,]
[BE'
(find-maximanode "makelist")
(find-maximamsg "37690886 202208 07" "RToy: doc/info/build-html-index.lisp")
]
[P that are [_ sandwiches htmlized in special ways]. They are
explained in these other pages: [_ find-maximanode], [_
find-maximamsg].]
[br]
[# _ _____ __ __
# | | __ |_ _|__\ \/ /
# | | / _` || |/ _ \\ /
# | |__| (_| || | __// \
# |_____\__,_||_|\___/_/\_\
#]
[NAME0 embedding-in-LaTeX
«embedding-in-LaTeX» (to ".embedding-in-LaTeX")
]
[H2 4. Embedding in LaTeX]
[lua:
-- _
-- ___ _ __ ___ __ ___ _(_)_ __ ___ __ _
-- / _ \ '_ ` _ \ / _` \ \/ / | '_ ` _ \ / _` |
-- | __/ | | | | | (_| |> <| | | | | | | (_| |
-- \___|_| |_| |_|\__,_/_/\_\_|_| |_| |_|\__,_|
--
short_:add [[
exerc-5-src => (find-LATEX "2021-2-C3-notacao-de-fisicos.tex" "exercicio-5-maxima")
exerc-5-latex => (find-LATEX "2021-2-C3-notacao-de-fisicos.tex" "exercicio-5-latex")
exerc-5-pdf -> http://anggtwu.net/LATEX/2021-2-C3-notacao-de-fisicos.pdf#page=26
emaxima.lua => (find-angg "LUA/emaxima.lua")
emaxima-conv => (find-angg ".emacs" "emaxima-conv")
emaxima-question => (find-es "maxima" "savemaximasession-0")
emaxima.sty => (find-angg "LATEX/emaxima.sty")
emaxima-lpeg -> https://emacsconf.org/2023/talks/repl/
]]
]
[P [_ exerc-5-src Here] is an example of how I am embedding Maxima
code in LaTeX files; the trick that makes eepitch ignore a prefix is
explained [_ eepitch-pre 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 [_ exerc-5-latex
this] LaTeX code, that becomes [_ exerc-5-pdf this] in the PDF. This
trick is based on the answers that I got for [_ emaxima-question this
question] that I sent to Maxima mailing list; note that 1) I am using
[_ emaxima.sty 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.]
[P TODO: explain why I gave up using emaxima.sty and how I switched to a
solution that uses [_ emaxima-lpeg Lpeg].]
[PLEFT
[FIG IMAGES/2022-emaxima-1.png
IMAGES/2022-emaxima-1-small.png]
[FIG IMAGES/2022-emaxima-2.png
IMAGES/2022-emaxima-2-small.png]
]
[br]
[# ____ _
# | _ \| |__ _ _ ___
# | |_) | '_ \| | | / __|
# | __/| | | | |_| \__ \
# |_| |_| |_|\__, |___/
# |___/
#]
[NAME0 physicists-notation
«physicists-notation» (to ".physicists-notation")
]
[H2 5. "Physicist's notation"]
[lua:
-- (find-books "__analysis/__analysis.el" "thompson")
-- (c3m211nfp 9 "omitir-nomes-2")
-- (c3m211nfa "omitir-nomes-2")
-- (find-ssr-links "gradefjan19" "2022jan19-gradef")
-- (code-eevvideo "gradefjan19" "2022jan19-gradef")
-- (code-eevlinksvideo "gradefjan19" "2022jan19-gradef")
-- (find-gradefjan19video "0:00")
-- (c3m212nfp 9 "regras-de-traducao")
-- (c3m212nfa "regras-de-traducao")
short_:add [[
thompson-depvar -> https://www.gutenberg.org/files/33283/33283-pdf.pdf#page=25
find-angg-11:30 => (find-2022findeevanggvideo "11:30" "(find-angg-es-links)")
find-angg-15:14 => (find-2022findeevanggvideo "15:14" "we can run this eepitch-maxima")
gradef-demo -> http://anggtwu.net/eev-videos/2022jan19-gradef.mp4
gradef-code => (find-es "maxima" "gradef")
(find-maximanode "Functions and Variables for Differentiation" ": gradef")
gradef-man -> https://maxima.sourceforge.io/docs/manual/maxima_95.html#index-gradef
(find-maximanode "Function")
function-man -> https://maxima.sourceforge.io/docs/manual/maxima_162.html
(find-maximanode "Introduction to Expressions")
expression-man -> https://maxima.sourceforge.io/docs/manual/maxima_29.html
C3-page -> 2021.2-C3.html
C3-trad -> http://anggtwu.net/LATEX/2021-2-C3-notacao-de-fisicos.pdf#page=9
(find-books "__analysis/__analysis.el" "redish-gupta")
redish-gupta-polar -> https://arxiv.org/pdf/1002.0472.pdf#page=3
pn1.mac => (find-angg "MAXIMA/pn1.mac")
blergh => (find-TH "blergh")
elaboration -> http://math.andrej.com/asset/data/the-dawn-of-formalized-mathematics.pdf#page=20
folium.e => (find-es "maxima" "implicit-diff")
]]
]
[P [COLOR red First version:] In 2022jan10 I sent to the Maxima
mailing list [_ depend-email this] big e-mail, that had two parts. In
the first part I asked about the (internal) differences between using
[_ expression-man expressions], like "f : x^2", and using [_
function-man functions], like "g(x) := x^3"; the code associated to
that part is [_ depend-code 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 [_ thompson-depvar 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
y[sub 1] is y[sub 1]=y(x[sub 1])=y(x[sub 0]+[Delta]x). It turns out
that [COLOR red YES,] Maxima supports physicists' notation, and it's
easy to translate calculations in PN to Maxima if we use [_ gradef-man
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 [_ gradef-demo here], and its code is [_ gradef-code here]. The
slides on PN that I prepared for my course on [_ C3-page Calculus 3]
are [_ C3-trad here].]
[P [COLOR red Second version (sep/2023):] my sample space is small -
about 25 people - but apparently in Brazil,]
[LIST2
[J "all" the "P"ure mathematicians ("group P") treat dependent
variables and differentials as abuses of language,]
[J "all" the "A"pplied mathematicians, physicists and engineers
("group A") treat dependent variables and differentials as
something that "everybody knows", and]
[J no one in either of the two groups knows the exact rules for
translating the language of "Calculus with dependent variables
and differentials" ("Calculus+") into the language of "Calculus
without dependent variables and differentials" ("Calculus-")...]
]
[P ...so "no one" here knows how write an "elaborator", in [_
elaboration 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.]
[P I'm [IT 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 [IT feels] like
the right way to treat dependent variables and differentials as
abbreviations. Here is a screenshot:]
[PLEFT [FIG IMAGES/2023-pn1-folium.png
IMAGES/2023-pn1-folium-small.png]
]
[br]
[# ____ _ _ _ _ _ _
# / ___| _ _| |__ ___| |_(_) |_ _ _| |_(_) ___ _ __
# \___ \| | | | '_ \/ __| __| | __| | | | __| |/ _ \| '_ \
# ___) | |_| | |_) \__ \ |_| | |_| |_| | |_| | (_) | | | |
# |____/ \__,_|_.__/|___/\__|_|\__|\__,_|\__|_|\___/|_| |_|
#]
[NAME0 substitution
«substitution» (to ".substitution")
]
[H2 6. Substitution]
[P My first attempts to understand how Maxima implements the "#$expr$"
syntax in Lisp are here: [_ reader-1 1], [_ reader-2 2], [_ reader-3
3]. Then Stavros Macrakis [_ dosimp-and-doeval explained] how I could
define "dosimp" and "doeval" and I produced the example below. Its
code is [_ dosimp-and-doeval here]. My long e-mail explaining why I am
teaching substitution in [_ subst-c2intro this way] is [_ subst-jan17
here] (includes gossip).]
[PLEFT
[FIG IMAGES/2022-maxima-doeval.png
IMAGES/2022-maxima-doeval-small.png]
]
[br]
[# _ _
# | | _ _ __ _| |_ _ __ ___ ___
# | | | | | |/ _` | __| '__/ _ \/ _ \
# | |__| |_| | (_| | |_| | | __/ __/
# |_____\__,_|\__,_|\__|_| \___|\___|
#]
[NAME0 luatree
«luatree» (to ".luatree")
]
[H2 7. Luatree]
[lua:
short_:add [[
(find-angg "luatree/README.org")
luatree.mac => (find-angg "luatree/luatree.mac")
luatree.lisp => (find-angg "luatree/luatree.lisp")
luatree.lua => (find-angg "luatree/luatree.lua")
luatree.py => (find-angg "luatree/luatree.py")
luatree.py -> https://github.com/edrx/luatree/blob/main/luatree.py
luatree.git -> https://github.com/edrx/luatree
luatree.git-intro -> https://github.com/edrx/luatree/#introduction
test-blocks -> eepitch.html
luatree-expl => (find-es "maxima" "luatree-explanation")
]]
]
[P To draw Maxima objects as trees - as in the first screenshot below
- I use a program that is made of three files: [_ luatree.mac], [_
luatree.lisp], [_ luatree.lua]. Its git repo is [_ luatree.git-intro
here], and you can test it by running the [_ test-blocks test block]
at the end of [_ luatree.mac]. There is an explanation of luatree [_
luatree-expl here].]
[P The screenshot at the right below shows a (primitive) port of
luatree to SymPy. Its code is here: [_ luatree.py].]
[PLEFT [FIG IMAGES/luatree.png
IMAGES/luatree-small.png]
[FIG IMAGES/luatree-sympy.png
IMAGES/luatree-sympy-small.png]
]
[br]
[# __ __ _ _ _____
# | \/ | __ ___ _(_)_ __ ___ __ _ | |__ _ _ | ____|_ __
# | |\/| |/ _` \ \/ / | '_ ` _ \ / _` | | '_ \| | | | | _| \ \/ /
# | | | | (_| |> <| | | | | | | (_| | | |_) | |_| | | |___ > <
# |_| |_|\__,_/_/\_\_|_| |_| |_|\__,_| |_.__/ \__, | |_____/_/\_\
# |___/
#]
[NAME0 maxima-by-example
«maxima-by-example» (to ".maxima-by-example")
]
[lua:
short_:add [[
mbe.e => (find-es "mbe")
mbe.html -> https://home.csulb.edu/~woollett/mbe.html
qdraw.pdf -> https://home.csulb.edu/~woollett/mbe13qdraw.pdf
mbe-download => (find-es "mbe" "download")
lissajous.e => (find-es "maxima" "C3-lissajous")
plot-and-draw => (find-maximawbpage (+ 20 32) "5 Graphical representation of functions")
parabola-boxes => (find-es "maxima" "parabola-boxes")
]]
]
[H2 8. Maxima by Example]
[P The best place for learning Maxima from examples is a (free) book
whose name is - ta-daaa! - [_ mbe.html Maxima by Example]. It is
divided into [_ mbe.html chapters], and my script to download a local
copy of it is [_ mbe-download here]. Its [_ qdraw.pdf chapter 13] is
about qdraw, that is a front-end to Maxima's [_ plot-and-draw 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 [_ lissajous.e this].]
[P The second screenshot shows a trajectory P(t) = (cos t, sin t), the
parabola Q(t) = P(0) + t[cdot]P'(0) + t[sup 2]/2[cdot]P''(0), and my
favorite trick - the boxes - for drawing parabolas by hand. Its code
is [_ parabola-boxes here].]
[PLEFT [FIG IMAGES/2023-qdraw-lissajous.png
IMAGES/2023-qdraw-lissajous-small.png]
[FIG IMAGES/2023-qdraw-parabola.png
IMAGES/2023-qdraw-parabola-small.png]
]
[br]
[# ____ _
# / ___|| |_ _
# \___ \| | | | |
# ___) | | |_| |
# |____/|_|\__, |
# |___/
#]
[NAME0 sly
«sly» (to ".sly")
]
[lua:
short_:add [[
Slime => (find-slimenode "")
Swank => (find-slimenode "Lisp-side")
Sly -> https://joaotavora.github.io/sly/
Slynk -> https://joaotavora.github.io/sly/#Lisp_002dside-customization
Swank-email -> https://def.fe.up.pt/pipermail/maxima-discuss/2012/042643.html
startsly => (find-angg ".maxima/startsly.lisp")
eepitch-sly => (find-eev "eepitch.el" "eepitch-sly")
]]
]
[H2 9. Debugging the Lisp (with Sly)]
[P 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 [_
eepitch-sly in this way], and I had to adapt [_ Swank-email these
instructions]. My code to use Sly and Slynk in Maxima is here: [_
startsly ~/.maxima/startsly.lisp].]
[P See also this: [R eev-sly.html].]
[br]
[br]
[br]
[br]
[br]
[br]
[br]
[br]
]
[#
# Local Variables:
# coding: raw-text-unix
# modes: (fundamental-mode blogme-mode)
# End:
#]