Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
####### # # E-scripts on Maxima by Example - mostly on setting it to use it with eev. # # Note 1: use the eev command (defined in eev.el) and the # ee alias (in my .zshrc) to execute parts of this file. # Executing this file as a whole makes no sense. # An introduction to eev can be found here: # # (find-eev-quick-intro) # http://anggtwu.net/eev-intros/find-eev-quick-intro.html # # Note 2: be VERY careful and make sure you understand what # you're doing. # # Note 3: If you use a shell other than zsh things like |& # and the for loops may not work. # # Note 4: I always run as root. # # Note 5: some parts are too old and don't work anymore. Some # never worked. # # Note 6: the definitions for the find-xxxfile commands are on my # .emacs. # # Note 7: if you see a strange command check my .zshrc -- it may # be defined there as a function or an alias. # # Note 8: the sections without dates are always older than the # sections with dates. # # This file is at <http://anggtwu.net/e/mbe.e> # or at <http://anggtwu.net/e/mbe.e.html>. # See also <http://anggtwu.net/emacs.html>, # <http://anggtwu.net/.emacs[.html]>, # <http://anggtwu.net/.zshrc[.html]>, # <http://anggtwu.net/escripts.html>, # and <http://anggtwu.net/>. # ####### # «.download» (to "download") # «.glue-chapters» (to "glue-chapters") # «.code-pdf-pages» (to "code-pdf-pages") # «.grim» (to "grim") # «.eepitch-prefix» (to "eepitch-prefix") # «.find-mbe-links» (to "find-mbe-links") ##### # # Download a copy of the book with wget --recursive # 2023jul18 # ##### # «download» (to ".download") # See: (find-psne-intro) The book is here: https://home.csulb.edu/~woollett/mbe.html It is divided into chapters. The PDFs of the individual chapters have URLs like these: https://home.csulb.edu/~woollett/mbe1intro.pdf https://home.csulb.edu/~woollett/mbe2plotfit.pdf https://home.csulb.edu/~woollett/mbe3ode1.pdf https://home.csulb.edu/~woollett/mbe4solve.pdf https://home.csulb.edu/~woollett/mbe5matrix.pdf https://home.csulb.edu/~woollett/mbe6calc1.pdf https://home.csulb.edu/~woollett/mbe7sint.pdf https://home.csulb.edu/~woollett/mbe8nint.pdf https://home.csulb.edu/~woollett/mbe9bfloat.pdf https://home.csulb.edu/~woollett/mbe10fltrans.pdf https://home.csulb.edu/~woollett/mbe11fft.pdf https://home.csulb.edu/~woollett/mbe12dirac3.pdf https://home.csulb.edu/~woollett/mbe13qdraw.pdf https://home.csulb.edu/~woollett/mbe14fit.pdf You need to download a local copy of this directory: https://home.csulb.edu/~woollett/ into: $S/https/home.csulb.edu/~woollett/ To do that, follow the instructions in this script: (find-wgetrecursive-links "https://home.csulb.edu/~woollett/") Then try: (find-sh-at-dir "/tmp/wget-recursive/" "find * | sort") (find-sh-at-dir "/tmp/wget-recursive/" "find * | sort | grep pdf") (find-sh-at-dir "$S/https/home.csulb.edu/~woollett/" "find * | sort") (find-sh-at-dir "$S/https/home.csulb.edu/~woollett/" "find * | sort | grep pdf") ##### # # Glue all chapters into a big PDF called mbe-all.pdf # 2023jul18 # ##### # «glue-chapters» (to ".glue-chapters") # Note that this: 1) needs qpdf, 2) is optional, and # 3) the big pdf will have lots of "page 1"s - one for # each chapter. # # See: https://github.com/qpdf/qpdf/issues/11#issuecomment-18768487 # qpdf --empty --pages $(for i in a*.pdf; do echo $i 1-z; done) -- b.pdf # (find-es "ps" "qpdf-merge") # (find-angg "LUA/QPDFMerge.lua") * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) # (find-fline "/tmp/mbe/") rm -Rv /tmp/mbe/ mkdir /tmp/mbe/ cd /tmp/mbe/ cp -v $S/https/home.csulb.edu/~woollett/mbe*.pdf . A=( mbe1intro mbe2plotfit mbe3ode1 mbe4solve mbe5matrix mbe6calc1 mbe7sint mbe8nint mbe9bfloat mbe10fltrans mbe11fft mbe12dirac3 mbe13qdraw mbe14fit ) qpdf --empty --pages $(for i in $A; do echo ${i}.pdf 1-z; done) -- mbe-all.pdf cp -v mbe-all.pdf $S/https/home.csulb.edu/~woollett/ ##### # # Define short hyperlinks to the chapters # 2023jul18 # ##### # «code-pdf-pages» (to ".code-pdf-pages") # See: (find-pdf-like-intro) Now either copy this block to your ~/.emacs or run it with eval-region: ;; From: (find-es "mbe" "code-pdf-pages") ;; This defines short hyperlinks to the chapters of Maxima by Example. (code-c-d "mbe" "$S/https/home.csulb.edu/~woollett/") (code-pdf-page "mbe" "$S/https/home.csulb.edu/~woollett/mbe-all.pdf") (code-pdf-text "mbe" "$S/https/home.csulb.edu/~woollett/mbe-all.pdf") (code-pdf-page "mbe01" "$S/https/home.csulb.edu/~woollett/mbe1intro.pdf") (code-pdf-text "mbe01" "$S/https/home.csulb.edu/~woollett/mbe1intro.pdf") (code-pdf-page "mbe02" "$S/https/home.csulb.edu/~woollett/mbe2plotfit.pdf") (code-pdf-text "mbe02" "$S/https/home.csulb.edu/~woollett/mbe2plotfit.pdf") (code-pdf-page "mbe03" "$S/https/home.csulb.edu/~woollett/mbe3ode1.pdf") (code-pdf-text "mbe03" "$S/https/home.csulb.edu/~woollett/mbe3ode1.pdf") (code-pdf-page "mbe04" "$S/https/home.csulb.edu/~woollett/mbe4solve.pdf") (code-pdf-text "mbe04" "$S/https/home.csulb.edu/~woollett/mbe4solve.pdf") (code-pdf-page "mbe05" "$S/https/home.csulb.edu/~woollett/mbe5matrix.pdf") (code-pdf-text "mbe05" "$S/https/home.csulb.edu/~woollett/mbe5matrix.pdf") (code-pdf-page "mbe06" "$S/https/home.csulb.edu/~woollett/mbe6calc1.pdf") (code-pdf-text "mbe06" "$S/https/home.csulb.edu/~woollett/mbe6calc1.pdf") (code-pdf-page "mbe07" "$S/https/home.csulb.edu/~woollett/mbe7sint.pdf") (code-pdf-text "mbe07" "$S/https/home.csulb.edu/~woollett/mbe7sint.pdf") (code-pdf-page "mbe08" "$S/https/home.csulb.edu/~woollett/mbe8nint.pdf") (code-pdf-text "mbe08" "$S/https/home.csulb.edu/~woollett/mbe8nint.pdf") (code-pdf-page "mbe09" "$S/https/home.csulb.edu/~woollett/mbe9bfloat.pdf") (code-pdf-text "mbe09" "$S/https/home.csulb.edu/~woollett/mbe9bfloat.pdf") (code-pdf-page "mbe10" "$S/https/home.csulb.edu/~woollett/mbe10fltrans.pdf") (code-pdf-text "mbe10" "$S/https/home.csulb.edu/~woollett/mbe10fltrans.pdf") (code-pdf-page "mbe11" "$S/https/home.csulb.edu/~woollett/mbe11fft.pdf") (code-pdf-text "mbe11" "$S/https/home.csulb.edu/~woollett/mbe11fft.pdf") (code-pdf-page "mbe12" "$S/https/home.csulb.edu/~woollett/mbe12dirac3.pdf") (code-pdf-text "mbe12" "$S/https/home.csulb.edu/~woollett/mbe12dirac3.pdf") (code-pdf-page "mbe13" "$S/https/home.csulb.edu/~woollett/mbe13qdraw.pdf") (code-pdf-text "mbe13" "$S/https/home.csulb.edu/~woollett/mbe13qdraw.pdf") (code-pdf-page "mbe14" "$S/https/home.csulb.edu/~woollett/mbe14fit.pdf") (code-pdf-text "mbe14" "$S/https/home.csulb.edu/~woollett/mbe14fit.pdf") ;; ;; Tests: ;; (find-mbefile "") ;; (find-mbepage) ;; (find-mbetext) ;; (find-mbe01page) ;; (find-mbe01text) ;; (find-mbe02page) ;; (find-mbe02text) ;; (find-mbe03page) ;; (find-mbe03text) ;; (find-mbe04page) ;; (find-mbe04text) ;; (find-mbe05page) ;; (find-mbe05text) ;; (find-mbe06page) ;; (find-mbe06text) ;; (find-mbe07page) ;; (find-mbe07text) ;; (find-mbe08page) ;; (find-mbe08text) ;; (find-mbe09page) ;; (find-mbe09text) ;; (find-mbe10page) ;; (find-mbe10text) ;; (find-mbe11page) ;; (find-mbe11text) ;; (find-mbe12page) ;; (find-mbe12text) ;; (find-mbe13page) ;; (find-mbe13text) ;; (find-mbe14page) ;; (find-mbe14text) # (find-mbepage 76 "2.1.9 Plot of a Discontinuous Function") # (find-mbetext 76 "2.1.9 Plot of a Discontinuous Function") # (find-mbepage 313 "6.6.1 Discontinuous Functions") # (find-mbetext 313 "6.6.1 Discontinuous Functions") # (find-mbepage 353 "qdlist :") # (find-mbetext 353 "qdlist :") # (find-mbepage 459 "10.2.6 Fourier Series Expansion of a Rectangular Pulse") # (find-mbetext 459 "10.2.6 Fourier Series Expansion of a Rectangular Pulse") ##### # # <GR>ep the <I>nput lines in <M>axima code # 2023jul18 # ##### # «grim» (to ".grim") # See: (find-efunction 'ee-grim) # (find-kla-intro "4. Aliases") Maxima by Example, and all the other Maxima docs, are full of blocks like this: (%i1) diff(x^n,x); n - 1 (%o1) n x (%i2) diff(x^n,x,3); n - 3 (%o2) (n - 2) (n - 1) n x Try this: mark the 6-line block above, and run `M-x ee-grim'. This will create a temporary buffer with just these lines: (%i1) diff(x^n,x); (%i2) diff(x^n,x,3); To make `ee-grim' callable without the `ee-', run this: (defalias 'grim 'ee-grim) To make that alias permanent, put this in your ~/.emacs: ;; From: (find-es "mbe" "grim") (defalias 'grim 'ee-grim) # (find-mbe06page 4 "6.1.1 All About diff") # (find-mbe06text 4 "6.1.1 All About diff") ##### # # Configure eepitch to skip the (%i<nn>)s # 2023jul18 # ##### # «eepitch-prefix» (to ".eepitch-prefix") This section of eev docs explains a hack that lets eepitch ignore certain prefixes: (find-eepitch-intro "3.3. `eepitch-preprocess-line'") To make that hack work you need to put this in your ~/.emacs: ;; See: (find-eepitch-intro "3.3. `eepitch-preprocess-line'") (setq eepitch-preprocess-regexp "^") (defun eepitch-preprocess-line (line) (replace-regexp-in-string eepitch-preprocess-regexp "" line)) If you define `eepitch-preprocess-line' in that way then eepitch will treat `eepitch-preprocess-regexp' as a variable that controls which prefixes to ignore. If you then define `eepitch-preprocess-regexp' in this way, (setq eepitch-preprocess-regexp "^[ |]*(%i[0-9]+) ?") then eepitch will ignore the "input prefixes" in lines like these ones: (%i1) diff(x^n,x); (%i2) diff(x^n,x,3); Try the eepitch block below: * (eepitch-maxima) * (eepitch-kill) * (eepitch-maxima) * (setq eepitch-preprocess-regexp "^[ |]*(%i[0-9]+) ?") (%i1) diff(x^n,x); (%i2) diff(x^n,x,3); * (setq eepitch-preprocess-regexp "^") (%i1) diff(x^n,x); (%i2) diff(x^n,x,3); Note that: a) the second `setq' above resets `eepitch-preprocess-regexp' to a value that means "don't delete any prefixes", and b) without the `(defun eepitch-preprocess-line ...)' above the value of `eepitch-preprocess-regexp' is ignored. See: (find-eepitch-intro "3.3. `eepitch-preprocess-line'" "no-op") ##### # # find-mbe-links # 2023jul18 # ##### # «find-mbe-links» (to ".find-mbe-links") # (find-efunction 'find-mbe-links) # (find-angg ".emacs.papers" "maxima-by-example") Try this: (find-mbe-links 1 1) (find-mbefile "mbe1code.txt") (find-mbefile "mbe1toc.txt") (find-mbefile "mbe1util.mac") (find-mbefile "mbe2code.txt") (find-mbefile "mbe2toc.txt") (find-mbefile "mbe3code.txt") (find-mbefile "mbe3toc.txt") (find-mbefile "mbe4solve.txt") (find-mbefile "mbe5.mac") (find-mbefile "mbe7code.txt") (find-mbefile "mbe8code.txt") (find-mbefile "mbe9code.txt") (find-mbefile "mbe10code.txt") (find-mbefile "mbe11code.txt") (find-mbefile "mbe11toc.txt") # (find-mbesh "ls mbe*.{txt,mac}") # (find-mbefile "" "mbe1") ;; See: (find-eepitch-intro "3.3. `eepitch-preprocess-line'") (setq eepitch-preprocess-regexp "^") (defun eepitch-preprocess-line (line) (replace-regexp-in-string eepitch-preprocess-regexp "" line)) # Local Variables: # coding: utf-8-unix # End: