Warning: this is an htmlized version!
The original is here, and
the conversion rules are here.
#######
#
# E-scripts about Maxima.
#
# 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://angg.twu.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://angg.twu.net/e/maxima.e>
#           or at <http://angg.twu.net/e/maxima.e.html>.
#        See also <http://angg.twu.net/emacs.html>,
#                 <http://angg.twu.net/.emacs[.html]>,
#                 <http://angg.twu.net/.zshrc[.html]>,
#                 <http://angg.twu.net/escripts.html>,
#             and <http://angg.twu.net/>.
#
#######





# «.mailing-lists»		(to "mailing-lists")
# «.maxima-debs»		(to "maxima-debs")
# «.maxima-workbook»		(to "maxima-workbook")
# «.web-docs»			(to "web-docs")
# «.build-html-index»		(to "build-html-index")
# «.tag-table»			(to "tag-table")
# «.emacsconf2020»		(to "emacsconf2020")
# «.simp»			(to "simp")
# «.read-simp-eval-output»	(to "read-simp-eval-output")
# «.example»			(to "example")
# «.2-lisp»			(to "2-lisp")
# «.assume»			(to "assume")
# «.changevar»			(to "changevar")
# «.changevar-trig»		(to "changevar-trig")
# «.changevar-email»		(to "changevar-email")
# «.changevar-figure»		(to "changevar-figure")
# «.find-maximaindex»		(to "find-maximaindex")
# «.:lisp»			(to ":lisp")
# «.operators»			(to "operators")
# «.declare»			(to "declare")
# «.subscripted»		(to "subscripted")
# «.maxima-mode»		(to "maxima-mode")
# «.eepitch-maxima»		(to "eepitch-maxima")
# «.maxima-latex-insert-form»	(to "maxima-latex-insert-form")
# «.empty-PS2-problem»		(to "empty-PS2-problem")
# «.maxima-src»			(to "maxima-src")
# «.maxima-deb-src»		(to "maxima-deb-src")
# «.producing-eps»		(to "producing-eps")
# «.eepitch-region»		(to "eepitch-region")
# «.ev»				(to "ev")
# «.draw»			(to "draw")
# «.draw-gr2d»			(to "draw-gr2d")
# «.draw2d»			(to "draw2d")
# «.casting-spels»		(to "casting-spels")
# «.dispfun»			(to "dispfun")
# «.solve»			(to "solve")
# «.separable»			(to "separable")
# «.command-line»		(to "command-line")
# «.strings»			(to "strings")
# «.luatree»			(to "luatree")
# «.luatree-explanation»	(to "luatree-explanation")
# «.luatree-rd»			(to "luatree-rd")
# «.grind»			(to "grind")
# «.init-file»			(to "init-file")
# «.to_lisp»			(to "to_lisp")
# «.defmfun»			(to "defmfun")
# «.syntax»			(to "syntax")
# «.subst»			(to "subst")
# «.parentheses»		(to "parentheses")
# «.MV2-tree»			(to "MV2-tree")
# «.op-and-args»		(to "op-and-args")
# «.part-and-inpart»		(to "part-and-inpart")
# «.substpart»			(to "substpart")
# «.sly»			(to "sly")
# «.swank»			(to "swank")
# «.equal»			(to "equal")
# «.direction-fields»		(to "direction-fields")
# «.quote»			(to "quote")

# «.E-and-Einv»			(to "E-and-Einv")
# «.myexptrick-email»		(to "myexptrick-email")
# «.trigexpand»			(to "trigexpand")
# «.trig-ids»			(to "trig-ids")
# «.int-pow-sin-cos»		(to "int-pow-sin-cos")

# «.books»			(to "books")
# «.gurro-book»			(to "gurro-book")
# «.maxima-cvs»			(to "maxima-cvs")
# «.maxima-git»			(to "maxima-git")
# «.installation-directories»	(to "installation-directories")
# «.installation-dirs-2»	(to "installation-dirs-2")
# «.checkinstall»		(to "checkinstall")
# «.hollow-points»		(to "hollow-points")
# «.draw-apply»			(to "draw-apply")
# «.riemann»			(to "riemann")
# «.maxima-gpdraw»		(to "maxima-gpdraw")
# «.implicit»			(to "implicit")
# «.listify»			(to "listify")
# «.torus-with-flux»		(to "torus-with-flux")
# «.parametric_surface»		(to "parametric_surface")
# «.seq»			(to "seq")
# «.n^2+n+41»			(to "n^2+n+41")
# «.makelist»			(to "makelist")
# «.seqn»			(to "seqn")
# «.numerozinhos»		(to "numerozinhos")
# «.matrixify»			(to "matrixify")
# «.2010.1-C2-P1»		(to "2010.1-C2-P1")
# «.2010.1-C2-trab-area»	(to "2010.1-C2-trab-area")
# «.inverse-transformations»	(to "inverse-transformations")
# «.symbols»			(to "symbols")
# «.bortolossi-5.5»		(to "bortolossi-5.5")
# «.cabos-na-diagonal»		(to "cabos-na-diagonal")
# «.variables»			(to "variables")
# «.rubi»			(to "rubi")
# «.display2d»			(to "display2d")
# «.tex»			(to "tex")
# «.texput-Eq5»			(to "texput-Eq5")
# «.display2d-Eq5»		(to "display2d-Eq5")
# «.alt-display»		(to "alt-display")

# «.imaxima»			(to "imaxima")
# «.emaxima»			(to "emaxima")
# «.emaxima-conv»		(to "emaxima-conv")
# «.savemaximasession-0»	(to "savemaximasession-0")
# «.savemaximasession-1»	(to "savemaximasession-1")
# «.latex-output»		(to "latex-output")

# «.load-path»			(to "load-path")
# «.2021-2-C3-diag-nums»	(to "2021-2-C3-diag-nums")
# «.eev-demo»			(to "eev-demo")
# «.online-manual»		(to "online-manual")
# «.lambda»			(to "lambda")
# «.quote-quote»		(to "quote-quote")
# «.linearize»			(to "linearize")
# «.depends»			(to "depends")
# «.depends-quadratic»		(to "depends-quadratic")
# «.depends-email»		(to "depends-email")
# «.depends-email-code»		(to "depends-email-code")
# «.depends-email-lambda»	(to "depends-email-lambda")
# «.input-string-parser-output»	(to "input-string-parser-output")
# «.reader»			(to "reader")
# «.parse-string»		(to "parse-string")
# «.displr-email»		(to "displr-email")
# «.dosimp-and-doeval»		(to "dosimp-and-doeval")
# «.trace-parser»		(to "trace-parser")
# «.lambda-simp»		(to "lambda-simp")

# «.symbol-plist»		(to "symbol-plist")
# «.demos»			(to "demos")
# «.fourier»			(to "fourier")
# «.taylor»			(to "taylor")
# «.taylor-2»			(to "taylor-2")
# «.gradef»			(to "gradef")
# «.email-subst-2022jan17»	(to "email-subst-2022jan17")
# «.plot-wb»			(to "plot-wb")
# «.plot2d-parametric»		(to "plot2d-parametric")
# «.plot3d-parametric»		(to "plot3d-parametric")
# «.plot2d-xmaxima»		(to "plot2d-xmaxima")
# «.partial-fractions»		(to "partial-fractions")
# «.two-conics»			(to "two-conics")
# «.float-and-numer»		(to "float-and-numer")
# «.mnewton»			(to "mnewton")
# «.TFC2-fails»			(to "TFC2-fails")
# «.numerozinhos»		(to "numerozinhos")
# «.dmiranda»			(to "dmiranda")
# «.2022-1-C2-P2»		(to "2022-1-C2-P2")
# «.2022-2-C3-P1»		(to "2022-2-C3-P1")
# «.numer-and-float»		(to "numer-and-float")
# «.plotting-contours»		(to "plotting-contours")
# «.plotting-contours-2»	(to "plotting-contours-2")
# «.terminal-tikz»		(to "terminal-tikz")
# «.early-references-on-und»	(to "early-references-on-und")
# «.cm-maxima»			(to "cm-maxima")
# «.defrule»			(to "defrule")
# «.simplifying»		(to "simplifying")
# «.twenty-and-thirty»		(to "twenty-and-thirty")
# «.mfuncall»			(to "mfuncall")
# «.apropos»			(to "apropos")
# «.plot-src»			(to "plot-src")
# «.draw_gnuplot.dem»		(to "draw_gnuplot.dem")
# «.currying»			(to "currying")
# «.buildq»			(to "buildq")
# «.maxima-packages»		(to "maxima-packages")
# «.lexical_symbols.mac»	(to "lexical_symbols.mac")
# «.lexical-symbols-branch»	(to "lexical-symbols-branch")
# «.EDOLCCs»			(to "EDOLCCs")



# http://en.wikipedia.org/wiki/Maxima_%28software%29
# http://math-blog.com/2007/06/02/3-awesome-free-math-programs/
# http://math-blog.com/2007/06/04/a-10-minute-tutorial-for-solving-math-problems-with-maxima/

apti maxima-emacs maxima-doc maxima-src gnuplot-x11 gnuplot-doc





#####
#
# mailing-lists
# 2021dec11
#
#####

# «mailing-lists»  (to ".mailing-lists")
# https://maxima.sourceforge.io/maximalist.html

# maxima-discuss@lists.sourceforge.net
# https://sourceforge.net/p/maxima/mailman/maxima-discuss/
# https://sourceforge.net/p/maxima/mailman/maxima-discuss/?viewmonth=202112
# https://sourceforge.net/p/maxima/mailman/maxima-discuss/?viewmonth=202201
# https://sourceforge.net/p/maxima/mailman/maxima-discuss/?viewmonth=202207
# https://sourceforge.net/p/maxima/mailman/maxima-discuss/?viewmonth=202207&viewday=2&style=threaded
# https://sourceforge.net/p/maxima/mailman/maxima-discuss/?viewmonth=202207&style=threaded
# https://sourceforge.net/p/maxima/mailman/maxima-discuss/?viewmonth=202207&viewday=1
# https://sourceforge.net/p/maxima/mailman/maxima-discuss/?viewmonth=202207&viewday=1
# https://sourceforge.net/p/maxima/mailman/message/37675653/

# 2009jul12:
# http://maxima.sourceforge.net/maximalist.html
# http://maxima.sourceforge.net/compalg.html

# (find-maximamsg)






#####
#
# maxima-debs
# 2008jun09 / 2021nov21
#
#####

# «maxima-debs»  (to ".maxima-debs")
# (find-zsh "availabledebs | sort | grep maxima")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
apti maxima maxima-share maxima-doc maxima-emacs maxima-src gnuplot-x11
apti xmaxima wxmaxima
apti libgmp3c2

# /usr/lib/maxima/5.10.0/binary-gcl/maxima: error while loading shared
# libraries: libgmp.so.3: cannot open shared object file: No such file
# or directory
# (find-dmissing "libgmp.so")
# (eev "apti libgmp3c2")

# (find-status   "maxima")
# (find-vldifile "maxima.list")
# (find-udfile   "maxima/")
# (find-status   "maxima-share")
# (find-vldifile "maxima-share.list")
# (find-udfile   "maxima-share/")
# (find-status   "maxima-doc")
# (find-vldifile "maxima-doc.list")
# (find-udfile   "maxima-doc/")
# (find-status   "maxima-emacs")
# (find-vldifile "maxima-emacs.list")
# (find-udfile   "maxima-emacs/")
# (find-status   "maxima-src")
# (find-vldifile "maxima-src.list")
# (find-udfile   "maxima-src/")
# (find-udfile "maxima-doc/html/")
# (code-pdf-page "maximabook" "/usr/share/doc/maxima-doc/maximabook-19-Sept-2004.pdf.gz")
# (code-pdf-text "maximabook" "/usr/share/doc/maxima-doc/maximabook-19-Sept-2004.pdf.gz")
# (find-maximabookpage)
# (find-maximabooktext)

# (find-status   "xmaxima")
# (find-vldifile "xmaxima.list")
# (find-udfile   "xmaxima/")
# (find-status   "wxmaxima")
# (find-vldifile "wxmaxima.list")
# (find-udfile   "wxmaxima/")
# (find-status   "maxima-test")
# (find-vldifile "maxima-test.list")
# (find-udfile   "maxima-test/")
# file:///usr/share/doc/xmaxima/

# (find-maximasharefile "fractals/fractals.mac")

# (find-man "1 maxima")
# (find-man "1L maxima")



#####
#
# maxima-workbook
# 2022jul23
#
#####

# «maxima-workbook»  (to ".maxima-workbook")
# (find-books "__comp/__comp.el" "maxima-workbook")
# (find-angg "blogme3/sandwiches-defs.lua" "code-pdf-page-tests")
# http://roland-salz.de/html/maxima.html
# http://roland-salz.de/Maxima_Workbook.pdf
# https://roland-salz.de/Maxima_Workbook.pdf

# (code-pdf-page "maximawb" "$S/http/roland-salz.de/Maxima_Workbook.pdf")
# (code-pdf-text "maximawb" "$S/http/roland-salz.de/Maxima_Workbook.pdf" 19)
# (code-pdf-page "maximawb" "$S/https/roland-salz.de/Maxima_Workbook.pdf")
# (code-pdf-text "maximawb" "$S/https/roland-salz.de/Maxima_Workbook.pdf" 20)
;; (find-maximawbpage)
;; (find-maximawbtext)

# (find-escript-upload-links "maxima" "maxima-workbook")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
makeL
makeR
makeR1  e/maxima.e.html
# file:///home/edrx/TH/R/e/maxima.e.html#maxima-workbook



#####
#
# web-docs
# 2022aug07
#
#####

# «web-docs»  (to ".web-docs")
# (find-maximanode "funmake")
# https://maxima.sourceforge.io/documentation.html
# https://maxima.sourceforge.io/docs/manual/maxima_377.html
# https://maxima.sourceforge.io/docs/manual/maxima_164.html#index-funmake


#####
#
# build-html-index
# 2022aug08
#
#####

# «build-html-index»  (to ".build-html-index")
# (find-maximagitfile "doc/info/build-html-index.lisp")
# (find-maximamsg "37690886 202208 07" "RToy: doc/info/build-html-index.lisp")
# https://mail.google.com/mail/u/0/#inbox/QgrcJHsHqfTGBczPsMPxJVNfDQqtMdlbgWv



#####
#
# tag-table
# 2022aug06
#
#####

# «tag-table»  (to ".tag-table")
# (find-es "texinfo" "tag-table")
# (find-fline "/usr/local/share/info/" "maxima")
# (find-fline "/usr/local/share/info/maxima-index-html.lisp")
# (find-fline "/usr/local/share/info/maxima-index.lisp")
# (find-fline "/usr/local/share/info/maxima.info" "Tag Table:")
# (find-fline "/usr/local/share/info/maxima.info" "Ref: funmake")
# (find-maximanode "funmake")
# (find-fline "~/LOGS/2022aug06.clschool")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
cp -v /usr/local/share/info/maxima-index-html.lisp \
      /tmp/index-big.lisp
cat > /tmp/index-mini.lisp <<'%%%'
  (in-package :cl-info)
  (let ((html-index
         '(("a1" "a2" "a3")
           ("b1" "b2" "b3")))))
%%%

* (eepitch-sbcl)
* (eepitch-kill)
* (eepitch-sbcl)
(defvar fnamein)
(defvar fnameout)
(defvar biglist)
(defvar biglist2)
(defvar biglist3)
(setq fnamein "/tmp/index-mini.lisp")
(setq fnamein "/tmp/index-big.lisp")
(setq fnameout "/tmp/index-out.lisp")
(setq biglist (with-open-file (in fnamein) (read in) (read in)))
(setq biglist2 (caadr biglist))
(setq biglist3 (cadadr biglist2))
biglist3

(with-open-file (s fnameout :direction :output :if-exists :supersede)
  (dolist (a biglist3)
    (let ((*print-right-margin* nil))
      (format s "~S~%" a))))

;; (find-fline "/tmp/" "index-out.lisp")
;; (find-fline "/tmp/index-out.lisp")

* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
bigstr = ee_readfile "/tmp/index-out.lisp"
for a,b,c in bigstr:gmatch('%("(.-)"%s+"(.-)"%s+"(.-)"%)') do
  print(a,b.."#"..c)
end



#####
#
# Fermin's talk about Maxima at the EmacsConf2020
# 2021dec11
#
#####

# «emacsconf2020»  (to ".emacsconf2020")
# https://gitlab.com/sasanidas/maxima
# https://emacsconf.org/2020/talks/33/
# https://mirror.csclub.uwaterloo.ca/emacsconf/2020/smaller/emacsconf-2020--33-maxima-a-computer-algebra-system-in-emacs--fermin--vp9-q56-video-original-audio.webm

(code-video "maximavideo" "$S/https/mirror.csclub.uwaterloo.ca/emacsconf/2020/smaller/emacsconf-2020--33-maxima-a-computer-algebra-system-in-emacs--fermin--vp9-q56-video-original-audio.webm")
;; (find-maximavideo)
;; (find-maximavideo "0:00")
;; (find-maximavideo "2:20" "org-mode support")
;; (find-maximavideo "2:35" "eqns: an array of three equations")
;; (find-maximavideo "2:45" "solutions:")
;; (find-maximavideo "3:05" "first of all you have to send this")
;; (find-maximavideo "3:39" "maxima-help-at-point")
;; (find-maximavideo "4:10" "information about the symbol: maxima-symbol-doc")
;; (find-maximavideo "4:29" "a more complicate example")
;; (find-maximavideo "5:02" "maxima-latex-insert-form")
;; (find-maximavideo "5:25" "load(\"draw\")")
;; (find-maximavideo "5:50" "draw2d(implicit())")
;; (find-maximavideo "7:19" "the original package")

;; (find-maximavideo "11:15" "maxima-send-block")
;; (find-maximavideo "12:10" "CI/CD")
;; (find-maximavideo "12:45" "company")
;; (find-maximavideo "12:49" "org mode and latex")
;; (find-maximavideo "12:58" "polymode")
;; (find-maximavideo "13:02" "maxima can understand lisp code")
;; (find-maximavideo "13:27" "send with C-c C-r")
;; (find-maximavideo "13:45" ":lisp")
;; (find-maximavideo "13:50" "integration with slime mode")
;; (find-maximavideo "14:07" "features right now")
;; (find-maximavideo "14:26" "minibuffer minor mode")



#####
#
# simp
# 2022jul02
#
#####

# «simp»  (to ".simp")
# (to "dosimp-and-doeval")
# (find-maximanode "Introduction to Simplification")
# (find-maximanode "Introduction to Simplification" "1965")
# (find-maximanode "Functions and Variables for Simplification")
# (find-maximanode "simplification-pkg")
# (find-maximanode "ev")
# (find-maximanode "evfun")

# (find-maximanode "additive")
# (find-maximanode "antisymmetric")
# (find-maximanode "combine")
# (find-maximanode "commutative")
# (find-maximanode "demoivre")
# (find-maximanode "demoivre")
# (find-maximanode "distrib")
# (find-maximanode "distribute_over")
# (find-maximanode "domain")
# (find-maximanode "evenfun")
# (find-maximanode "oddfun")
# (find-maximanode "expand")
# (find-maximanode "expandwrt")
# (find-maximanode "expandwrt_denom")
# (find-maximanode "expandwrt_factored")
# (find-maximanode "expon")
# (find-maximanode "exponentialize")
# (find-maximanode "exponentialize")
# (find-maximanode "expop")
# (find-maximanode "lassociative")
# (find-maximanode "linear")
# (find-maximanode "maxnegex")
# (find-maximanode "maxposex")
# (find-maximanode "multiplicative")
# (find-maximanode "multthru")
# (find-maximanode "nary")
# (find-maximanode "negdistrib")
# (find-maximanode "opproperties")
# (find-maximanode "define_opproperty")
# (find-maximanode "outative")
# (find-maximanode "radcan")
# (find-maximanode "radexpand")
# (find-maximanode "rassociative")
# (find-maximanode "scsimp")
# (find-maximanode "simp")
# (find-maximanode "symmetric")
# (find-maximanode "xthru")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
ex0 : s * sqrt(1 - s^2);




#####
#
# read-simp-eval-output
# 2022jun23
#
#####

# «read-simp-eval-output»  (to ".read-simp-eval-output")
# (find-maximanode "Introduction to Simplification")
# (find-maximanode "Functions and Variables for Rules and Patterns")
# (find-maximanode "simp")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
ex1 : 'integrate(x, x);
ex2 :  integrate(x, x);
      ex1;
    ''ex1;
ev (''ex1);
ev (''ex1, integrate);
? integrate;



#####
#
# example
# 2022jan10
#
#####

# «example»  (to ".example")
# (find-maximanode "Functions and Variables for Help" "Function: example")
# (find-sh "locate manual.demo")
# (find-maximagitfile "demo/manual.demo")
# (find-maximagitfile "")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
??example
example(dispfun);
example();
manual_demo;
example(declare);



#####
#
# Maxima behaves as a 2-lisp: each symbol has a ":"-cell and a ":="-cell
# 2022oct07
#
#####

# «2-lisp»  (to ".2-lisp")
# (to "depends-email")
# (find-maximanode ":")
# (find-maximanode ":=")
# (find-maximanode "values")
# (find-maximanode "functions")
# (find-maximanode "kill")
# (find-maximanode "dispfun")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
a_      :  42;
a_(x,y) := sqrt(x+y);
a_;
a_(1,3);
values;
functions;
dispfun(a_);



#####
#
# assume
# 2022jul02
#
#####

# «assume»  (to ".assume")
# (find-maximanode "Functions and Variables for Integration" "neg;")



#####
#
# changevar
# 2022jun22
#
#####

# «changevar»  (to ".changevar")
# (find-maximanode "changevar")
# (find-maximanode "'")
# (find-maximanode "quote")
# (find-maximanode "quote-quote")
# (find-maximanode "display2d")
# (find-maximanode "ev")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
ex0 : 'integrate((3*cos(2 + sqrt(3*x+4))) / (2*sqrt(3*x+4)), x, a, b);
ex0 : 'integrate((3*cos(2 + sqrt(3*x+4))) / (2*sqrt(3*x+4)), x);
ex2 : changevar(ex0, u=3*x, u, x);
ex3 : changevar(ex2, v=u+4, v, u);
assume(w>0);
ex4 : changevar(ex3, w=sqrt(v), w, v);
ex5 : changevar(ex4, y=2+w, y, w);
ex5 ;
ex6 : ev(ex5, integrate);
ex6 : ev(ex5, nouns);
ex7  : subst([y=2+w],     ex6);
ex8  : subst([w=sqrt(v)], ex7);
ex9  : subst([v=u+4],     ex8);
ex10 : subst([u=3*x],    ex9);
ex1;
ex10 - ex1;

ex0 : 'integrate((3*cos(2 + sqrt(3*x+4))) / (2*sqrt(3*x+4)), x, a, b);
ex0 : 'integrate((3*cos(2 + sqrt(3*x+4))) / (2*sqrt(3*x+4)), x);
assume(0 < a);
assume(0 < b);
ev(ex0, integrate);

display2d : false;




#####
#
# changevar-trig
# 2022jul02
#
#####

# «changevar-trig»  (to ".changevar-trig")
# (find-maximagitgrep "grep --color=auto -niRH --null -e changevar *")
# (find-maximagitgrep "grep --color=auto -niRH --null -e changevar src/*.lisp")
# (find-maximagitfile "src/outmis.lisp" "(defmfun $changevar")
# (find-maximagitfile "src/outmis.lisp" "(defun changevar")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
ex0 : 'integrate(s*sqrt(1-s^2), s);
ex1 : changevar(ex0, s=sin(t), t, s);
ex2 : map(rootscontract, ex1);
ex3 : map(trigsimp, ex2);
assume(cos(t) > 0);
ev(ex3);
ex4: changevar(ex3, u=cos(t), u, t);
assume(u > 0);
ex5 : ev(ex4);
ex6 : ev(ex5, integrate);
ex7 : subst([u=cos(t)], ex6);
ex8 : subst([cos(t)=c], ex7);
ex9 : subst([c=sqrt(1-s^2)], ex8);
**
ev(ex0, integrate);
display2d : false;


# E-mails:
# https://sourceforge.net/p/maxima/mailman/message/37675741/ My question
# https://sourceforge.net/p/maxima/mailman/message/37675749/ M Talon's answer

Hi list,

if I execute this

  display2d : false;
  ex0 : 'integrate(s*sqrt(1-s^2), s);
  ex1 : changevar(ex0, s=sin(t), t, s);

what I get is:

  (%i1) display2d : false;
  (%o1) false
  (%i2) ex0 : 'integrate(s*sqrt(1-s^2), s);
  (%o2) 'integrate(s*sqrt(1-s^2),s)
  (%i3) ex1 : changevar(ex0, s=sin(t), t, s);
  (%o3) 'integrate(cos(t)*sqrt(1-sin(t))*sin(t)*sqrt(sin(t)+1),t)

but I am trying to prepare material for a course on basic integration
techniques, so the style of simplification that I need is different...
this factorization is "bad":

   sqrt(1-sin(t)^2)
   ->  sqrt(1-sin(t))*sqrt(sin(t)+1)

Questions:

  1) how do I tell Maxima to not factor that sqrt?
  2) how do I tell Maxima to do this instead?

     sqrt(1-sin(t)^2)
     ->  cos(t)

Thanks in advance!
  Eduardo Ochs
  http://angg.twu.net/eev-maxima.html



#####
#
# changevar-email
# 2022jun23
#
#####

# «changevar-email»  (to ".changevar-email")
# https://sourceforge.net/p/maxima/mailman/message/37672076/
# https://sourceforge.net/p/maxima/mailman/message/37672078/

Hi list,

I'm trying to write code that will solve some basic problems of
integration by change of variables "step by step"... my first example
starts with:

  ex0 : 'integrate((3*cos(2 + sqrt(3*x+4))) / (2*sqrt(3*x+4)), x);
  ex1 :  integrate((3*cos(2 + sqrt(3*x+4))) / (2*sqrt(3*x+4)), x);
  ex2 : changevar(ex0, u=3*x, u, x);
  ex3 : changevar(ex2, v=u+4, v, u);
  assume(w>0);
  ex4 : changevar(ex3, w=sqrt(v), w, v);
  ex5 : changevar(ex4, y=2+w, y, w);
  display2d : false;
  ex5 ;

but how do I make Maxima integrate ex5? Its value is:

  'integrate(cos(y),y)

I know how to use the quote to make Maxima _avoid solving_ an integral
- see ex0 and ex1 above - but how do I maka Maxima solve the integral
in ex5? I made several attempts using ev, simp:true, and quote-quote,
but none of them worked...

  Thanks in advance!
    Eduardo Ochs
    http://angg.twu.net/eev-maxima.html



#####
#
# changevar-figure
# 2022jul08
#
#####

# «changevar-figure»  (to ".changevar-figure")
# (c2m221atisp 12 "substituicao-figura")
# (c2m221atisa    "substituicao-figura")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
ex0 : 'integrate(sin(u), u);
ex1 : changevar(ex0, u=x^3, x, u);
ex2 : 3*x^2 * sin(x^3);
plot2d (ex2, [x, -4, 4]);
plot2d (ex2, [x, 0.5, 2]);

solve([u=x^3, x=2], u);
solve([u=x+4, x=2], u);




#####
#
# find-maximaindex
# 2022apr26
#
#####

# «find-maximaindex»  (to ".find-maximaindex")
# (find-angg ".emacs" "maxima")
# (find-angg ".emacs" "maxima" "find-maximaindex")

;; (ee-maximaindex-rest ())
;; (ee-maximaindex-rest '("foo" "bar"))
;; (ee-maximaindex-rest '(:RET "bar"))




#####
#
# :lisp
# 2022nov18
#
#####

# «:lisp»  (to ".:lisp")
# (find-maximanode "Lisp and Maxima")
# (find-maximanode "Lisp and Maxima" "(%i1) :lisp (foo $x $y)")
# (find-maximanode "Lisp and Maxima" "to_lisp")
# (find-maximanode "Lisp and Maxima" "#$<expr>$")




#####
#
# operators
# 2022aug18
#
#####

# «operators»  (to ".operators")
# (find-maximanode "Introduction to operators")
# (find-maximanode "Introduction to operators" "Operator   lbp     rbp")
#      ^        140     139
#      -        100     134
# (find-maximawbpage (+ 20 71) "10.1     Defining and using operators")
# (find-maximawbtext (+ 20 71) "10.1     Defining and using operators")
# (find-maximanode "infix")
# (find-maximanode "matchfix")
# (find-maximanode "nary")
# (find-maximanode "nofix")
# (find-maximanode "postfix")
# (find-maximanode "prefix")
# (find-maximanode "dispfun")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)

:lisp (get '$+ 'lbp)
:lisp (get '$+ 'rbp)
infix ("##", 101, 101);
"##"(a, b) := sconcat("(", a, ",", b, ")");
1 + a ## b + 2;
infix ("##", 99, 99);
1 + a ## b + 2;

infix ("##", 100, 99);
"##"(a, b) := sconcat("(", a, ",", b, ")")$
foo ## bar ## baz;
infix ("##", 100, 101);
foo ## bar ## baz;

infix ("##", 100, 99, expr, expr, expr);
if x ## y then 1 else 0;
infix ("##", 100, 99, expr, expr, clause);
if x ## y then 1 else 0;

matchfix ("@@", "~");
@@ a, b, c ~;
matchfix (">>", "<<");
>> a, b, c <<;
matchfix ("foo", "oof");
foo a, b, c oof;
>> w + foo x, y oof + z << / @@ p, q ~;

matchfix ("!-", "-!");
!- x, y -! := x/y - y/x;
define (!-x, y-!, x/y - y/x);
define ("!-" (x, y), x/y - y/x);
dispfun ("!-");
!-3, 5-!;
"!-" (3, 5);


#####
#
# declare
# 2022oct06
#
#####

# «declare»  (to ".declare")
# (find-maximagitfile "")
# (find-maximagitsh "find * | sort")
# (find-maximagitsh "find * | sort | grep mac")
# (find-maximagitgrep "grep --color=auto -nRH --null -e declare share")
# (find-maximanode "declare" "nonarray")



#####
#
# subscripted
# 2022aug28
#
#####

# «subscripted»  (to ".subscripted")
# (find-maximawbpage (+ 19 21) "When the lhs is a subscripted")
# (find-maximawbtext (+ 19 21) "When the lhs is a subscripted")
# (find-maximanode "Functions and Variables for Lists")
# (find-maximanode "array")
# (find-maximanode "arrayinfo")
# (find-maximanode "subvar")
# (find-maximanode "arraymake")
# (find-maximanode "op")
# (find-maximanode "op" "F [x, y]")
# (find-maximanode "ordergreatp" "subscripted expressions")
# (find-maximanode "subnumsimp")
# (find-maximanode ":" "not subscripted")
# (find-maximanode "ev" "subscripted")
# (find-maximanode "declare" "nonarray")
# (find-maximanode "nonarray")
# (find-maximanode "assume_pos_pred")
# (find-maximanode "coeff" "subscripted")
# (find-maximanode "diff" "subscripted")
# (find-maximanode "gradef")
# (find-maximanode "ishow")
# (find-maximanode "Functions and Variables for itensor")
# (find-maximanode "tellsimpafter")
# (find-maximanode "flatten")
# (find-maximanode "makeset")
# (find-maximanode "dispfun")
# (find-maximanode "functions")
# (find-maximanode "functions" "Memoizing functions")
# (find-maximanode "fundef")
# (find-maximanode "funmake")
# (find-maximanode "remfunction")
# (find-maximanode "mapatom")
# (find-maximanode "setcheck")
# (find-maximanode "opsubst")
# (find-maximanode "Functions and Variables for opsubst")

# (find-maximanode "nonarray")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
a:'b$ b:'c$ c:'d$
a[x];
declare(a, nonarray);
a[x];
a[1];
a[1] : 23;
a[1];
a[2][3];
a[2][3] : 45;

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
a[1,2];
a[1,2] : 34;
a[1,2];
arrayinfo(a);
c(coefx, coefy) := a[coefx, coefy] * x^coefx * y^coefy;
z : c(0,0) + c(0,1) + c(0,2) + c(1,0) + c(1,1) + c(2,0); 
a[2,0] : 0;
z;
ev(z);



#####
#
# maxima-mode
# 2021dec11
#
#####

# «maxima-mode»  (to ".maxima-mode")
# (find-epackage-links 'maxima "maxima" t)
# (find-epackage       'maxima)
# (code-c-d "maxima" "~/.emacs.d/elpa/maxima-20210526.1525/")
# (find-maximafile "")
# (find-maximafile "maxima-autoloads.el" "maxima-start")
# (find-maximafile "maxima.el")
# (find-efunctiondescr 'maxima-mode)
# (find-efunction      'maxima-send-line)
# (find-efunction      'maxima-start)
# (find-efunction      'maxima-init-inferiors)




#####
#
# eepitch-maxima
# 2021dec11
#
#####

# «eepitch-maxima»  (to ".eepitch-maxima")
# (find-efunctiondescr 'maxima-init-inferiors)
# (find-efunction      'maxima-init-inferiors)
# (find-efunctiondescr 'maxima-string)
# (find-efunction      'maxima-string)
# (eek "M-h M-k  C-c C-c  ;; maxima-send-line")
# (find-efunctiondescr 'maxima-send-line)
# (find-efunction      'maxima-send-line)
# (find-efunctiondescr 'maxima-send-region)
# (find-efunction      'maxima-send-region)
# (find-efunctiondescr 'maxima-region)
# (find-efunction      'maxima-region)


;; See: (find-eepitch-intro \"3.3. `eepitch-preprocess-line'\")
;; (setq eepitch-preprocess-regexp \"^\")
;; (setq eepitch-preprocess-regexp \"^;; ?\")

;; eepitch-maxima uses comint.
;; eepitch-fmaxima uses Fermin's maxima-mode.

(defun find-fmaximaprocess (&rest rest)
  (require 'maxima)
  (maxima-init-inferiors)
  (find-ebuffer (process-buffer (get-process "maxima")) :end))

(defun eepitch-line-fmaxima (line)
  (maxima-string (ee-no-properties line)))

;; Based on: (find-efunction 'eepitch-vterm)
;;
(defun eepitch-fmaxima ()
  (interactive)
  (prog1 (eepitch `(find-fmaximaprocess))
    (setq eepitch-line 'eepitch-line-fmaxima)))

;; Tests:
;; (find-2a nil '(find-fmaximaprocess))
;; (eepitch-line-fmaxima "1+2;")
;; (eepitch-line-fmaxima "")

 (eepitch-fmaxima)
 (eepitch-kill)
 (eepitch-fmaxima)
1+2;
1+2
;

 (maxima-string "")



#####
#
# maxima-latex-insert-form
# 2021dec11
#
#####

# «maxima-latex-insert-form»  (to ".maxima-latex-insert-form")
# (find-efunctiondescr 'maxima-latex-insert-form)
# (find-efunction      'maxima-latex-insert-form)
# (find-orgfile "org.el" "org-preview-latex-image-directory")
# (find-evardescr        'org-preview-latex-image-directory)
# (find-evariable        'org-preview-latex-image-directory)




#####
#
# Problem with the empty PS2 prompt
# 2009jul12
#
#####

# «empty-PS2-problem»  (to ".empty-PS2-problem")
# (find-bashnode "Bourne Shell Variables" "`PS2'")
# (find-es "bash" "bash-3.2-info")
# (find-eapropos "comint")
# (find-eapropos "comint" "comint-prompt-regexp")
# (find-evariable 'comint-use-prompt-regexp)
# (find-evariable 'comint-use-prompt-regexp)
# (find-efunction 'comint-send-input)
# (find-maximafile "")
# (find-maximagrep "grep -niH -e prompt *")
# (find-maximagrep "grep -nH -e prompt *")
# (find-maximagrep "grep -niH -e incomplete *")
# (find-maximagrep "grep -niH -e input *")
# (find-maximagrep "grep -niH -e format *")
# (find-maximagrep "grep -niH -e interact *")
# (find-maximaelgrep "grep -nH -e inferior-maxima-prompt *")
# (find-maximaelgrep "grep -nH -e wait *")
# (find-es "lisp" "dpans2texi")

<edrx> hello... I am trying to run in a comint buffer a program -
       Maxima - that has the empty string as its $PS2-ish prompt,
       and so every time that I issue an incomplete command in
       maxima emacs (sort of) freezes waiting for a prompt, and I
       have to break its waiting loop with a C-g... how do I
       disbale the wait-for-a-prompt feature in a comint buffer?

# (find-node "(xmaxima)Openmath plots")
# (find-xmaximanode "Openmath plots")

# (find-zsh "dmissing xmaxima")




#####
#
# maxima-src
# 2021nov21
#
#####

# «maxima-src»  (to ".maxima-src")
# (find-angg ".emacs" "maxima")




#####
#
# maxima (from the debian sources)
# 2009jul12
#
#####

# «maxima-deb-src»  (to ".maxima-deb-src")
# http://ftp.debian.org/debian/pool/main/m/maxima/
# http://ftp.debian.org/debian/pool/main/m/maxima/maxima_5.13.0-3.1.dsc
# http://ftp.debian.org/debian/pool/main/m/maxima/maxima_5.13.0-3.1.diff.gz
# http://ftp.debian.org/debian/pool/main/m/maxima/maxima_5.13.0.orig.tar.gz
#*
rm -Rv ~/usrc/maxima/
mkdir  ~/usrc/maxima/
cd $S/http/ftp.debian.org/debian/pool/main/m/maxima/
cp -v maxima_5.13.0* ~/usrc/maxima/
cd     ~/usrc/maxima/
dpkg-source -sn -x maxima_5.13.0-3.1.dsc
cd     ~/usrc/maxima/maxima-5.13.0/
dpkg-buildpackage -us -uc -b -rfakeroot     |& tee odb

#*
# (find-fline "~/usrc/maxima/")
* (eepitch-shell)
cd ~/usrc/maxima/
sudo dpkg -i *.deb

#*
# (code-c-d "maximasrc" "~/usrc/maxima/maxima-5.13.0/")
# (find-maximasrcfile "")

# http://ftp.debian.org/debian/pool/main/m/maxima/
# http://ftp.debian.org/debian/pool/main/m/maxima/maxima_5.17.1-1.dsc
# http://ftp.debian.org/debian/pool/main/m/maxima/maxima_5.17.1-1.diff.gz
# http://ftp.debian.org/debian/pool/main/m/maxima/maxima_5.17.1.orig.tar.gz
#*
rm -Rv ~/usrc/maxima/
mkdir  ~/usrc/maxima/
cd $S/http/ftp.debian.org/debian/pool/main/m/maxima/
cp -v maxima_5.17.1* ~/usrc/maxima/
cd     ~/usrc/maxima/
dpkg-source -sn -x maxima_5.17.1-1.dsc
cd     ~/usrc/maxima/maxima-5.17.1/
dpkg-buildpackage -us -uc -b -rfakeroot     |& tee odb

#*
# (find-fline "~/usrc/maxima/")
* (eepitch-shell)
cd ~/usrc/maxima/
sudo dpkg -i *.deb

#*
# (code-c-d "maximasrc" "~/usrc/maxima/maxima-5.44.0/")
# (find-maximasrcsh "find * -type f | sort")
# (find-maximagitsh "find * -type f | sort")
# (find-maximagitfile "")
# (find-maximagitfile "share/calculus/pade2.mac")
# (find-maximagitfile "src/buildq.lisp")
# (find-maximagitfile "src/nparse.lisp")
# (find-maximagitfile "src/nparse.lisp" "recognize '#' comments")
# (find-maximagitfile "src/nparse.lisp" "The Expression Parser")
# (find-maximagitfile "src/tests/wester_problems/test_indefinite_integrals.mac")

# (find-maximanode "Functions and Variables for Expressions" "infix")
# (find-maximanode "Syntax")






# (find-maximanode "Functions and Variables for Series" "Function: revert")






# (find-node "(maxima)Introduction to Maxima")
# (find-node "(maxima)Introduction to Maxima" "integrate (1/(1 + x^3), x);")
# (find-node "(maxima)Introduction to Command Line" "integrate (x^2, x, x0, x1);")
# (find-node "(maxima)Comments")
# (find-node "(maxima)Introduction to Integration")


# (find-man "1 maxima")
# (find-man "1L maxima")

(defun eepitch-maxima () (interactive)
  (eepitch-comint "maxima" "maxima"))

(defun eepitch-maxima () (interactive)
  (eepitch '(maxima)))



* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
maxima
factor(10!);
expand ((x + y)^6);
factor (x^6 - 1);
quit();

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
factor(10!);
expand ((x + y)^6);
factor (x^6 - 1);
** quit();

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
? integ
6 5

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
u: expand ((x + y)^6);
diff (u, x);
factor (%o2);
cos(%pi);
exp(%i*%pi);
u: expand ((x + y)^6);
diff (%, x);
integrate (1/(1 + x^3), x);
linsolve ([3*x + 4*y = 7, 2*x + a*y = 13], [x, y]);
solve (x^3 - 3*x^2 + 5*x = 15, x);
eq_1: x^2 + 3*x*y + y^2 = 0$
eq_2: 3*x + y = 1$
solve ([eq_1, eq_2]);
eq_1: x^2 + 3*x*y + y^2 = 0$
eq_2: 3*x + y = 1$
solve ([eq_1, eq_2]);
kill(labels);
plot2d (sin(x)/x, [x, -20, 20]);
plot2d ([atan(x), erf(x), tanh(x)], [x, -5, 5]);
plot3d (sin(sqrt(x^2 + y^2))/sqrt(x^2 + y^2), [x, -12, 12], [y, -12, 12]);
** foo


# (find-node "(maxima)Lisp and Maxima")
# (find-node "(maxima)Lisp and Maxima" "same effect as")
# (find-node "(maxima)Lisp and Maxima" "same effect as" "foo: [x, y]")
# (find-node "(maxima)Documentation")
# (find-node "(maxima)Definitions for Help")
# (find-node "(maxima)Source Level Debugging")
# (find-node "(maxima)Function and Variable Index")
# (find-node "(maxima)Definitions for Equations" "Function: allroots")

:lisp (+ 1 2)
:lisp ; (+ 1 2)




* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
p(x) := 2 - x^2;
r(x) := 2*x - 1;
s(x) := 1/2 * (cos (%pi/2 * x)) - 3/2;
P(a, b) := integrate(p(x), x, a, b);
R(a, b) := integrate(r(x), x, a, b);
S(a, b) := integrate(s(x), x, a, b);
s(0);
s(-1);
s(-2);
P(-2, 1);                       /*  3 */
           S(-2, 0);            /* -3 */
                      R(0, 1);  /*  0 */
P(-2, 1) - S(-2, 0) - R(0, 1);

integrate(sin(2*x), x);
integrate(sin(2*x - 4), x);
integrate(sin(2*x^2), x);
integrate(sin(x)^1 * cos(x)^3, x);
integrate(sin(x)^2 * cos(x)^3, x);
integrate(sin(x)^3 * cos(x)^3, x);
integrate(sin(x)^4 * cos(x)^3, x);
integrate(sqrt(1 - x^2), x);
integrate(sqrt(1 - x^2), x, -1, 1);

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load(draw);
draw3d(xu_grid      = 50,
       yv_grid      = 15,
       surface_hide = true,
       /* terminal     = eps, */
         parametric_surface(cos(a)*(3+b*cos(a/2)),
                            sin(a)*(3+b*cos(a/2)),
                            b*sin(a/2), a,-%pi,%pi,b,-1,1
                           )
      );

*;; (find-maximanode "Comments")
*;; (find-maximanode "Functions and Variables for Contexts")
*;; (find-maximanode "Function")
a: 22;
b: 33;
a + b;
p

;; (find-maximanode "Lisp and Maxima")
;; (find-maximanode "Functions and Variables for Help")
;; (find-maximaelfile "")
;; (find-maximaelfile "maxima.el")
;; (find-maximaelfile "sshell.el")

factor(10!);
expand ((x + y)^6);
factor (x^6 - 1);
quit();




#####
#
# producing .eps files
# 2009sep16
#
#####

# «producing-eps»  (to ".producing-eps")
# http://maxima-project.org/wiki/index.php?title=Gallery
# http://www.math.utexas.edu/pipermail/maxima/2008/010300.html
# http://www.telefonica.net/web2/biomates/maxima/gpdraw/
# (find-node "(maxima)Functions and Variables for draw" "eps_height")
# http://www.telefonica.net/web2/biomates/index.html
# http://www.telefonica.net/web2/biomates/maxima/gpdraw/index.html
# http://www.telefonica.net/web2/biomates/maxima/gpdraw/func2d/index.html

;; (find-angg ".emacs" "eepitch-region")
;; (define-key eev-mode-map [f8]   'eepitch-this-line-or-region)

;; (find-maximanode-draw nil '(ee-write (point-min) (point-max) "" "" "/tmp/o"))
;; (find-sh "grep '^ --' /tmp/o | awk -F: '{print $2}' | awk '{print $1}' | sort | uniq")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load(draw);

draw2d(explicit(u^2,u,-3,3));

draw2d(explicit(x^3,x,-1,1),
       xaxis       = true,
       xaxis_color = blue,
       yaxis       = true,
       yaxis_width = 2,
       yaxis_type  = solid,
       yaxis_color = "#f3b507");

draw2d(
   transparent = true,
   explicit(sin(x),x,0,10),
   rectangle([1,-1/2],[4,1/2]),
   yaxis_secondary = true,
   ytics_secondary = true,
   color = blue,
   explicit(100*sin(x+0.3)+2,x,0,10),
   rectangle([5,-30],[8,60])
   )$

draw2d(
   /* activate both secondary axes */
   xtics_secondary = auto,
   ytics_secondary = auto,

   /* red curve is plotted against secondary x-axis and primary y-axis */
   xaxis_secondary = true,
   color = red,
   key = "top x, left y",
   explicit(sin(x),x,0,20),

   /* blue curve is plotted against primary x-axis and secondary y-axis */
   xaxis_secondary = false,
   yaxis_secondary = true,
   color = blue,
   key = "bottom x, right y",
   explicit(100*sin(x+0.3)+2,x,0,10),
   terminal = wxt) $

draw2d(color = green,
           explicit(u^2,u,-2,2),
           explicit(sin(z),z,2,6),
       /* terminal  = png, */
       title     = "My 1st title");

draw2d(/* terminal   = eps_color, */
       key        = "Exponential func",
       color      = blue,
       line_width = 4,
            explicit(exp(x),x,-1,3),
       line_width = 2,
       color      = "#00ff00",   /* green, in hexadecimal */
       key        = "Cubic poly",
            explicit(%pi*x^3+sqrt(2)*x^2+10,x,0,3),
       xlabel     = "Horizontal axis",
       ylabel     = "Vertical axis");

draw2d(/* the rational function */
       grid   = true,
       key    = "y = x^2/(x-2)",
       yrange = [-10,20],
       color  = red,
         explicit(x^2/(x-2),x,-9,15),

       /* asymptotes */
       key       = "",
       line_type = dots,
       color     = blue,
         explicit(x+2,x,-9,15),
       nticks = 70,
         parametric(2,t,t,-10,20),

       /* labels and arrows */
       head_length = 0.3,
       color     = black,
       line_type   = solid,
           vector([5.35,2.45],[-1.53,3.25]),
           vector([-1,7.5],[3,0]),
       label_alignment = left,
           label(["y = x+2",6,2.5]),
       label_alignment = right,
           label(["x = 2",-1.7,7.5])    );

draw2d(/* terminal   = png */
       logy=true,
       xlabel = "x",
       ylabel = "log(y)",
       color  = red,
         explicit(exp(x),x,0.1,20),
       axis_top   = false,
       axis_right = false,
       grid       = true,
       title      = "Logarithmic scale");

draw2d(
  xlabel = "Default tics",
  ylabel = "No tics",
  ytics  = 'none,
  explicit(x^3,x,-1,1)  );

draw2d(
  xlabel = "Start-increment-end",
  ylabel = "Tics intervals 0.25",
  xtics  = [-3/4,1/8,3/4],
  ytics  = 1/4,
  explicit(x^3,x,-1,1)  );

draw2d(
  xlabel     = "User selected tics on axis",
  ylabel     = "Rotated labeled tics",
  xtics      = {-1/2,-1/4,3/4}, /* set of numbers */
  xtics_axis = true,            /* plot tics on x-axis */
  ytics      = {["High",0.75],["Medium",0],["Low",-0.75]},
  ytics_rotate = true,
  grid       = true,
  explicit(x^3,x,-1,1)  );

load(distrib)$
draw2d(terminal    = eps_color,
       title       = "Normal probability",
       grid        = true,
       axis_top    = false,
       axis_right  = false,
       filled_func = true,
       fill_color  = "light-blue",
       key         = "Pr(-1 < X < 0)",
       explicit(pdf_normal(x,0,1),x,-1,0),
       key         = "Pr(1 < X <2)",
       fill_color  = "dark-blue",
       explicit(pdf_normal(x,0,1),x,1,2),
       filled_func = false,
       color       = red,
       key         = "Normal density N(0,1)",
       explicit(pdf_normal(x,0,1),x,-3,3)  );

draw2d(fill_color  = grey,
       filled_func = sin(x),
       explicit(-sin(x),x,0,%pi),
       fill_color  = cyan,
       explicit(-sin(x),x,%pi,2*%pi));

f1: 2*x^2-5*x+3$
f2: -8*x^2-x+30$
[x1,x2]: map('rhs, solve(f1=f2));
draw2d(title       = "Region bounded by two functions",
       fill_color  = grey,
       filled_func = f2,
       explicit(f1,x,x1,x2),
       filled_func = false,
       xaxis       = true,
       xtics_axis  = true,
       yaxis       = true,
       line_width  = 2,
       key         = string(f1),
       color       = red,
       explicit(f1,x,-3,3),
       key         = string(f2),
       color       = blue,
       explicit(f2,x,-3,3) );

draw2d(bars([1,5,0.2],[2,7,0.2],[3,-4,0.1],[4,-2,1],[5,3,1]),
       xaxis = true,
       xtics = {["Ford",1],["Opel",2],["Citroen",3],["Toyota",4],["Teletransportation",5]} );

draw2d(key          = "Group A",
       fill_color   = blue,
    /* fill_density = 0.2, */
       bars([0.8,5,0.4],[1.8,7,0.4],[2.8,-4,0.4]),
       key          = "Group B",
       fill_color   = red,
    /* fill_density = 0.6, */
       line_width   = 4,
       bars([1.2,4,0.4],[2.2,-2,0.4],[3.2,5,0.4]),
       xaxis = true);






#####
#
# eepitch-region (obsolete)
# 2009sep21
#
#####

# «eepitch-region»  (to ".eepitch-region")
# (find-angg ".emacs" "eepitch-region")



#####
#
# ev
# 2022jul16
#
#####

# «ev»  (to ".ev")
# (find-books "__comp/__comp.el" "maxima-workbook" "11 Evaluation")
# (find-maximanode "ev")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
z : a00 + a10*Dx + a20*Dx^2
  + (a01 + a11*Dx + a21






#####
#
# draw
# 2022apr27
#
#####

# «draw»  (to ".draw")
# «draw-gr2d»  (to ".draw-gr2d")
# (find-maximanode "draw")
# (find-maximanode "gr2d")
# (find-maximanode "key")
# (find-maximanode "grid")
# (find-maximanode "color")
# (find-maximanode "explicit")
# (find-maximanode "Functions and Variables for draw" "Graphic option: grid")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
draw(gr2d(key="sin (x)",
          grid=[2,2],
          explicit(sin(x), x,0,2*%pi)
          ),
     gr2d(key="cos (x)",
          grid=[2,2],
          explicit(cos(x), x,0,2*%pi)
    ));
draw(gr2d(grid=[2,2],
          explicit(sin(x), x,0,2*%pi),
          color="red",
          explicit(cos(x), x,0,2*%pi)
          )
    );

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
scene1: gr2d(title="Ellipse",
             nticks=300,
             parametric(2*cos(t),5*sin(t),t,0,2*%pi));
scene2: gr2d(title="Triangle",
             polygon([4,5,7],[6,4,2]));
draw(scene1, scene2, columns = 2);
**
scene1: gr2d(title="A sinus",
  grid=true,
  explicit(sin(t),t,0,2*%pi));
scene2: gr2d(title="A cosinus",
  grid=true,
  explicit(cos(t),t,0,2*%pi));
draw(scene1, scene2);
**
** The following two draw sentences are equivalent:
draw(gr3d(explicit(x^2+y^2,x,-1,1,y,-1,1)));
draw3d(explicit(x^2+y^2,x,-1,1,y,-1,1));
**
** Creating an animated gif file:
draw(
  delay     = 100,
  file_name = "/tmp/zzz",
  terminal  = 'animated_gif,
  gr2d(explicit(x^2,x,-1,1)),
  gr2d(explicit(x^3,x,-1,1)),
  gr2d(explicit(x^4,x,-1,1)));
**
** (find-fline "/tmp/zzz.gif")



#####
#
# draw2d
# 2009sep21
#
#####

# «draw2d»  (to ".draw2d")
# (find-status   "gnuplot")
# (find-vldifile "gnuplot.list")
# (find-udfile   "gnuplot/")
# (find-node "(maxima)draw")
# (find-maximanode "draw2d")
# (find-maximanode "explicit")
# (find-maximanode "Functions and Variables for draw")

# http://maxima.cvs.sourceforge.net/viewvc/maxima/maxima/share/draw/
# http://maxima.cvs.sourceforge.net/viewvc/maxima/maxima/

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
rm -Rv /tmp/draw/
mkdir  /tmp/draw/
cd     /tmp/draw/
cvs     -d:pserver:anonymous@cvs.maxima.sourceforge.net:/cvsroot/maxima login

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load(draw);
draw2d(explicit(x^3, x, -1, -1));
draw2d(explicit(x^3, x, -1, -1),
       xaxis       = true,
       xaxis_color = blue,
       yaxis       = true,
       yaxis_width = 2,
       yaxis_type  = solid,
       yaxis_color = "#f3b507");






#####
#
# Casting SPELs
# 2009sep16
#
#####

# «casting-spels»  (to ".casting-spels")
# http://riotorto.users.sourceforge.net/Maxima/casting/index.htm 2022jan15
# http://www.telefonica.net/web2/biomates/maxima/casting/csintro.htm
# http://www.telefonica.net/web2/biomates/maxima/casting/cs1.htm
# http://www.telefonica.net/web2/biomates/maxima/casting/cs2.htm
# http://www.telefonica.net/web2/biomates/maxima/casting/cs3.htm
# http://www.telefonica.net/web2/biomates/maxima/casting/cs4.htm
# http://www.telefonica.net/web2/biomates/maxima/casting/cs5.htm
# http://www.telefonica.net/web2/biomates/maxima/casting/cs6.htm
# http://www.telefonica.net/web2/biomates/maxima/casting/cs7.htm

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
objects: '[whiskey_bottle, bucket, chain, frog]$
map: '[[living_room,
        "you are in the living_room of a wizards house.
         there is a wizard snoring loudly on the couch. ",
        [west, door, garden],
        [upstairs, stairway, attic] ],
       [garden,
        "you are in a beautiful garden.
         there is a well in front of you. ",
        [east, door, living_room] ],
       [attic,
        "you are in the attic of the wizards house.
         there is a giant welding torch in the corner. ",
        [downstairs, stairway, living_room] ]]$
map;
*
object_locations: '[[whiskey_bottle, living_room],
                    [bucket, living_room],
                    [chain, garden],
                    [frog, garden]]$
location: 'living_room$
*
describe_location(location, map):= second( assoc_(location, map))$
*
assoc_(key,alist):= block(
  [ result:false ],
  for elem in alist do
  if key=first(elem) then return(result:elem),
  result )$
*
describe_location(location,map);
*
describe_path(path):=
   sconcat("there is a ", path[2], " going ", path[1], " from here. ")$
*
describe_path('[west, door, garden]);
*
describe_paths(location,map)=
   apply( sconcat, map( describe_path,rest( assoc_(location,map),2 ) ) )$
describe_paths(location,map);
*
is_at(obj,loc,obj_loc):= block(
   [ tmp:assoc_(obj,obj_loc) ],
   listp(tmp) and is(second(tmp)=loc) )$
*
is_at('bucket,'living_room,object_locations);
describe_floor(loc,objs,obj_loc):=
   apply( sconcat,
          map( lambda([x],sconcat("you see a ",x," on the floor. ")),
               sublist( objs, lambda([x],is_at(x,loc,obj_loc)) ) ))$
describe_floor('living_room,objects,object_locations);
l_o_o_k():=
   sconcat( describe_location(location,map),
            describe_paths(location,map),
            describe_floor(location,objects,object_locations) )$
nofix("look")$
"look"():= l_o_o_k()$
look;




#####
#
# dispfun
# 2009oct06 / 2022jan10
#
#####

# «dispfun»  (to ".dispfun")
# (find-maximaindex-links "apply define define_variable demoivre dispfun fundef funmake")
# (find-maximanode "apply")
# (find-maximanode "define")
# (find-maximanode "define_variable")
# (find-maximanode "demoivre")
# (find-maximanode "dispfun")
# (find-maximanode "fundef")
# (find-maximanode "funmake")
# (find-maximanode "Functions and Variables for Function Definition")
# (find-maximagitfile "")
# (find-maximagitgrep "grep --color=auto -niRH --null -e dispfun *")
# (find-maximagitgrep "grep --color=auto -niRH --null -e dispfun * | grep -ai '(def'")
# (find-maximagitfile "src/mlisp.lisp" "(defmspec $dispfun ")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
? fundef
? dispfun

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
L : [1, 5, -10.2, 4, 3];
apply (min, L);
*
F (x) := x / 1729;
fname : F;
dispfun (F);
apply (dispfun, [fname]);
*
demoivre;
demoivre (exp (%i * x));
apply  (demoivre, [exp (%i * x)]);
apply ('demoivre, [exp (%i * x)]);
*
lambda ([x], if x < 0 then throw(x) else f(x));
g(l) := catch (map (''%, l));
g ([1, 2,  3, 7]);
g ([1, 2, -3, 7]);
**
expr : cos(y) - sin(x);
define (F1 (x, y), expr);
F1 (a, b);
F2 (x, y) := expr;
F2 (a, b);
**
define (G1 (x, y), x.y - y.x);
define (G2 [x, y], x.y - y.x);
**
define (H ([L]), '(apply ("+", L)));
H (a, b, c);
**
[F : I, u : x];
funmake (F, [u]);
define (funmake (F, [u]), cos(u) + 1);
define (arraymake (F, [u]), cos(u) + 1);
define (foo (x, y), bar (y, x));
define (ev (foo (x, y)), sin(x) - cos(y));
*
define_variable (foo, true, boolean);
foo;
foo: false;
foo: %pi;
foo;
*
define_variable (bar, 2, integer);
qput (bar, prime_test, value_check);
prime_test (y) := if not primep(y) then error (y, "is not prime.");
bar: 1439;
bar: 1440;
bar;
*
define_variable (baz_quux, 'baz_quux, any_check);
F: lambda ([y], if y # 'baz_quux then error ("Cannot assign to `baz_quux'."));
qput (baz_quux, ''F, value_check);
baz_quux: 'baz_quux;
baz_quux: sqrt(2);
baz_quux;
*
m(x, y) ::= x^(-y);
f(x, y) :=  x^(-y);
g[x, y] :=  x^(-y);
h[x](y) :=  x^(-y);
i[8](y) :=  8^(-y);
dispfun (m, f, g, h, h[5], h[10], i[8]);
*
 ''%;
*
F_1 (x) := x - 100;
F_2 (x, y) := x / y;
define (F_3 (x), sqrt (x));
G_1 [x] := x - 100;
G_2 [x, y] := x / y;
define (G_3 [x], sqrt (x));
H_1 [x] (y) := x^y;
functions;
arrays;
*
F (x, y) := y^2 - x^2;
funmake (F, [a + 1, b + 1]);
''%;
*
G (x) ::= (x - 1)/2;
funmake (G, [u]);
''%;
*
H [a] (x) := (x - 1)^a;
funmake (H [n], [%e]);
''%;
funmake ('(H [n]), [%e]);
''%;
*
funmake (A, [u]);
''%;
*
det(a,b,c) := b^2 -4*a*c;
(x : 8, y : 10, z : 12);
f : det;
funmake (f, [x, y, z]);
''%;
*
funmake (sin, [%pi / 2]);
*
f: lambda ([x], x^2);
f(a);
lambda ([x], x^2) (a);
apply (lambda ([x], x^2), [a]);
map (lambda ([x], x^2), [a, b, c, d, e]);
a: %pi$
b: %e$
g: lambda ([a], a*b);
b: %gamma$
g(1/2);
g2: lambda ([a], a*''b);
b: %e$
g2(1/2);
h: lambda ([a, b], h2: lambda ([a], a*b), h2(1/2));
h(%pi, %gamma);
i: lambda ([a], lambda ([x], a*x));
i(1/2);
i2: lambda([a], buildq([a: a], lambda([x], a*x)));
i2(1/2);
i2(1/2)(%pi);
*
f : lambda ([aa, bb, [cc]], aa * cc + bb);
f (foo, %i, 17, 29, 256);
g : lambda ([[aa]], apply ("+", aa));
g (17, 29, x, y, z, %e);
*
foo (x) := 1 - x;
foo (100);
block (local (foo), foo (x) := 2 * x, foo (100));
foo (100);
*
f (x) := h (x) / g (x);
g (x) ::= block (print ("x + 99 is equal to", x), return (x + 99));
h (x) ::= block (print ("x - 99 is equal to", x), return (x - 99));
macroexpansion: false;
f (a * b);
dispfun (f);
f (a * b);
*
f (x) := h (x) / g (x);
g (x) ::= block (print ("x + 99 is equal to", x), return (x + 99));
h (x) ::= block (print ("x - 99 is equal to", x), return (x - 99));
macroexpansion: expand;
f (a * b);
dispfun (f);
f (a * b);
*
f (x) := h (x) / g (x);
g (x) ::= block (print ("x + 99 is equal to", x), return (x + 99));
h (x) ::= block (print ("x - 99 is equal to", x), return (x - 99));
macroexpansion: displace;
f (a * b);
dispfun (f);
f (a * b);




#####
#
# solve
# 2022jan11
#
#####

# «solve»  (to ".solve")
# (find-maximaindex-links "solve")
# (find-maximaindex "solve" :RET)
# (find-maximanode "solve")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
? solve
**
f    :  x^-2;
f(x) := x^-2;
F    :  integrate(f, x);
F(x) := -1/x;
F(1) - F(-1);
**
solve(f-4, x);
solve(f-4, x)[1];
solve(f-4, x)[2];
solve(f+4, x);
solve(F-4, x);
solve(F+4, x);
solve(u^3=v^5, u);
solve(u=4, u);
** Doesn't work:
solve([u=v, v=4], u);



#####
#
# separable
# 2022feb03
#
#####

# «separable»  (to ".separable")
# (find-maximanode "Functions and Variables for Differential Equations" "separable")
# (find-maximanode "Functions and Variables for Equations" "Function: solve")
# (find-maximanode "ic1")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
x^2*'diff(y,x) + 3*y*x = sin(x)/x;
ode2(%,y,x);
ic1(%o2,x=%pi,y=0);
'diff(y,x,2) + y*'diff(y,x)^3 = 0;
ode2(%,y,x);
ratsimp(ic2(%o5,x=0,y=0,'diff(y,x)=2));
bc2(%o5,x=0,y=1,x=1,y=3);
*
* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
myeq    : ('diff(y,x) = -     1/y);
myeq    : ('diff(y,x) = -     x/y);
myeq    : ('diff(y,x) = - 2 * x/y);
myeq    : ('diff(y,x) =     - y/x);
mysolg  : ode2 (myeq, y, x);
mysolgs : solve(mysolg, y);
mysolg1 : solve(mysolg, y)[1];
mysolg2 : solve(mysolg, y)[2];
x0      : 4;
y0      : 3;
x0      : 4;
y0      : 6;
mysolp1 : ic1(mysolg, x=x0, y=y0);
myc1    :           subst([x=x0, y=y0], mysolg);
myc1    :     solve(subst([x=x0, y=y0], mysolg), %c);
myc1    :     solve(subst([x=x0, y=y0], mysolg), %c)[1];
myc1    : rhs(solve(subst([x=x0, y=y0], mysolg), %c)[1]);
*
myeq    : ('diff(y,x) = - x/(4*y));
mysolg  : ode2 (myeq, y, x);
mysol1  : ic1(mysolg, x=6, y=4);
mysol2  : solve(mysol1, y);

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
dydx    :  'diff(y,x);
myeq    : ('diff(y,x) = - 4*x/y);
mysolg  : ode2 (myeq, y, x);
mysol1  : ic1(mysolg, x=4, y=6);
mysol1  : ic1(mysolg, x=2, y=3);
mysol2  : solve(mysol1, y);
x0      : 2;
y0      : 3;
mysol3  : subst([x=x0],       mysol2);
mysol3  : subst([x=x0, y=y0], mysol2);
my_y    : mysol2[2];
my_y    : rhs(mysol2[2]);
my_y_x  : diff(my_y, x);
subst([],                    myeq);
subst([dydx=my_y_x],         myeq);
subst([dydx=my_y_x, y=my_y], myeq);



#####
#
# Command line
# 2009oct06
#
#####

# «command-line»  (to ".command-line")
# (find-maximanode "Functions and Variables for Command Line" "`%', `%%', and `%th'")
# (find-maximanode "Functions and Variables for Command Line" "`%t'")
# (find-maximanode "Functions and Variables for Expressions" "`%t1', `%t2', ...")
# (find-maximanode "Functions and Variables for Input and Output" "`_', `%%', and `%th'")




#####
#
# strings
# 2022jul28
#
#####

# «strings»  (to ".strings")
# (find-maximanode "Introduction to Strings")
# (find-maximanode "Functions and Variables for Strings")
# (find-maximanode "atom")
# (find-maximanode "numberp")
# (find-maximanode "map")
# (find-maximanode "concat")
# (find-maximanode "string")
# (find-maximanode "stringp")
# (find-maximanode "printf")
# (find-maximanode "format")
# (find-maximanode "stringdisp")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
printf(false, "foo bar");
printf(false, "foo bar");
printf(false, "~a", "foo bar");
printf(false, "~m", "foo bar");
printf(false, "~s", "foo bar");
printf(false, "~s", 123);



#####
#
# luatree
# 2022jul29
#
#####

# «luatree»  (to ".luatree")
# (find-maximanode "Files")
# (find-maximanode "Functions and Variables for File Input and Output")
# (find-maximanode "printfile")
# (find-maximanode "stringout")
# (find-maximanode "texput")
# (find-anggfile "luatree/luatree.mac")
# (find-maximamsg "37689770 202208 04" "Basic question on paths (for luatree.{mac, lisp, lua})")
# (find-maximamsg "37689986 202208 05" "Problem solved!")
# (find-maximamsg "37690207 202208 05" "RDodier")
# (find-maximamsg "37690392 202208 06" "The first version of my luatree.lua just read stdin")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
** (find-angg "luatree/luatree.mac")
load       ("~/luatree/luatree.mac");
luatreedir;
MV2 : 'integrate(fp(g(x))*gp(x), x, a, b) = 'integrate(fp(u), u, g(a), g(b));
luatree  (MV2);
luatree1d(luatree1d);
luatree  (luatree1d);
          luatree1d;
luatree  (luatree);
          luatree;

:lisp #$MV2$




#####
#
# My post to the mailing list explaining luatree
# 2022aug06
#
#####

# «luatree-explanation»  (to ".luatree-explanation")
# (find-maximamsg "37689770 202208 04" "Edrx: Basic question on paths")
# (find-maximamsg "37689986 202208 05" "Edrx: Problem solved!")
# (find-maximamsg "37690207 202208 05" "RDodier")
# (find-maximamsg "37690392 202208 06" "Edrx: I think that I found a way")
# (find-maximamsg "37690570 202208 06" "RDodier: lua_table_from(e) :=")
# (find-angg "luatree/luatree.mac")
# (find-angg "luatree/luatree.lisp")
# (find-angg "luatree/luatree.lua")

Hi Robert!

I think that I found a way to answer your question that makes the main
idea look portable to other languages. Let me try.

I usually program using REPLs from Emacs, with this:

  http://angg.twu.net/eepitch.html

My favorite programming language is Lua and my init file for Lua has
lots of functions and classes that I use often in throwaway programs.
If I just start a Lua REPL and type this in it,

  foo = {[0]="+", {[0]="*", "2", "3"}, {[0]="/", "4", "5"}, 6}
  print(SynTree.from(foo))

the first line sets foo to an associative table that I interpret as a
tree as:

  2*3 + 4/5 + 6

and the second line converts it to an object of the class SynTree in a
certain way and prints it using the __tostring method of the SynTree
class. What we see in the REPL buffer is this:

  Lua 5.1.5  Copyright (C) 1994-2012 Lua.org, PUC-Rio
  > foo = {[0]="+", {[0]="*", "2", "3"}, {[0]="/", "4", "5"}, 6}
  > print(SynTree.from(foo))
  +_____._____.
  |     |     |
  *__.  /__.  6
  |  |  |  |
  2  3  4  5
  > 

The first version of my luatree.lua just read stdin, interpreted it as
a Lua expression, and ran something like this:

  print(SynTree.from(expressionreadfromstdin))

Then at some point I rewrote luatree.lua to make it self-contained,
i.e., independent of my init file, and it became this:

  http://angg.twu.net/luatree/luatree.lua.html

Note that at the end of luatree.lua there is a multi-line comment
containing this test,

  echo '{[0]="[", {[0]="/", "x", "y"}, "33"}' \
    | ./luatree.lua

that outputs this when I run it:

  [_____.
  |     |
  /__.  33
  |  |
  x  y

The function luatree1d in

  http://angg.twu.net/luatree/luatree.mac.html

receives a Maxima object and returns a string that is a
one-dimensional representation of a tree in Lua syntax - like the

  '{[0]="[", {[0]="/", "x", "y"}, "33"}'

in the "echo" above - and the function luatree, that is defined in
luatree.mac as:

  luatree : lambda([o], print(luatree_lua(luatree1d(o))), "");

calls luatree_lua to convert the 1D representation of a tree into a 2D
representation... and luatree_lua is defined in 

  http://angg.twu.net/luatree/luatree.lisp.html

as:

  (require :asdf)
  
  (defun luatree-lua (bigstr)
    (with-input-from-string
     (s bigstr)
     (reduce (lambda (a b) (format nil "~a~%~a" a b))
             (uiop:run-program
              (concatenate 'string #$luatreedir$ "luatree.lua")
              :input s :output :lines))))
  
  (defmfun $luatree_lua (str) (luatree-lua str))

This is my first Common Lisp program ever, and I had to ask for help
on IRC channels a lot to find this way to use uiop:run-program to pipe
a string through luatree.lua.

The class SynTree in luatree.lua builds the 2D representation of a
"syntax tree" by manipulation ascii rectangles that are objects of the
class Rect. Here is a demo that creates two Rect objects in a very
low-level way and then "concatenates" them:

  Lua 5.1.5  Copyright (C) 1994-2012 Lua.org, PUC-Rio
  > r1 = Rect({"a", "bb", "ccc"}) 
  > r2 = Rect({"dd", "e"}) 
  > print(r1..r2)
  a  dd
  bb e
  ccc
  > 

Lua sees both r1 and r2 as tables, and the usual concatenation
operator - the ".." - doesn't know how to handle concatenation of
tables, so it calls the function __concat in the metatable of r1. I
don't know how to do something like that in Common Lisp, but I plan to
learn how to do that when I grow up. Help welcome! =P

About GraphViz: I'm interested! Please explain! =)
  Cheers,
    Eduardo




#####
#
# Robert Dodier's version of luatree
# 2022aug07
#
#####

# «luatree-rd»  (to ".luatree-rd")
# (find-maximamsg "37690570 202208 06" "RDodier: lua_table_from(e) :=")
# (find-angg "luatree/luatree.mac")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load ("~/luatree/luatree.mac");
luatree_rd (lambda([], 2*3 + 4/5 + 6));
luatree_rd (lambda([], x^y));
luatree_rd (lambda([], x[y]));





#####
#
# grind
# 2009oct06
#
#####

# «grind»  (to ".grind")
# (find-maximanode "grind")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
cholesky (A):= block ([n : length (A), L : copymatrix (A),
  p : makelist (0, i, 1, length (A))], for i thru n do
  for j : i thru n do
  (x : L[i, j], x : x - sum (L[j, k] * L[i, k], k, 1, i - 1),
  if i = j then p[i] : 1 / sqrt(x) else L[j, i] : x * p[i]),
  for i thru n do L[i, i] : 1 / p[i],
  for i thru n do for j : i + 1 thru n do L[i, j] : 0, L)$
grind (cholesky);


makelist
thru
map
vector

# (find-maximanode "Function and Variable Index" "* for:")
# (find-maximanode "Functions and Variables for Lists" "Function: append")
# (find-maximanode "Functions and Variables for Lists" "Function: cons")
# (find-maximanode "Functions and Variables for Lists" "Function: create_list")
# (find-maximanode "Functions and Variables for Lists" "Function: makelist")
# (find-maximanode "Functions and Variables for Lists")
# (find-maximanode "Functions and Variables for Miscellaneous Options" "Function: args")
# (find-maximanode "Functions and Variables for Miscellaneous Options" "infolists")
# (find-maximanode "Functions and Variables for Program Flow" "Function: map")
# (find-maximanode "Functions and Variables for Program Flow" "Function: maplist")
# (find-maximanode "Functions and Variables for Program Flow" "Special operator: do")
# (find-maximanode "Introduction to Expressions")
# (find-maximanode "Introduction to Lists")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
example(append);



#####
#
# Syntax
# 2009oct06
#
#####

# «syntax»  (to ".syntax")
# (find-maximanode "Introduction to Expressions")
# (find-maximanode "Nouns and Verbs")
# (find-maximanode "Identifiers")
# (find-maximanode "Strings")
# (find-maximanode "Syntax")
# (find-maximanode "General operators" "Operator: ::=")




#####
#
# subst
# 2021dec20
#
#####

# «subst»  (to ".subst")
# (find-maximanode "Function and Variable Index" "* subst:")
# (find-maximanode "Function and Variable Index" "* sublis:")
# (find-maximanode "Function and Variable Index" "* sublis_apply_lambda:")
# (find-maximanode "Function and Variable Index" "* psubst:")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)

psubst ([a^2=b, b=a], sin(a^2) + sin(b));
** ->                  sin(b)  + sin(a)

subst ([a^2=b, b=a], sin(a^2) + sin(b));
** ->                    2 sin(a)

sublis ([a=b, b=c, c=a], sin(a) + cos(b) + tan(c));
** ->                    sin(b) + cos(c) + tan(a)




#####
#
# op-and-args
# 2022jul09
#
#####

# «op-and-args»  (to ".op-and-args")
# (find-anggfile "MAXIMA/traverse.mac")
# (find-es "sympy" "func-and-args")
# (find-maximanode "Introduction to Lists")
# (find-maximanode "Operators for Equations" "right-hand and left-hand sides")
# (find-maximanode "Introduction to operators")
# (find-maximanode "Arithmetic operators")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
a : b = c;
a;
lhs(a);
op(a);
args(a);
args(a)[1];
args(a)[2];
       integrate(x, x);
foo : 'integrate(x, x);
op(foo);
args(foo);
? lhs

# Question: foo(a, 2, 4, 1, 3) -> bar(bar(bar(bar(a, 2), 4), 1), 3)?
# (find-maximamsg "37678799 202207 09" "Edrx")
# (find-maximamsg "37678795 202207 09" "Barton: lreduce")
# (find-maximamsg "37678764 202207 09" "MTalon: foo(a, b, c, d, e)::=")
# (find-maximamsg "37678799 202207 09" "Edrx: I need a little more help *")
# (find-maximamsg "37678838 202207 09" "Stavros: you need =")
# (find-maximamsg "37678839 202207 09" "Edrx: perfect! ...transcript:")
# (find-maximamsg "37678963 202207 10" "Stavros: quote literal constants")
# (find-maximamsg "37679359 202207 11" "MTalon: swank ***")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
foo1 : lambda([a, b], 10*a + b);
xreduce(foo1, [2, 3, 4, 5]);
xreduce(foo1, [2, 3, 4, 5], 9);
foo(a, [b]) := xreduce(foo1, b, a);
foo(9, 2, 3, 4, 5);

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
foo1 : lambda([o, action],
  if     action = 'op   then op(o)
  elseif action = 'args then args(o)
  else   args(o)[action]);
foo(a, [b]) := xreduce(foo1, b, a);
ex1 : a+b*c;
foo(ex1);
foo(ex1, op);
foo(ex1, args);
foo(ex1, 1);
foo(ex1, 1, op);
foo(ex1, 1, args);
foo(ex1, 1, 1);
foo(ex1, 1, 2);
foo(ex1, 2);



#####
#
# part-and-inpart
# 2022jul10
#
#####

# «part-and-inpart»  (to ".part-and-inpart")
# (find-angg "MAXIMA/traverse.mac")
# (find-maximamsg "37678963 202207 10" "Stavros: quote, part, inpart")
# (find-maximamsg "37679111 202207 11" "Edrx: I wasn't even aware")
# (find-maximamsg "37679201 202207 11" "MTalon: structure ... internal form ***")
# (find-maximamsg "37679414 202207 11" "Stavros: shows most of the differences ***")
# (to "to_lisp")
# (find-maximanode "part")
# (find-maximanode "inpart")
# (find-maximanode "allbut")
# (find-maximanode "display_format_internal")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
ex1 : a+b*c;
part(ex1);
part(ex1, 0);
part(ex1, 1);
part(ex1, 2);
part(ex1, 1, 0);
part(ex1, 1, 1);
part(ex1, 1, 2);
ex1 : 1/a;
inpart(ex1, 0);
inpart(ex1, 1);
inpart(ex1, 2);
ex1 : a*b/c;
inpart(ex1, 0);
inpart(ex1, 1);
inpart(ex1, 2);
inpart(ex1, 3);
inpart(ex1, 3, 0);
:lisp #$ex1$




I don't know what exactly your goal is with *foo1* (maybe just a test), but
a few observations:

   - You should always quote literal constants, e.g., *action='op*, even
   though *op *evaluates to *op *if it's not bound to some value.
   Otherwise, if there happens to be a variable called *op* in your
   environment, you will get surprising results.
   - I hope you're aware that *op* and *args* work on the *external* form
   of an expression, which is designed for human consumption. The internal
   form is more uniform and generally better for automatic manipulation. You
   can get the internal form by binding *inflag* or by using the
*inpart* function:
   *op(1/a)=part(1/a,0)="/" *but *inpart(1/a,0)="^" *(*1/a = a^-1)*.
   - A useful argument for *part* is *allbut*, which is perversely
   documented under *allbut*, but not under *part*: *inpart(a*b/c,allbut(2))
   => a/c* (because *a*b/c* is internally *a*b*c^-1)*.
   - Unfortunately, there is not an *in* version of *args*. Maybe we should
   define *(in)part(...,allbut(0))* to be equivalent to *args(...)*.




#####
#
# substpart
# 2022aug06
#
#####

# «substpart»  (to ".substpart")
# https://sourceforge.net/p/maxima/mailman/message/37690226/




#####
#
# swank / sly
# 2022aug19
#
#####

# «sly»    (to ".sly")
# «swank»  (to ".swank")
# (find-angg ".maxima/startsly.lisp")
# (find-maximamsg "37679359 202207 11" "MTalon: swank ***")
# https://def.fe.up.pt/pipermail/maxima-discuss/2012/042643.html
# (find-es "lisp" "quicklisp")
# (to "op-and-args")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load("startsly");
* (sly-connect "localhost" 56789)
** (sly-edit-definition "dim-$matrix")





#####
#
# equal
# 2022jul09
#
#####

# «equal»  (to ".equal")
# (find-maximamsg "37675653 202207 1" "Stavros: structural equality")
#
# Let's look at a simpler example. Consider:
# 
#   f(x):= block([n],if n=0 then 1 else x);
# 
# In Maxima, if a variable *n* is not assigned a value, it evaluates to
# itself (the symbol *n*). The "=" operation checks for structural
# equality, not mathematical equality. The symbol *n* is not equal to
# the number *0*, so the predicate is false, and thus your function
# returns *x*. So you should use *equal*:
# 
#   f(x):= block([n],if equal(n,0) then 1 else x);
# 
# Until *n* is defined, the test *equal(n,0) *is undefined, so an unevaluated
# conditional is returned.






#####
#
# parentheses
# 2022jul09
#
#####

# «parentheses»  (to ".parentheses")
# (find-maximanode "op")
# (find-maximanode "arg")
# (find-maximanode "declare_index_properties")
# (find-maximanode "Functions and Variables for Display")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
simp : false;
a : b + c * d^e;
op(a);
args(a)[1];



#####
#
# Change of variable in the definite integral, as tree
# 2022jul12
#
#####

# «MV2-tree»  (to ".MV2-tree")
# (c2m221ftp 5 "MVs" "[MV2]")
# (to "op-and-args")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
foo1 : lambda([o, action],
  if     action = 'op   then op(o)
  elseif action = 'args then args(o)
  else   args(o)[action]);
foo(a, [b]) := xreduce(foo1, b, a);
simp : true;
simp : false;
MV2 : 'integrate(fp(g(x))*gp(x), x, a, b) = 'integrate(fp(u), u, g(a), g(b));
:lisp #$MV2$
simp : true;
foo(MV2, op);
foo(MV2, 1);
foo(MV2, 1, op);
foo(MV2, 1, args);
foo(MV2, 1, 1);
foo(MV2, 1, 1, op);
foo(MV2, 1, 1, args);
foo(MV2, 1, 1, 1);
foo(MV2, 1, 1, 1, op);
foo(MV2, 1, 1, 1, 1);

* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
-- (find-angg "LUA/Rect.lua" "SynTree-tests" "SynTree.from(s0)")
-- (find-angg "LUA/SynTreeV1.lua")
eq  = function (a, b)   return {[0]="=", a, b} end
mul = function (a, b)   return {[0]="*", a, b} end
app = function (f, arg) return {[0]=f, arg} end
f   = function (arg) return app("f ", arg) end
fp  = function (arg) return app("fp", arg) end
g   = function (arg) return app("g",  arg) end
gp  = function (arg) return app("gp", arg) end
int = function (f, x, a, b) return {[0]="int", f, x, a, b} end
x,u,a,b = "x","u","a","b"
intl = int(mul(fp(g(x)),gp(x)),x,a,b)
intr = int(fp(u),u,g(a),g(b))
MV2  = eq(intl,intr)
= SynTree.from(intl)
= SynTree.from(MV2)






#####
#
# direction-fields
# 2022jul09
#
#####

# «direction-fields»  (to ".direction-fields")
# (find-maximanode "Functions and Variables for drawdf")




#####
#
# Obtaining trigonometric identities with E and E^-1
# 2021dec17
#
#####

# «E-and-Einv»  (to ".E-and-Einv")
# Superseded by: (to "trig-ids")
# (find-angg "MAXIMA/myexptrick.mac")
# (find-xpdfpage "~/LATEX/2018-2-C2-P1.pdf")
# (find-xpdfpage "~/LATEX/2019-2-C2-P1.pdf")
# (find-LATEX "2018-2-C2-P1.tex" "gab-1")
# (find-LATEX "2018-2-C2-P1.tex" "gabarito-maxima")
# (find-LATEX "2019-2-C2-P1.tex" "gabarito")
# (find-LATEX "2019-2-C2-P1.tex" "gabarito-maxima")
# (c2m192p1p 4 "gabarito-maxima")
# (c2m192p1a   "gabarito-maxima")
# (find-es "ipython" "2018.2-C2-VS")
# (find-es "ipython" "2018.2-C2-VS" "E,Einv =")
# (find-maximanode "Introduction to Simplification" "demoivre:true")
# (find-maximanode "Functions and Variables for Simplification" "Function: exponentialize")
# (find-maximagitfile "doc/share/brchre.txt" "define rules of their own")
# (find-maximagitfile "")
# (find-maximagitsh "find * | sort | grep mac")
# (find-maximagitsh "find * | sort | grep mac | grep calculus")
# (find-maximagitgrep "grep --color=auto -nirH --null -e exponentialize *")
# (find-maximagitgrep "grep --color=auto -nirH --null -e demoivre *")
# (find-maximagitgrep "grep --color=auto -nirH --null -e 'defmfun $coeff' *")
# (find-maximagitgrep "grep --color=auto -nirH --null -e 'defmfun $ratcoef' *")
# (find-maximagitfile "src/csimp.lisp" "defmfun $demoivre")
# (find-maximagitfile "src/nrat4.lisp" "defmfun $ratcoef")
# (find-maximanode "Functions and Variables for Polynomials" "Function: coeff")
# (find-maximanode "Functions and Variables for Polynomials" "Function: ratcoef")

# (find-angg "MAXIMA/myexptrick.mac")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load("~/MAXIMA/myexptrick.mac");

f : sin(x)^4 * cos(x)^2;
g : expand(exponentialize(f));
ratcoeff(g, exp(%i*x), 0);
ratcoeff(g, exp(%i*x), 6);

h : subst(exp(%i*x)=z, g);
h : subst(x=-%i*log(z), g);

h : myexptrick(f);
ff(t) := subst([x=t], f);
hh(t) := subst([x=t], h);
plot2d ([ff(x), hh(x)], [x, 0, 2*%pi]);

coeff(g, x, 0);


* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
f : sin(x)^4 * cos(x)^2;
g : expand(exponentialize(f));
h : expand(demoivre(g));

myexptrick(f) := expand(demoivre(expand(exponentialize(f))));
myexptrick(sin(x)^4 * cos(x)^2);


* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
exp(2);
exp(%i * %pi);
E(k) := exp(k * t * %pi * %i);
C(k) := (E(k) + E(-k)) / 2;
C(1);
subst(1,   t, C(1));
subst(1/4, t, C(1));

f : cos(2*x);
f : cos(2*x) * sin(3*x);
exponentialize(f);
g : expand(exponentialize(f));
demoivre(g);

coeff(g, exp( 5 * %i * x));
coeff(g, exp(-5 * %i * x));

remfun1(fun,exp):=scanmap(lambda([q],delfun1(fun,q)),exp)$


# (find-maximagitsh "find * | sort | grep mac | grep calculus")
# (find-maximanode "Introduction to Expressions")
# (find-maximanode "Introduction to Expressions" "for i from")
# (find-maximanode "Functions and Variables for Function Definition" "Function: block")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
myexptrickcos(k, coefplus) := coefplus * cos(k * x) / 2$
myexptricksin(k, coefplus) := coefplus * sin(k * x) / (2 * %i)$
myexptricksel(k, coefplus, coefminus) :=
  if coefplus = coefminus
  then myexptrickcos(k, coefplus)
  else myexptricksin(k, coefplus)$
myexptrickcoeff(f, k) := coeff(f, exp(k * %i * x));
myexptrickself (f, k) :=
  myexptricksel(k, myexptrickcoeff(f, k),
                   myexptrickcoeff(f, -k))$

for k from 5 thru 7 do (print(k, k*10))$
for k from 0 thru 20 do (print(myexptrickself(g, k)))$
g;
myexptrickself(g, 5);

(total:0, for k from 0 thru 20 do (total: total + k), total);
(total:0, for k from 0 thru 20 do (print(myexptrickself(g, k))), total);
(total:0, for k from 0 thru 20 do (total: total + myexptrickself(g, k)), total);

myexptrick(cos(2*x));

f : cos(2*x) * sin(3*x);
g : expand(exponentialize(f));
myexptricksel(5, 10, 10);
myexptricksel(5, 10, -10);
myexptrickself(g, 5);
myexptrick(g);
myexptricksel(4, -5, -5);
myexptricksel(4, -5,  5);

sum (myexptrickself(g, k), k, 0, 10);








#####
#
# My e-mail about myexptrick to the Maxima mailing list
# 2022jan03
#
#####

# «myexptrick-email»  (to ".myexptrick-email")
# (find-maximamsg "37411162 202201 04" "Edrx: then I discovered")
# Subj: Extracting the constant from a sum of exponentials 
# then I discovered that I can replace it by this one-line program...

Thanks, Michael and Richard!

Just as a curiosity - and for the sake of completeness, and because
it's fun - let me explain why I needed this. I teach Calculus 2, and
all the books that I know say that to integrate polynomials of
"sin(k*x)"s and "cos(k*x)"s you have to apply some standard
trigonometric identities as many times as needed, and hope that at
some point you get something that you know how to integrate. I don't
like that method, so I teach an alternative... I was trying to write a
program that performs the alternative method that I like, and I was
able to write something - ugly, but it was my first program in Maxima!
- that gave the right results except for the "constant" part... and
then I discovered that I can replace it by this one-line program:

  myexptrick(f) := expand(demoivre(expand(exponentialize(f))));

So, in

  f : sin(x)^4 * cos(x)^2;
  g : expand(exponentialize(f));
  ratcoeff(g, exp(%i*x), 0);
  v : subst([x=-%i*log(z)], g);
  vt : taylor(v, z, 0, 10);
  coeff(vt, z, 0);

  myexptrick(f) := expand(demoivre(expand(exponentialize(f))));
  h : myexptrick(f);
  plot2d([f, h], [x, 0, 2*%pi]);

the line with "ratcoeff" implements Michael's suggestion, and the
lines with "v" and "vt" implement Richard's suggestion. The lines with
"myexptrick" convert the function f to the normal form that I was
looking for, and the "plot2d" is a good way to give to students some
evidence that at least in this case "myexptrick" returns an output
that is equivalent to its input...

  Cheers and thanks again =),
    Eduardo Ochs
    http://angg.twu.net/#eev
    http://angg.twu.net/eev-maxima.html




#####
#
# trigexpand
# 2022jan10
#
#####

# «trigexpand»  (to ".trigexpand")
# (find-maximamsg "37415086 202201 10" "R Toy: trigexpand")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
? trigexpand



#####
#
# trig-ids
# 2022jan03
#
#####

# «trig-ids»  (to ".trig-ids")
# Supersedes: (to "E-and-Einv")
# See: (c2m192p1p 4 "gabarito-maxima")
#      (c2m192p1a   "gabarito-maxima")
# (find-books "__analysis/__analysis.el" "hernandez")
# (find-hernandezpage (+ 10  47) "6 Integrais de Funções Trigonométricas")
# (find-maximanode "expand")
# (find-maximanode "demoivre")
# (find-maximanode "exponentialize")
# (find-maximanode "subst")
# (find-maximanode "%edispflag")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
myexptrick1(f) :=                        exponentialize(f);
myexptrick2(f) :=                 expand(exponentialize(f));
myexptrick3(f) :=        demoivre(expand(exponentialize(f)));
myexptrick(f)  := expand(demoivre(expand(exponentialize(f))));
xtoE(f)        := subst([x=log(E)/%i], f);

** (c2m192p1p 4 "gabarito-maxima")
** (c2m192p1a   "gabarito-maxima")
**
f : sin(5*x)^2 * cos(6*x)^2;
     myexptrick1(f);
     myexptrick2(f);
xtoE(myexptrick2(f));
xtoE(myexptrick2(f));
     myexptrick3(f);
     myexptrick(f);
integrate(myexptrick(f), x);

f : sin(x)^2 + cos(x)^2;
myexptrick(f);
f : sin(x)^2;
myexptrick(f);
f : cos(x)^2;
myexptrick(f);
f : sin(m*x) * cos(n*x);
myexptrick(f);
f : cos(x)^3;
myexptrick(f);

f : cos(x)^3 * sin(x)^2;
     myexptrick1(f);
     myexptrick2(f);
xtoE(myexptrick2(f));
     myexptrick3(f);
     myexptrick(f);

f : sin(x)^3 / 3 - sin(x)^5 / 5;
     myexptrick(f);
diff(myexptrick(f), x);
f : cos(x)^4;
myexptrick(f);
f : sin(x)^6;
myexptrick(f);



#####
#
# int-pow-sin-cos
# 2022sep22
#
#####

# «int-pow-sin-cos»  (to ".int-pow-sin-cos")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
f(kc,ks) := cos(x)^kc * sin(x)^ks;
F(kc,ks) := integrate(f(kc,ks), x);
F(0,1);
F(0,3);
F(0,5);
F(1,0);
F(1,1);
F(1,2);
F(1,3);
F(1,4);
F(1,5);
F(2,1);
F(2,3);
F(2,5);
F(3,0);
F(3,1);
F(3,2);
F(3,3);
F(3,4);
F(3,5);





#####
#
# books
# 2021dec21
#
#####

# «books»  (to ".books")
# (find-books "__comp/__comp.el" "maximabook")
# (find-books "__comp/__comp.el" "maxima-urroz")



#####
#
# Gilberto Urroz's draft Maxima book
# 2009sep16 / 2021dec17
#
#####

# «gurro-book»  (to ".gurro-book")
# https://maxima.sourceforge.io/documentation.html
# https://maxima.sourceforge.io/misc/maxima-opinions.pdf
# https://maxima.sourceforge.io/docs/maximabook/maximabook-19-Sept-2004.pdf


# https://home.csulb.edu/~woollett/
# https://home.csulb.edu/~woollett/mbe.html
# https://maxima.sourceforge.io/docs/manual/intromax.pdf
# https://maxima.sourceforge.io/docs/tutorial/en/minimal-maxima.pdf

http://servidor.demec.ufpr.br/disciplinas/EngMec_NOTURNO/TM350/SMath/SMathStudio.0_85.Article.Eng.pdf

# (find-sh "lynx -dump http://www.neng.usu.edu/cee/faculty/gurro/Maxima.html")
# http://www.neng.usu.edu/cee/faculty/gurro/Maxima.html
# http://www.neng.usu.edu/cee/faculty/gurro/Software_Calculators/Maxima_Docs/MyMaximaBook/Maxima0.8.2_Notes.pdf
# http://www.neng.usu.edu/cee/faculty/gurro/Software_Calculators/Maxima_Docs/MyMaximaBook/MaximaBookChapter1.pdf
# http://www.neng.usu.edu/cee/faculty/gurro/Software_Calculators/Maxima_Docs/MyMaximaBook/MaximaBookChapter2.pdf
# http://www.neng.usu.edu/cee/faculty/gurro/Software_Calculators/Maxima_Docs/MyMaximaBook/MaximaBookChapter3.pdf
# http://www.neng.usu.edu/cee/faculty/gurro/Software_Calculators/Maxima_Docs/MyMaximaBook/MaximaBookChapter4.pdf
# http://www.neng.usu.edu/cee/faculty/gurro/Software_Calculators/Maxima_Docs/MyMaximaBook/MaximaBookChapter4.pdf
# http://www.neng.usu.edu/cee/faculty/gurro/Software_Calculators/Maxima_Docs/MyMaximaBook/MaximaBookChapter5.pdf
# http://www.neng.usu.edu/cee/faculty/gurro/Software_Calculators/Maxima_Docs/MyMaximaBook/MaximaBookChapter6.pdf
# http://www.neng.usu.edu/cee/faculty/gurro/Software_Calculators/Maxima_Docs/MyMaximaBook/MaximaBookChapter7.pdf
# http://www.neng.usu.edu/cee/faculty/gurro/Software_Calculators/Maxima_Docs/MyMaximaBook/MaximaBookChapter8.pdf
# http://www.neng.usu.edu/cee/faculty/gurro/Software_Calculators/Maxima_Docs/MyMaximaBook/MaximaBookChapter9.pdf

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
cd
find snarf/http/www.neng.usu.edu/cee/faculty/gurro/
tar -cvzf /tmp/2009oct06.tgz snarf/http/www.neng.usu.edu/cee/faculty/gurro/
cp     -v /tmp/2009oct06.tgz /tmp/pen/




#####
#
# Maxima from the CVS
# 2009sep22
#
#####

# «maxima-cvs»  (to ".maxima-cvs")
# http://maxima.sourceforge.net/download.html

# (find-fline "~/usrc/maxima-cvs/usr/bin/")
(defun eepitch-maximacvs () (interactive)
  (eepitch-comint "maximacvs" "~/usrc/maxima-cvs/usr/bin/maxima"))

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load(draw);
draw3d(
   terminal   = screen,
   color      = blue,
   nticks     = 60,
   line_width = 3,
   enhanced3d = (u-1)^2,
   parametric(cos(5*u)^2,sin(7*u),u-2,u,0,2));

/* Multiple windows. */
draw2d(explicit(x^5,x,-2,2), terminal=[screen, 3]);
draw2d(explicit(x^2,x,-2,2), terminal=[screen, 0]);

/* An animated gif file. */
draw(
  delay     = 100,
  file_name = "/tmp/zzz",
  terminal  = 'animated_gif,
  gr2d(explicit(x^2,x,-1,1)),
  gr2d(explicit(x^3,x,-1,1)),
  gr2d(explicit(x^4,x,-1,1)));

*;; file:///tmp/zzz.gif

draw3d(enhanced3d = sin(u)+cos(v),
       /* terminal   = eps_color, */
       terminal   = screen,
       palette    = [8,4,3],
       eps_height = 15,
       eps_width  = 15,
       parametric_surface(cos(u)+.5*cos(u)*cos(v),
                          sin(u)+.5*sin(u)*cos(v),
                          .5*sin(v),
                          u, -%pi, %pi,
                          v, -%pi, %pi),
       parametric_surface(1+cos(u)+.5*cos(u)*cos(v),
                          .5*sin(v),
                          sin(u)+.5*sin(u)*cos(v),
                          u, -%pi, %pi,
                          v, -%pi, %pi));




#####
#
# maxima-git
# 2021dec18
#
#####

# «maxima-git»  (to ".maxima-git")
# https://maxima.sourceforge.io/download.html
# https://sourceforge.net/p/maxima/code/ci/master/tree/
# git clone https://git.code.sf.net/p/maxima/code maxima-code
# (find-git-links "https://git.code.sf.net/p/maxima/code" "maximagit")

* (eepitch-shell3)
* (eepitch-kill)
* (eepitch-shell3)
cd ~/bigsrc/
git clone https://git.code.sf.net/p/maxima/code maxima
cd ~/bigsrc/maxima/
git pull

export PAGER=cat
git branch --list -a
git for-each-ref
git log --oneline --graph --all -20

cd ~/bigsrc/maxima/
git checkout 5.46.0
git checkout master
git checkout lexical-symbols
git clean -dfx
git reset --hard
# (find-maximagitsh "find * | sort")
# (find-maximagitfile "doc/info/maxima-index.lisp")
make                |& tee om
make                |& tee omh

cd ~/bigsrc/maxima/
git checkout master
git clean -dfx
git reset --hard

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
# (find-es "git" "very-hard-reset")
# (find-maximagitfile "INSTALL")
# (find-maximagitfile "INSTALL" "IF CONFIGURE SCRIPT IS PRESENT")
# (find-maximagitsh   "./configure --help")
# (find-maximagitfile "oc")
# (find-maximagitfile "och")
# (find-maximagitfile "om")
# (find-maximagitfile "om" "makeinfo")
# (find-maximagitfile "om" "makeinfo --html -c TEXI2HTML=1 --split=chapter")
# (find-maximagitfile "omi")
# (find-maximagitgrep "grep --color=auto -nRH --null -e '--split=chapter' *")
# (find-maximagitgrep "grep --color=auto -nRH --null -e branch_5_45_base *")
# (find-maximagitgrep "grep --color=auto -nRH --null -e verpkglibdir *")
# (find-maximagitgrep "grep --color=auto -nRH --null -e checkinst *")
# (find-maximagitfile "Makefile" "verpkglibdir =")
# (find-maximagitfile "doc/info/Makefile")
# (find-maximagitfile "doc/info/Makefile.am")
# (find-maximagitfile "doc/info/Makefile.in")
# (find-maximagitfile "doc/info/build_html.sh")
# (find-maximagitfile "doc/info/build_html.sh" "--no-node-files so")
# (find-maximagitfile "doc/info/")
# (find-maximagitfile "missing")
# (find-maximagitfile "Makefile")
# file:///home/edrx/bigsrc/maxima/doc/info/maxima_75.html
# (find-gitk "~/bigsrc/maxima/")

* (eepitch-shell3)
* (eepitch-kill)
* (eepitch-shell3)
cd ~/bigsrc/maxima/
git checkout master
git clean -dfx
git reset --hard
git pull
./bootstrap         |& tee ob
./configure --help  |& tee och
./configure         |& tee oc
make                |& tee om
make check          |& tee omc
sudo make install   |& tee omi
make tags           |& tee omt

make html           |& tee omh

sudo make uninstall |& tee omui

# (find-maximagitfile "" "omi")
# (find-fline "/usr/local/share/maxima/")
# (find-fline "/usr/local/share/maxima/branch_5_46_base_555_g6fa201ff5/")
# (find-fline "/usr/local/share/maxima/branch_5_46_base_415_ge406ac453/")
# (find-fline "/usr/local/share/maxima/branch_5_45_base_309_gea23a96f9/")
# (find-fline "/usr/local/share/maxima/branch_5_46_base_250_gbd5ffb328/")



#####
#
# installation-directories
# 2021dec22
#
#####

# «installation-directories»  (to ".installation-directories")
# https://mail.google.com/mail/u/0/#sent/QgrcJHsbdJTJPlSGDHTrjKFDmwBNnpbzBXb
# (find-maximamsg "37405965 202112 21" "Edrx" "directory")

Hi list,

I am on Debian and I am trying to use Maxima from git.
If I run

  cd ~/bigsrc/maxima/
  git reset
  ./bootstrap
  ./configure --help
  ./configure
  make
  make check
  sudo make install

the "make install" installs the directories demo/, doc/, share/, src/,
tests/, and xmaxima/ inside this directory:

  /usr/local/share/maxima/branch_5_45_base_309_gea23a96f9/

How can I make it use this directory

  /usr/local/share/maxima/

or this one

  /usr/local/share/maxima/5.45/

instead of the one with the very long name? I found these lines in
~/bigsrc/maxima/Makefile.in,

  verpkglibdir = $(pkglibdir)/@VERSION@
  verpkglibexecdir = $(libexecdir)/@PACKAGE@/@VERSION@
  verpkgdatadir = $(pkgdatadir)/@VERSION@

and i saw that they becomes these ones in ~/bigsrc/maxima/Makefile:

  verpkglibdir = $(pkglibdir)/branch_5_45_base_309_gea23a96f9
  verpkglibexecdir = $(libexecdir)/maxima/branch_5_45_base_309_gea23a96f9
  verpkgdatadir = $(pkgdatadir)/branch_5_45_base_309_gea23a96f9

but I couldn't find a clean way to change the @VERSION@...

Thanks in advance! =)
  Eduardo Ochs
    http://angg.twu.net/#eev
    http://angg.twu.net/math-b.html




#####
#
# installation-dirs-2
# 2021dec23
#
#####

# «installation-dirs-2»  (to ".installation-dirs-2")

Hi all,

I asked about a way to install Maxima in directories with shorter
names because I thought that it would be natural to have an easy way
to do that...

I usually keep "executable notes" of everything that I do - that's a
long story; the best short version of it that I have that people can
understand in one minute or two is here:

  http://angg.twu.net/LATEX/2019emacsconf.pdf
  http://angg.twu.net/emacsconf2019.html

and for most kinds of "elisp hyperlinks" I have good tricks to hide
long directory names. For example, each of the three sexps below
defines a function `find-maximasharefile' in Emacs in a different way,

  (code-c-d "maximashare" "~/bigsrc/maxima/share/")
  (code-c-d "maximashare" "/usr/local/share/maxima/branch_5_45_base_309_gea23a96f9/share/")
  (code-c-d "maximashare" "/usr/share/maxima/5.44.0/share/")

and after running one of these `code-c-d's I can use sexps like this
to point to a file, and to point to the first occurrence of a certain
string in a file:

  (find-maximasharefile "calculus/fourie.mac")
  (find-maximasharefile "calculus/fourie.mac" "fourcos(f%,x,p):=")

There is one situation in which I still use normal URLs instead of
these sexp hyperlinks, thought - it's when I have to point to docs in
HTML. I use URLs like these ones

  file:///usr/share/doc/maxima-doc/html/maxima_43.html
  file:///home/edrx/bigsrc/maxima/doc/info/maxima_43.html
  file:///usr/local/share/maxima/branch_5_45_base_309_gea23a96f9/doc/html/maxima_43.html
  https://maxima.sourceforge.io/docs/manual/maxima_43.html

to point to the HTML version of a page of the Maxima manual... I
usually just copy these URLs from the browser to my notes, and I never
had good excuses to work on tools to transform these sexps until now -
or, to be more honest: until a few months ago.

Soooo: there isn't an easy way to make Maxima use a shorter version
name, but I can add a step to my build script that will copy the HTMLs
to another directory, so that this would work:

  file:///usr/local/share/maxima-html/maxima_43.html

The program that I use to htmlize my notes knows how to transform
file:/// urls, and in a few hours or days I will teach it that the
URL above has to become this in the htmlized version:

  https://maxima.sourceforge.io/docs/manual/maxima_43.html

My notes about Maxima are here, but they are a huge horrible mess at
the moment:

  http://angg.twu.net/e/maxima.e.html

I started to use Maxima in 2008 but I didn't learn much then, and
after some years I sort of switched to SymPy and forgot that Maxima
existed... I _HATED_ SymPy but I kept trying to use it - until I
rediscovered Maxima some time ago. So now I am trying to migrate the
few programs that I wrote in SymPy in my SymPy phase to Maxima...

Anyway, here is a wishlist-ish bug. If we hover the mouse at the right
of a section title in a page like

  https://docs.sympy.org/latest/modules/polys/reference.html

we see a pilcrow sign with a permalink to that section. Would it be
easy to implement something like that in the HTML docs of Maxima?





#####
#
# checkinstall
# 2021dec23
#
#####

# «checkinstall»  (to ".checkinstall")
# https://en.wikipedia.org/wiki/CheckInstall
# https://wiki.debian.org/CheckInstall
# (find-maximamsg "37406152 202112 23" "I usually don't bother")

FWIW, Eduardo, I usually don't bother installing Maxima and just run
it from its directory. In the rare case that I did need to install a
Maxima built from git, I used checkinstall.









# (find-fline "~/usrc/")
# (find-fline "~/usrc/code/")
# (find-gitk  "~/usrc/code/")

# (code-c-d "maximagit" "~/bigsrc/maxima/")
# (find-maximagitfile "")
# (find-maximagitfile "INSTALL.git")
# (find-maximagitfile "INSTALL")
# (find-maximagitfile "src/")
# (find-maximagitfile "demo/cf.dem")
# (find-maximagitfile "demo/manual.demo")
# (find-maximagitfile "archive/books/")
# (find-maximagitfile "archive/books/schelter/")
# (find-maximagitfile "archive/books/schelter/xplot.bk")
# (find-maximagitfile "archive/info/")
# (find-maximagitfile "archive/info/maxima-primer.tex")
# (find-maximagitfile "share/")
# (find-maximagitfile "share/integration/")
# (find-maximagitfile "share/calculus/")
# (find-maximagitgrep "grep --color=auto -niH --null -e kill src/*.lisp")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)





#####
#
# hollow points
# 2009oct06
#
#####

# «hollow-points»  (to ".hollow-points")
# (find-maximacvsnode "Functions and Variables for draw" "Graphic option: point_type")
# (find-maximacvsnode "Functions and Variables for draw" "set_draw_defaults")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load(draw);
F1(x) := -x^2 / 2;
F2(x) := -(x-4)^2 / 2;
F(x) := if x <= 2 then F1(x) else F2(x);
f1(x) := diff(F1(x), 'x);
f2(x) := diff(F2(x), 'x);
f(x) := if x <= 2 then f1(x) else f2(x);
set_draw_defaults(terminal = screen,
       xaxis = true,
       yaxis = true,
       xaxis_type = solid,
       yaxis_type = solid,
       xrange        = [-2, 7],
       yrange        = [-5, 4]);
draw2d(explicit(F(x),   x, -2, 7),
       explicit(F(x)+2, x, -2, 7));
draw2d(explicit(f1(x),  x, -2, 2),
       explicit(f2(x),  x,  2, 7),
       point_size = 3,
       point_type = circle,
       points([[2, f1(2)]]),
       point_type = filled_circle,
       points([[2, f2(2)]]));

*;; «draw-apply»  (to ".draw-apply")
*;; (find-maximacvssrcfile "share/draw/draw.lisp" "defun $draw")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load(draw);
f1(x) := -x/2;
f2(x) := 2 - x/2;
Open(x, y)   := [point_size = 3, point_type = circle,        points([[x, y]])];
Closed(x, y) := [point_size = 3, point_type = filled_circle, points([[x, y]])];
Curves       :  [explicit(f1(x),  x, -2, 2), explicit(f2(x),  x,  2, 7)];
Switch       :  append(Open(2, f1(2)), Closed(2, f2(2)));
apply(draw2d, append(Curves, Switch));




#####
#
# Riemann integral
# 2009nov03
#
#####

# «riemann»  (to ".riemann")
# (find-maximacvsnode "Functions and Variables for draw" "option: points_joined")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load(draw);
f(x) := exp(-x^2);
Curve : [explicit(f(x), x, -2, 2)];
Xaxis : [explicit(0, x, -2, 2)];
Block_options : [points_joined = true, point_type = none, line_type = solid];
Block_lines(x0, x1, y) := [points([[x0, 0], [x0, y], [x1, y], [x1, 0]])];
Block(x0, x1, y) := append(Block_options, Block_lines(x0, x1, y));
apply(draw2d, append(Curve, Xaxis, Block(-1, -0.5, f(-1)), Block(0, 0.5, f(0.5))));





#####
#
# Extra documentation for the "draw" package
# 2009oct13
#
#####

# «maxima-gpdraw»  (to ".maxima-gpdraw")
# (find-angg ".emacs" "maxima-gpdraw")




#####
#
# Implicit functions
# 2010mar15
#
#####

# «implicit»  (to ".implicit")
# (find-maximagpdraww3m "implic/index.html")
* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load(draw);
draw2d(/* terminal  = eps, */
       grid      = true,
       line_type = solid,
       key       = "y^2=x^3-2*x+1",
         implicit(y^2=x^3-2*x+1, x, -4,4, y, -4,4),
       line_type = dots,
       key       = "x^3+y^3 = 3*x*y^2-x-1",
         implicit(x^3+y^3 = 3*x*y^2-x-1, x, -4,4, y, -4,4),
       title     = "Two implicit functions" );




#####
#
# Contour plots
# 2010mar15
#
#####

# (find-maximanode "contour_levels")
# (find-maximanode "contour")
# (find-maximagpdraww3m "contours/index.html")
# (find-sh "locate -i maxima | grep -i contour")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
2 + 3;


load(draw);
draw3d(color = green,
         explicit(20*exp(-x^2-y^2)-10,x,0,2,y,-3,3),
       yv_grid = 10,
       color   = red,
         explicit(x+y,x,0,2,y,-5,5),
       contour_levels = 15,
       contour        = base,
       surface_hide   = true) ;
draw3d(title    = "This is the last contours example",
         explicit(20*exp(-x^2-y^2)-10,x,0,2,y,-3,3),
       contour_levels = 15,
       contour        = map,
       surface_hide   = true) ;
draw3d(title    = "This is the last contours example",
         explicit(20*exp(-x^2-y^2)-10,x,0,2,y,-3,3),
       contour_levels = 15,
       contour        = map,
       surface_hide   = true) ;
draw3d(explicit(20*exp(-x^2-y^2)-10,x,0,2,y,-3,3),
       contour_levels = 15,
       contour        = base,
       surface_hide   = true) ;
draw3d(explicit(20*exp(-x^2-y^2)-10,x,0,2,y,-3,3),
       contour_levels = 15,
       contour        = base,
       surface_hide   = false) ;
draw3d(explicit(20*exp(-x^2-y^2)-10,x,0,2,y,-3,3),
       contour_levels = 15,
       contour        = map) ;
draw3d(explicit((y^4)-(y^2-x^2), x,-0.8,0.8, y,-1.25,1.25),
       contour_levels = 15,
       contour        = base) ;

# (find-maximanode "Functions and Variables for Expressions" "infix")
# (find-maximanode "Function and Variable Index")
# (find-maximanode "Function and Variable Index" "contour")






#####
#
# listify
# 2009oct13
#
#####

# «listify»  (to ".listify")
# (find-maximagpdraww3m "vectors/index.html")
# (find-maximagpdrawgrep "grep -nrH -e listify *")
# (find-maximanode "Functions and Variables for Sets" "Function: listify")
# (find-maximanode "Functions and Variables for Lists" "Function: makelist")
# (find-maximanode "Functions and Variables for Lists" "Function: create_list")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load(draw);
*
*;; A vector field is plotted as a set of vectors.
*;; /* vector origins are {(x,y)| x,y=1,...,10}  */
coord   : setify(makelist(k, k, 1, 10));
points2d: listify(cartesian_product(coord, coord));
*
*;; /* compute vectors at the given points  */
vf2d(x,y):= vector([x,y], 2*[sin(x), cos(y)]);
vf2d(2*%pi, %pi);
vect2: makelist(vf2d(k[1],k[2]), k, points2d);
*
*;; /* draw the vector field */
apply(draw2d,
      append([head_length=0.1, color=blue],
             vect2));

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
makelist(concat(x, i), i, 1, 6);
makelist(x=y, y, [a, b, c]);
mymakelist(a, b, n) := makelist(a + (b-a)*(i/n), i, 0, n);
mymakelist(b, a, 4);
list_product(L1, L2) := listify(cartesian_product(setify(L1), setify(L2)));
list_product(mymakelist(2, 3, 3), mymakelist(4, 5, 4));



coord   : setify(makelist(k, k, 1, 10));
points2d: listify(cartesian_product(coord, coord));



makelist;



* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
listify ({a, b, c, d});
*;; [a, b, c, d]
listify (F ({a, b, c, d}));
*;; F({a, b, c, d})




#####
#
# Drawing a torus with vectors showing a flux
# 2009oct06
#
#####

# «torus-with-flux»  (to ".torus-with-flux")
# (find-maximanode "Functions and Variables for draw" "option: head_length")
# (find-maximanode "Functions and Variables for draw" "option: head_type")
# (find-maximanode "Functions and Variables for draw" "option: head_angle")
# (find-maximanode "Functions and Variables for draw" "option: unit_vectors")
# (find-maximanode "Functions and Variables for draw" "object: vector")
# http://www.telefonica.net/web2/biomates/maxima/gpdraw/index.html
# http://www.telefonica.net/web2/biomates/maxima/gpdraw/vectors/index.html

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load(draw);
xfor(u, v) := cos(u) * (2 + cos(v));
yfor(u, v) := sin(u) * (2 + cos(v));
zfor(u, v) :=               sin(v);
psurface1 : parametric_surface(xfor(u,v), yfor(u,v), zfor(u,v), u,0,u1, v,0,v1);
foo(u1, v1) := draw3d(enhanced3d = u + v, psurface1);
f(uv1) := foo(uv1, uv1);
f(1);
f(1.5);
f(2);
f(2.5);
f(3);
f(3.5);
f(4);
f(4.5);
f(5);
f(5.5);
f(6);

# (find-maximanode "Functions and Variables for Differentiation")
* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load(draw);




#####
#
# parametric_surface
# 2021dec17
#
#####

# «parametric_surface»  (to ".parametric_surface")
# (find-maximanode "Functions and Variables for draw" "object: parametric_surface")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load(draw);
x_for(u, v) := cos(u) * (2 + cos(v));
y_for(u, v) := sin(u) * (2 + cos(v));
z_for(u, v) :=               sin(v);
**
xyz_for(u, v) := [x_for(u, v), y_for(u, v), z_for(u, v)];
xyz_for_uv(uv) := apply(xyz_for, uv);
xyz_for(0, 0);
xyz_for(0.1, 0.1);
xyz_for_uv([0.1, 0.1]);
uv : [0.1, 0.1];
apply(parametric_surface, append(xyz_for_uv(uv), [u,0,u1, v,0,v1]));
**
psurface1(u1, v1) := parametric_surface(x_for(u,v), y_for(u,v), z_for(u,v), u,0,u1, v,0,v1);
foo(u1, v1) := draw3d(enhanced3d = u + v, psurface1(u1, v1));
f(uv1) := foo(uv1, uv1);
f(2.5);
f(3);
**
Surface : [enhanced3d = u + v, psurface1(3, 3)];
Vector_options : [head_length = 0.05, head_angle = 10];
Vectors : [vector([0,0,0],[0,0,.1])];
apply(draw3d, append(Surface, Vector_options, Vectors));

(enhanced3d = u + v, psurface1(3, 3), vector([0,0,0],[0,0,.1]));

vec :=
           vector([5.35,2.45],[-1.53,3.25]),
           vector([-1,7.5],[3,0]),

       explicit(f(x)+2, x, -2, 7));

       points([[2, f(2)], [2, f(2)+2]]),
       head_length = 0.5,
       head_angle  = 15,
       vector([1,0],[2,3])
       );

# (find-maximanode "Functions and Variables for Help" "example (append);")
# (find-maximanode "Functions and Variables for Help" "example (append);")
# (find-maximanode "Functions and Variables for draw" "Graphic object: vector")
# (find-maximanode "Functions and Variables for draw" "Scene constructor: gr3d")
# (find-maximafile "")
# (find-maximafile "maxima/interfaces/xmaxima/xmaxima")
# (find-maximafile "src/binary-gcl/")
# (find-maximagrep "grep -nirH -e gnuplot_pipes *")
# (find-fline "~/usrc/maxima-cvs/maxima/")
# (find-fline "~/usrc/maxima-cvs/maxima/share/draw/")
# (find-fline "~/usrc/maxima-cvs/maxima/share/draw/draw.lisp")
# (find-fline "~/usrc/maxima-cvs/maxima/share/draw/draw.lisp" "implicit3d")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load("draw");

# (find-maximanode "Functions and Variables for Input and Output" "Function: load")
# (find-maximanode "Functions and Variables for Input and Output" "Function: file_search")
# (find-maximanode "Functions and Variables for Input and Output" "file_search_maxima: append")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
:lisp (load "/home/edrx/usrc/maxima-cvs/maxima/share/draw/draw.lisp")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
file_search_lisp;
file_search_lisp: append ([
  "/home/edrx/usrc/maxima-cvs/maxima/share/draw/###.lisp",
  file_search_lisp]);
load(draw);


* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
mkdir ~/.maxima/
cd    ~/.maxima/
rm -v draw.lisp implicit3d.lisp picture.lisp wbd.lisp worldmap.mac
cp -sv ~/usrc/maxima-cvs/maxima/share/draw/*.{lisp,mac} .

# (find-fline "~/usrc/maxima-cvs/maxima/share/draw/")
# (find-fline "~/.maxima/")
~/usrc/maxima-cvs/maxima/share/draw/


* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load(draw);
draw3d(surface_hide = true,
       enhanced3d   = true,
       colorbox     = false,
    /* terminal     = png, */
       explicit(20*exp(-x^2-y^2)-10,x,-3,3,y,-3,3));




#####
#
# seq
# 2010jan06
#
#####

# «seq»  (to ".seq")
# «n^2+n+41»  (to ".n^2+n+41")
# (find-fline "/usr/share/maxima/5.17.1/share/matrix/eigeni.mac")
# (find-maximaindex-links "do factor for display makelist map")
# (find-man "1 seq")
# (find-sh0 "seq 2 5")

** Problem: when is f(n) := n^2 + n + 41 a composite number?
** Trick 1: if there is a 0 in fmods(m) then some "f(n)"s are divisible by m.
** Trick 2: look at:
**   makelist(factor(f(n)), n, seq(0, 41));

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
f(n)      := n^2 + n + 41;
fm(n, m)  := mod(f(n), m);
seq(a, b) := makelist(i, i, a, b);
seq(2, 5);
** --> [2, 3, 4, 5]
**
fmods(m)  := makelist(fm(n, m), n, seq(0, m-1));
[fm(0, 11), fm(1, 11), fm(2, 11), fm(3, 11), fm(4, 11), fm(5, 11)];
display(fmods(11));
primes : [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41];
for m in primes do display(fmods(m))$
factor(f(40));
factor(f(41));
makelist(factor(f(n)), n, seq(0, 41));

for m in seq(1, 40) do display(m, factor(f(m)))$




#####
#
# makelist
# 2022jul22
#
#####

# «makelist»  (to ".makelist")
# «seqn»      (to ".seqn")
# (find-maximanode "makelist")
# (find-angg "LUA/lua50init.lua" "map" "seqn =")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
makelist (concat (x,i), i, 6);   /* [x1, x2, x3, x4, x5, x6] */
makelist (x=y, y, [a, b, c]);    /* [x = a, x = b, x = c] */
makelist (x^2, x, 3, 2*%pi, 2);  /* [9, 25] */
makelist (random(6), 4);         /* [2, 0, 2, 5] */
flatten (makelist (makelist (i^2, 3), i, 4)); /* [1, 1, 1, 4, 4, 4, 9, 9, 9, 16, 16, 16] */
flatten (makelist (makelist (i^2, i, 3), 4)); /* [1, 4, 9, 1, 4, 9, 1, 4, 9, 1, 4, 9] */

[a,b,n] : [10,20,5];
makelist(a + (b-a)*k/n, k, 0, n);
seqn(a,b,n) := makelist(a + (b-a)*k/n, k, 0, n);
seqn(10, 20, 5);
seqn(10, 20, 2);



#####
#
# numerozinhos
# 2022jul22
#
#####

# «numerozinhos»  (to ".numerozinhos")
# (find-maximanode "matrix")
# (find-maximanode "apply")
# (find-maximanode "function")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
apply(matrix, [[1, 2], [3, 4]]);
makelist(i, i, 2, 5);
makelist(i, i, 5, 2, -1);
numerozinhos :
   lambda([xmin,ymin, xmax,ymax, f],
          apply(matrix,
                makelist(makelist(f(x,y), x, xmin, xmax),
                y, ymax, ymin, -1)));
grind(numerozinhos);
numerozinhos(2,3, 4,5, lambda([x,y], 10*x+y));
numerozinhos(2,3, 4,5, lambda([x,y], (x,y)));
numerozinhos(2,3, 4,5, lambda([x,y], [x,y]));
[Dx,Dy] : [x-x0,y-y0];
[x0,y0] : [4,3];
x0;
ev(Dx);
numerozinhos(x0-2,y0-2, x0+2,y0+2, lambda([x,y], ev([Dx,Dy])));
numerozinhos(x0-2,y0-2, x0+2,y0+2, lambda([x,y], ev(Dx+Dy)));
numerozinhos(x0-2,y0-2, x0+2,y0+2, lambda([x,y], ev(Dx-Dy)));
numerozinhos(x0-2,y0-2, x0+2,y0+2, lambda([x,y], ev((Dx-Dy)*Dy)));
numerozinhos(x0-3,y0-3, x0+3,y0+3, lambda([x,y], ev((Dx-Dy)*Dy)));
F : (Dx-Dy)*Dy;
numerozinhos(x0-3,y0-3, x0+3,y0+3, lambda([x,y], ev(F)));
F - 1;




#####
#
# matrixify
# 2022jul22
#
#####

# «matrixify»  (to ".matrixify")
# (find-angg "MAXIMA/matrixify.mac")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
** (find-angg "MAXIMA/matrixify.mac")
load       ("~/MAXIMA/matrixify.mac");
[Dx,Dy] : [x-x0,y-y0];
[x0,y0] : [5,4];
matrixify(x0-3,y0-3, x0+3,y0+3, [x,y]);
matrixify(x0-3,y0-3, x0+3,y0+3, [Dx,Dy]);
matrixify(x0-3,y0-3, x0+3,y0+3, Dx-Dy);
matrixify(x0-3,y0-3, x0+3,y0+3, Dy);
matrixify(x0-3,y0-3, x0+3,y0+3, Dy*(Dx-Dy));
z : Dy*(Dx-Dy);
z : ev(z);
plot2d([contour, z], [x,x0-3,x0+3], [y,y0-3,y0+3]);
set_plot_option(contour_levels, 15);
plot2d([contour, z], [x,x0-3,x0+3], [y,y0-3,y0+3]);

? set_plot_option
set_plot_option()
;
** (find-books "__comp/__comp.el" "maxima-workbook")
** (find-maximawbpage (+ 19 31) "5 Graphical representation of functions")


sols : solve(z-1, y);
** (find-angg "MAXIMA/traverse.mac")
load       ("~/MAXIMA/traverse.mac");
traverse(sols);
traverse(sols, 1);
traverse(sols, 1, 'op);
traverse(sols, 1, 'args);
traverse(sols, 1, 2);
traverse(sols, 1, 2, 'op);
traverse(sols, 1, 2, 'args);
traverse(sols, 1, 2, 1);
traverse(sols, 1, 2, 1, 1);
traverse(sols, 1, 2, 1, 1, 'args);
traverse(sols, 1, 2, 1, 1, 1);
traverse(sols, 1, 2, 1, 1, 1, 'args);
traverse(sols, 1, 2, 1, 1, 1, 1);
eq1 : traverse(sols, 1, 2, 1, 1, 1, 1);
solve(eq1, x);
**
** (find-maximanode "contour_levels")
** (find-maximanode "contour")
** (find-maximanode "explicit")
draw3d(color = green,
       explicit(z, x,x0-3,x0+3, y,y0-3,y0+3),
       contour_levels = [0,0.2,2],
       contour        = both,
       surface_hide   = true) $
draw3d(color = green,
       explicit(z, x,x0-3,x0+3, y,y0-3,y0+3),
       contour_levels = [0,0.2,2],
       contour        = both) $

** (find-maximanode "solve")
** (find-maximanode "plot3d")
** (find-maximanode "contour")
** (find-maximanode "plot3d" "Two surfaces in the same plot")
plot3d(ev(z), [x,x0-3,x0+3], [y,y0-3,y0+3]);




#####
#
# expand and ev
# 2010feb18
#
#####

# «expand-and-ev»  (to ".expand-and-ev")
# (find-maximaindex-links "ev expand")
# (find-maximaindex "ev" :RET)
# (find-maximaindex "ev" :RET "expand")
# (find-maximanode "ev")
# (find-maximanode "ev" " <expr>, <arg_1>, ..., <arg_n>")
# (find-maximanode "expand")
# (find-maximaindex "expand" :RET)

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
f(x) := ((((x-1)*x+1)*x-1)*x+1);
g(x) := ((((x-1)*x+1)*x-1)*x+1)*(x+1);
f(10);
g(10);
g(x);
ev(g(x), expand);
g(x);
g(x), expand;
g(x), expand=true;
g(x), expand=false;



#####
#
# 2010.1, Cálculo 2, prova 1
# 2010may05
#
#####

# «2010.1-C2-P1»  (to ".2010.1-C2-P1")
# (find-maximanode "Functions and Variables for Equations")
# (find-maximanode "Functions and Variables for Equations" "Function: solve")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
F1(x) :=   x + 1;
F2(x) := x^3 - x;
F3(x) :=   1 - x;
F (x) := if x < -1 then F1(x) else if -1 <= x and x <= 1 then F2(x) else F3(x);
load(draw);
draw2d(explicit(F(x), x, -3, 3));
f(x) := diff(F(x), x);

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
f1(x) := 1;
f2(x) := 3*(x-2)^2 - 1;
f3(x) := -1;
ev(f2(x));
ev(f2(x), expand);
integrate(f2(x), x);
integrate(f2(x), x, 1, 3);
f2(2);

pack13(f1, f2, f3, x) := if x < 1 then f1(x) else if 1 <= x and x <= 3 then f2(x) else f3(x);
f(x) := pack13(f1(x), f2(x), f3(x), x);
load(draw);
draw2d(explicit(f(x), x, -3, 4), xaxis = true);

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
f(x) := sqrt(1-x^2);
f(1);
integrate(f(x), x);
tex(integrate(f(x), x));


# Broken:
#
# f (x) := if x < 1 then f1(x) else if 1 <= x and x <= 3 then f2(x) else f3(x);
# draw2d(explicit(f(x), x, -3, 4), xaxis = true);
#
# F(x)  := integrate (f(x), x);
# draw2d(explicit(F(x), x, -3, 4));
#
# (find-maximanode "Functions and Variables for Integration")


* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
e1 : (x/5)^2 + (y/4)^2 = 1;
e2 : x = 0;
e3 : y > 0;
S : solve(e1, y);
S : solve([e1], y);
E : second(S);
first(E);
second(E);
c(x) := ''%;
c(0);
integrate(c(x), x, -5, 5);
grind(E);
string(E);
tex(E);

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
atan(0);
ev(atan(1));
ev(atan(1), numer);
ev(atan(4/5));
ev(atan(4/5), numer);
atan(1/2);

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
cos(atan(3/4));
sin(atan(3/4));
ev(atan(0), numer);
ev(atan(3/4), numer);
ev(4*atan(1), numer);


* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
e1 : (x/5)^2 + (y/4)^2 = 1;
e2 : x = 0;
e3 : y > 0;
S : solve(e1, y);
S : solve([e1], y);
E : second(S);
op(E);
args(E);
solve([e1, e2], y);
solve([e1, e3], y);
[e1, e3];
A : ev(e1, x=0);

# (find-maximanode "Introduction to Command Line")
# (find-maximanode "Functions and Variables for Display" "Option variable: linel")
# (find-maximanode "Functions and Variables for Strings" "Function: string")
# (find-maximanode "Nouns and Verbs" "noundisp")




#####
#
# 2010.1-C2: trabalho sobre área de superfícies de revolução
# 2010jul01
#
#####

# «2010.1-C2-trab-area»  (to ".2010.1-C2-trab-area")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
*;; x0 : 2;
*;; x1 : 6;
*;; y0 : 2;
*;; y1 : 5;
Dx : x1 - x0;
Dy : y1 - y0;
h : sqrt(Dx^2 + Dy^2);
Dr : h;
L0 : 2 * %pi * y0;
L1 : 2 * %pi * y1;
DL : L1 - L0;
th : 2 * %pi * Dy / Dr;
r0 : L0 / th;
r1 : L1 / th;
r1 - r0 = Dr;
A0 : (th / 2) * r0^2;
A1 : (th / 2) * r1^2;
A : A1 - A0;
*
*
y05 : (y0 + y1) / 2;
r05 : (r0 + r1) / 2;
L05 : (L0 + L1) / 2;
Arect : L05 * Dr;
Arect = A;
tex(Arect = A);
*
A;
radcan(A);
radcan(Arect);

*;; (find-node "(maxima)Functions and Variables for Simplification" "example (radcan)")
*;; (find-node "(maxima)Functions and Variables for Expressions" "demo(\"disol\")")
example (radcan);
demo (disol);
;
;


%*
% (eedn4a-bounded)
% (find-sh0 "cd ~/LATEX/ && dvips  -D 300 -P pk -o tmp.ps tmp.dvi")
% (find-sh0 "cd ~/LATEX/ && dvired -D 300 -P pk -o tmp.ps tmp.dvi")
% (find-pspage "~/LATEX/tmp.ps")

\def\Dx{\DD x}
\def\Dy{\DD y}
\def\Dr{\DD r}
\def\DL{\DD L}

\par {\footnotesize (2010jul01)}
\bsk
\par A derivação da área do tronco de cone que a gente
\par fez em sala partia destas equações básicas:
\par (obs: $A_0$ é a área do pacman interno, $A_1$ a do externo)
\par $L_0 = r_0 = 2y_0$
\par $L_1 = r_1 = 2y_1$
\par $h = \Dr = \sqrt{\Dx^2 + \Dy^2}$
\par $A_0 = r_0^2/2$
\par $A_1 = r_0^2/2$
\par $A = A_1 - A_0$
\msk
\par Daí:
\par $\DL =  \Dr = 2\Dy$
\msk
\par Agora dá pra calcular a área a partir de $x_0$, $x_1$, $y_0$, $y_1$:
\par $\Dr := \sqrt{\Dx^2 + \Dy^2}$
\par $   := 2\Dy/\Dr$
\par $r_0 := 2y_0/ = y_0\Dr/\Dy$
\par $r_1 := 2y_1/ = y_1\Dr/\Dy$
\par $A_0 := r_0^2 = (2\Dy/\Dr)(y_0\Dr/\Dy)^2/2 = y_0^2\Dr/\Dy$
\par $A_1 := r_1^2 = (2\Dy/\Dr)(y_1\Dr/\Dy)^2/2 = y_1^2\Dr/\Dy$
\par $A := A_1 - A_0 = \Dr(y_1^2-y_0^2)/\Dy = \Dr(y_1 + y_0)$
\bsk
\par Olha que vergonha: só hoje eu notei que $(y_1^2-y_0^2)/\Dy = y_1 + y_0$...
\par Vários alunos usaram a fórmula para $A$ que aparece na maioria dos livros,
$$A = 2 \frac{y_0+y_1}{2} \sqrt{\Dx^2 + \Dy^2},$$
\par sem deduzí-la, e eu tive um trabalhão pra verificar que ela dava
\par o mesmo resultado que a minha... 8-(

%*



* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
E4(x) := exp(4*x);
diff(E4, x);

E4 : %e^(4*x);
EH : %e^(x/2);
f10 : 2/7 * E4 - 2/7 * EH;
diff(f10, x);

(+ -24 73)





#####
#
# Inverse transformations
# 2011dec09
#
#####

# «inverse-transformations»  (to ".inverse-transformations")
* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load("vect");
demo("vect");
;
;
;
;
;
;
;
;
;
;
;

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load("vect");
Op : [0, 1];
vp : [1/2, 1/2];
wp : [-1, 1];
 Os : [-1, -1/2];
 vs : [1, -1/2];
 ws : [1, 1/2];
xy : [x, y];
p(v) := Op + v[1]*vp + v[2]*wp;
s(v) := Os + v[1]*vs + v[2]*ws;
p(xy);
s(xy);
p(s(xy));
expand(p(s(xy)));
expand(s(p(xy)));

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
circ1(x, y) := x^2 + y^2 - R1;
circ2(x, y) := (x-a)^2 + y^2 - R2;
expand(circ1(x, y)/2 + circ2(x, y)/2);





Muitas pessoas tentaram resolver o problema 5 da P1 encontrando
algebricamente os dois pontos de interseção entre dois círculos, e
para isto elas usaram um método que não funcionava. Neste problema
vamos entender onde é que ele dava errado.

Sejam f(x,y) = x^2 + y^2 - 2^2,
      g(x,y) = (x-4)^2 + y^2 - 3^2,
      h(x,y) = f(x,y)/2 + g(x,y)/2,
      C = {(x,y)ÝR^2 | f(x,y)=0},
      C' = {(x,y)ÝR^2 | g(x,y)=0},
      C'' = {(x,y)ÝR^2 | h(x,y)=0},

a) Encontre 4 pontos pertencentes a C e 4 pontos pertencentes a C'.
   Além disso represente graficamente C e C'.

b) O conjunto C'' é um círculo centrado no ponto (2,0). Descubra o seu
   raio e encontre 4 pontos de C''.

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
circ(x0, y0, R, x, y) := (x-x0)^2 + (y-y0)^2 - R^2;
f(x, y) := circ(0, 0, 2, x, y);
g(x, y) := circ(4, 0, 3, x, y);
h(x, y) := f(x,y)/2 + g(x,y)/2;
H(x, y, a) := circ(2, 0, a, x, y);
expand(h(x,y));
expand(H(x,y, a));
expand(H(x,y, sqrt(5/2)));
ev(sqrt(5/2), numer);




#####
#
# symbols
# 2021dec10
#
#####

# «symbols»  (to ".symbols")
# (find-es "sympy" "tut-symbols")
# (find-node "(maxima)Identifiers")




#####
#
# bortolossi-5.5
# 2021dec10
#
#####

# «bortolossi-5.5»  (to ".bortolossi-5.5")
# (find-es "ipython" "bortolossi-5.5")
# (c3m212nfp 20 "exercicio-5")
# (c3m212nfa    "exercicio-5")
# (c3m212nfp 26 "exercicio-5-maxima")
# (c3m212nfa    "exercicio-5-maxima")
# (find-bortolossi5page (+ -162 177)   "[01] ...parciais de primeira ordem")
# (find-node "(maxima)Functions and Variables for Differentiation" "Function: diff")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)

/* Item a:
*/
f : sqrt(r^2 + s^2);
diff(f, r);
diff(f, s);
[diff(f, r), diff(f, s)];

/* Item b:
*/
f : t/s - s/t;
[diff(f, s), diff(f, t)];

/* Item c:
*/
f : 2*x^4*y^3 - x*y^2 + 3*y + 1;
[diff(f, x), diff(f, y)];


/* Item d:
*/
f :          (t+v) / (t-v)  ;
g :     sqrt((t+v) / (t-v)) ;
h : log(sqrt((t+v) / (t-v)));
[diff(f, t), diff(f, v)];
[diff(g, t), diff(g, v)];
[diff(h, t), diff(h, v)];






#####
#
# Figuras pro video sobre cabos na diagonal
# 2021dec17
#
#####

# «cabos-na-diagonal»  (to ".cabos-na-diagonal")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load(draw);
draw3d(surface_hide = true,
       enhanced3d   = true,
       colorbox     = false,
    /* terminal     = png, */
       explicit(20*exp(-x^2-y^2)-10,x,-3,3,y,-3,3));

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
gnuplot ~/LATEX/2021-2-C3-diag-nums.gnuplot

# (find-LATEXfile "2021-2-C3-diag-nums.gnuplot" "eepitch-shell")




#####
#
# variables
# 2021dec18
#
#####

# «variables»  (to ".variables")
# (find-maximanode "")
# (find-maximanode "Functions and Variables for Command Line" "Function: kill")
# (find-maximagitgrep "grep --color=auto -niH --null -e kill src/*.lisp")
# (find-maximagitfile "src/db.lisp" "(defun kill ")

<edrx> hi! how can I undefine a function?
<edrx> if I do "diff(f(x), x)" without defining f maxima treats f
       as an abstract function... how do I revert f to that state
       after doing "f(x) := sin(x)"?
<merryprog> edrx you can doo kill(f);

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
diff(f(x), x);
f(x) := sin(x);
diff(f(x), x);
kill(f);
diff(f(x), x);




#####
#
# rubi
# 2021dec19
#
#####

# «rubi»  (to ".rubi")
# https://mail.google.com/mail/u/0/#inbox/FMfcgzGllVpgMbpPSmZbSswQRVLRCVbf
# https://rulebasedintegration.org/
# https://rulebasedintegration.org/testProblems.html
# https://rulebasedintegration.org/TestFiles/MaximaSyntaxFiles/
# https://rulebasedintegration.org/TestFiles/MaximaSyntaxFiles/MaximaSyntaxTestFiles.zip




#####
#
# display2d
# 2022apr26
#
#####

# «display2d»  (to ".display2d")
# (find-maximaindex-links "display2d")
# (find-maximaindex "display2d" :RET)
# (find-maximanode "display2d")
# (find-maximanode "grind")
# (find-maximanode "ldisp")
# (find-maximanode "with_default_2d_display")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
x/(x^2+1);
display2d:false$
x/(x^2+1);
display2d:true$
x/(x^2+1);



#####
#
# tex
# 2022aug19
#
#####

# «tex»  (to ".tex")
# (find-maximanode "Functions and Variables for TeX Output")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
integrate (1/(1+x^3), x);
tex (%o1);
tex (integrate (sin(x), x));
tex (%o1, "foo.tex");

S : tex (x * y * z, false);
S;

tex1 (sin(x) + cos(x));

texput (me,"\\mu_e");
tex (me);

texput (lcm, "\\mathrm{lcm}");
tex (lcm (a, b));

texfoo (e) := block ([a, b], [a, b] : args (e),
   concat("\\left[\\stackrel{",tex1(b),"}{",tex1(a),"}\\right]"))$
texput (foo, texfoo);
tex (foo (2^x, %pi));

prefix ("grad");
texput ("grad", " \\nabla ", prefix);
tex (grad f);

infix ("~");
texput ("~", " \\times ", infix);
tex (a ~ b);

postfix ("##");
texput ("##", "!!", postfix);
tex (x ##);

nary ("@@");
texput ("@@", " \\circ ", nary);
tex (a @@ b @@ c @@ d);

nofix ("foo");
texput ("foo", "\\mathsc{foo}", nofix);
tex (foo);

matchfix ("<<", ">>");
texput ("<<", [" \\langle ", " \\rangle "], matchfix);
tex (<<a>>);
tex (<<a, b>>);
texput ("<<", [" \\langle ", " \\rangle ", " \\, | \\,"], matchfix);
tex (<<a>>);
tex (<<a, b>>);




#####
#
# Something like texput, but for display2d?
# 2022aug23
#
#####

# «texput-Eq5»     (to ".texput-Eq5")
# «display2d-Eq5»  (to ".display2d-Eq5")
# (find-maximamsg "37697583 202208 24" "Edrx: Something like texput, but for display2d?")
# (find-maximamsg "37698054 202208 24" "LButler: define_alt_display")
# (find-maximamsg "37697660 202208 24" "GKönigsmann: lmxchar")
# (find-maximamsg "37698492 202208 25" "LButler: Apologies, before %i5 you need to also enter")
# (find-maximamsg "37698576 202208 25" "RFateman: dim-$matrix")
# (find-maximanode "Functions and Variables for TeX Output")
# (find-maximanode "texput")
# (find-maximanode "lmxchar")
# (find-maximanode "rmxchar")

Hi list,

I am trying to learn how to define new operators that have "nice"
representations in LaTeX and in display2d. Here is the example on
which I am working. I want

  Eq5(aa, bb, cc, dd, ee)

to be displayed as:

  aa = bb
     = cc
     = dd
     = ee

To configure its LaTeX output I simply adapted the example in the
section about "texput" here,

  (info "(maxima)Functions and Variables for TeX Output")

and I wrote this:

  texEq5(ex) :=
    block([a,b,c,d,e], [a,b,c,d,e] : args (ex),
      concat("\\begin{array}{rcl}",
             tex1(a), "&=&", tex1(b), "\\\\",
                      "&=&", tex1(c), "\\\\",
                      "&=&", tex1(d), "\\\\",
                      "&=&", tex1(e), "\\\\",
             "\\end{array}"));
  texput(Eq5, texEq5);
  tex(Eq5(aa, bb, cc, dd, ee));

Here's the output of the last line above, indented by hand:

  $$\begin{array}{rcl}
      {\it aa} &=& {\it bb} \\
               &=& {\it cc} \\
               &=& {\it dd} \\
               &=& {\it ee} \\
    \end{array}
  $$

This was easy to do, and works great. But I couldn't find much
documentation on how to configure how display2d displays "Eq5"
objects. I was only able to write this prototype for the first step:

  MatrixEq5(ex) :=
    block([a,b,c,d,e], [a,b,c,d,e] : args (ex),
      matrix([a,"=",b],["","=",c],["","=",d],["","=",e]))$

If I run this

  MatrixEq5(Eq5(aa, bb, cc, dd, ee));

the output is:

      [ aa  =  bb ]
      [           ]
      [     =  cc ]
      [           ]
      [     =  dd ]
      [           ]
      [     =  ee ]

So, questions:

  1) How can I get rid of the outer "[]"s?
  2) How can I get rid of the blank lines?
  3) How can I make Eq5 objects be displayed with MatrixEq5?
  4) Where can I find docs and examples about this?

Thanks in advance! =)
  Eduardo Ochs
  http://angg.twu.net/eev-maxima.html



#####
#
# Notes on alt-display (from Leo Butler's answer to my question about Eq5)
# 2022aug27
#
#####

# «alt-display»  (to ".alt-display")
# (find-maximamsg "37698054 202208 24" "LButler: define_alt_display")
# (find-maximamsg "37698492 202208 25" "LButler: Apologies, before %i5 you need to also enter")
# (find-maximanode "Introduction to alt-display")
# (find-maximanode "Introduction to alt-display" "<*alt-display1d*>")
# (find-maximagitfile "share/contrib/alt-display/")
# (find-maximagitfile "share/contrib/alt-display/alt-display.lisp")
# (find-maximagitfile "share/contrib/alt-display/alt-display.mac")
# (find-maximagitfile "share/contrib/alt-display/tex-display.lisp")
# (find-maximagitgrep "grep --color=auto -nRH --null -e twod_display *")
# (find-maximanode "printf")
# (find-maximanode "displa")
# (find-maximanode "get")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load("alt-display.mac")$
define_alt_display(ochs_display(form),
   block([alt_display1d : false,
          alt_display2d : false,
          x : second(form),
          p],
     if mapatom(x) then displa(form) else
       if (p : get(op(x), display2d_printer)) # false then p(form) else
         twod_display(form)))$
set_alt_display(2, ochs_display);
put(Eq5, printEq5, display2d_printer)$
printEq5(x) := block([a : args(second(x))],
  printf(true, "BANG!~%~a ~{= ~a ~}~%!GNAB", first(a), rest(a)))$
display2d : true$
Eq5(aa,bb);
Eq5(aa,bb,cc,dd,ee);
1/2+x;




#####
#
# imaxima
# 2021dec22
#
#####

# «imaxima»  (to ".imaxima")
# (find-angg ".emacs" "imaxima")
# (find-maximagitsh "find * | sort | grep -i imaxima")
# (find-node "(imaxima)Top")
# (find-node "(imaxima)Top" "Manual installation")
# (find-maximagitfile "interfaces/emacs/imaxima/")
# (find-maximagitfile "interfaces/emacs/imaxima/README")
# (find-maximagitfile "interfaces/emacs/imaxima/" "imaxima.el")
# (find-maximagitfile "interfaces/emacs/imaxima/" "imaxima.lisp")
# (find-maximagitfile "interfaces/emacs/imaxima/imaxima.el")
# (find-maximaelfile "" "imaxima.el")
# (find-efunction 'imaxima-latex)

(defun find-imaximaprocess (&rest rest)
  (require 'imaxima)
  (imaxima)
  (find-ebuffer
   (if imaxima-use-maxima-mode-flag
       "*maxima*"
     "*imaxima*")))

(defun eepitch-imaxima () (interactive)
  (eepitch '(find-imaximaprocess)))

(defun ee-imaxima-latex-middle-part ()
  (interactive)
  (while (not (eobp))
    (let* ((region-start (copy-marker (point)))
	   (region-end (copy-marker (next-single-property-change (point) 'display nil (point-max))))
	   (text-prop (get-text-property region-start 'display))
	   (latex-prop (get-text-property region-start 'latex)))
      (if latex-prop
	  (progn
	    (delete-region region-start region-end)
	    (goto-char region-start)
	    (insert (concat latex-prop "\n\n")))
	(progn
	  (goto-char region-start)
	  (insert "\n\\begin{verbatim}\n")
	  (goto-char region-end)
	  (insert "\n\\end{verbatim}\n\n"))))))

* (eepitch-imaxima)
* (eepitch-kill)
* (eepitch-imaxima)
1+2;


# (find-fline "~/bigsrc/maxima/interfaces/emacs/imaxima/")

(add-to-list 'load-path "~/bigsrc/maxima/interfaces/emacs/imaxima/")
(require 'imaxima)

# (find-sh "locate imaxima")





#####
#
# emaxima
# 2021dec21
#
#####

# «emaxima»  (to ".emaxima")
# (find-angg "LUA/emaxima.lua")
# (find-maximagitsh "find * | sort | grep -i emaxima")
# (find-maximagitfile "doc/emaxima/")
# (find-maximagitfile "interfaces/emacs/emaxima/")
# (find-maximagitgrep "grep --color=auto -nH --null -e session interfaces/emacs/emaxima/*")
# (find-fline "~/bigsrc/maxima/doc/emaxima/")

# (find-sh "locate emaxima")
# (find-fline "/usr/share/emacs/site-lisp/maxima/")
# (find-sitelispfile "")
# (find-sitelispgrep "grep --color=auto -nH --null -e session maxima/*")


 (eepitch-shell)
 (eepitch-kill)
 (eepitch-shell)
# (find-fline "/tmp/emaxima/")
rm -Rv /tmp/emaxima/
mkdir  /tmp/emaxima/
cd     /tmp/emaxima/
cp -v ~/bigsrc/maxima/doc/emaxima/EMaximaIntro.tex .
cp -v ~/bigsrc/maxima/interfaces/emacs/emaxima/emaxima.sty .
# cp -iv ~/bigsrc/maxima/interfaces/emacs/emaxima/emaxima.sty ~/LATEX/
pdflatex EMaximaIntro.tex
pdflatex EMaximaIntro.tex
pdflatex EMaximaIntro.tex

# Comment out:
# (find-fline "~/LATEX/emaxima.sty" "\\usepackage{pdfcolmk}")

# (code-pdf-page "emaximaintro" "/tmp/emaxima/EMaximaIntro.pdf")
# (code-pdf-text "emaximaintro" "/tmp/emaxima/EMaximaIntro.pdf")
# (find-emaximaintropage)
# (find-emaximaintrotext)
# (find-emaximaintropage 3 "\\usepackage{emaxima}")
# (find-emaximaintrotext 3 "\\usepackage{emaxima}")
# (find-emaximaintropage 10 "\\begin{maximasession}")
# (find-emaximaintrotext 10 "\\begin{maximasession}")

# (find-epackage-links 'maxima "maxima" t)
# (find-epackage       'maxima)
# (code-c-d "maxima" "~/.emacs.d/elpa/maxima-20210526.1525/")
# (find-maximafile "")
# (find-maximagrep "grep --color=auto -nH --null -e maximasession *")



#####
#
# emaxima-conv
# 2021dec28
#
#####

# «emaxima-conv»  (to ".emaxima-conv")
# (find-angg ".emacs" "emaxima-conv")






#####
#
# My question on how to write a "savemaximasession"
# 2021dec21
#
#####

# «savemaximasession-0»  (to ".savemaximasession-0")
# Subj: Saving a \begin{maximasession} ... \end{maximasession} block
# (find-maximamsg "37405293 202112 22" "Edrx: saving a \\begin{maximasession}...")
# (find-maximamsg "37405573 202112 22" "LButler: another low-level way")

People,

what are your favourite ways to convert a part of a log of a Maxima
session to LaTeX? Let me explain what I did and what I need...

I am on Debian and besides having Maxima installed from the Debian
packages I also have a clone of the git repository of Maxima in the
directory ~/bigsrc/maxima/. I was able to compile EMaximaIntro.tex
with:

  rm -Rv /tmp/emaxima/
  mkdir  /tmp/emaxima/
  cd     /tmp/emaxima/
  cp -v ~/bigsrc/maxima/doc/emaxima/EMaximaIntro.tex .
  cp -v ~/bigsrc/maxima/interfaces/emacs/emaxima/emaxima.sty .
  pdflatex EMaximaIntro.tex
  pdflatex EMaximaIntro.tex

I followed the instructions in the pages 3 and 10 of EMaximaIntro.pdf
and created a .tex file whose important parts were:

  \usepackage{emaxima}
  ...
  \begin{maximasession}
  diff(sin(x),x);
  integrate(cos(x),x);
  \maximaoutput*
  \i5. diff(sin(x),x); \\
  \o5. \cos x \\
  \i6. integrate(cos(x),x); \\
  \o6. \sin x \\
  \end{maximasession}

When I LaTeXed it I got exactly the kind of output that I was looking
for.

My question is: how do I generate a maximasession block like the one
above from inside a Maxima session? Can you recommend me a low-level
way to do that? I normally run Maxima inside Emacs using the low-level
way to send lines to its REPL described here -

  http://angg.twu.net/LATEX/2021emacsconf.pdf  <- slides
  http://angg.twu.net/emacsconf2021.html

I do have Fermin MF's maxima.el installed,

  https://gitlab.com/sasanidas/maxima
  https://emacsconf.org/2020/talks/33/

but I don't understand it well yet, and when I tried to integrate it
with my way of doing things I stumbled on some quirks of its function
`maxima-string'... I tried to ask Fermin for help but he was too busy,
so I thought that it was better to wait until 1) he was in holidays,
2) I had done more of my homework... anyway, I _think_ that I can
handle answers like "use Fermin's functions maxima-foo and maxima-bar"
- and answers that yield a command like

  savemaximasession(42, 99, "/tmp/foo");

that I can run in a Maxima REPL to save the cells 42 to 99 to /tmp/foo
as a maximasession block would be ideal...

  Thanks in advance!!!
    Eduardo Ochs
    http://angg.twu.net/#eev
    http://angg.twu.net/math-b.html



#####
#
# savemaximasession-1
# 2021dec22
#
#####

# «savemaximasession-1»  (to ".savemaximasession-1")

Thanks!!!

A question on your first solution... I am using this to make sure
that an imaxima process is running and to switch to its buffer:

  (defun find-imaximaprocess (&rest rest)
    (require 'imaxima)
    (imaxima)
    (find-ebuffer            ;; this is similar to switch-to-buffer
     (if imaxima-use-maxima-mode-flag
         "*maxima*"
       "*imaxima*")))

I took the

  (if imaxima-use-maxima-mode-flag "*maxima*" "*imaxima*")

from the (cl-defun imaxima () ...). Is there a better way to find
the name of the imaxima buffer?

Btw, eev now supports imaxima (yay!), but it may be better to
rewrite the code above a bit... here are some details, for the
sake of completeness:

  http://angg.twu.net/eev-intros/find-eepitch-intro.html#2.3
  (find-eepitch-intro "2.3. `eepitch'")

About your second solution: it was exactly what I needed! I was
able to convert its output by hand to the format that emaxima.sty
expects in just a minute. =) =) =)

  Cheers,
    Eduardo Ochs
    http://angg.twu.net/#eev


* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load("emaxima.lisp");
load("/usr/share/emacs/site-lisp/maxima/emaxima.lisp");
display2d:'emaxima;
integrate(x^2,x);
diff(sin(x),x);
diff(cos(x),x);

# (find-maximanode "Functions and Variables for TeX Output")




#####
#
# latex-output
# 2022jul04
#
#####

# «latex-output»  (to ".latex-output")
# (find-maximanode "tex")
# (find-maximanode "texput")
# (find-maximanode "texput" "texput (\"grad\", \" \\\\nabla \", prefix);")
# (find-LATEXgrep "grep --color=auto -nH --null -e emaxima *.tex")
# (find-LATEXgrep "grep --color=auto -nH --null display2d:.emaxima *.tex")
# (find-LATEXgrep "grep --color=auto -nH --null -e eepitch-maxima *.tex")
# (find-efunction 'emaxima-block)





#####
#
# init-file
# 2021dec24
#
#####

# «init-file»  (to ".init-file")
# (find-maximagitgrep "grep --color=auto -nRH --null -e maxima-init *")
# (find-maximanode "Introduction for Runtime Environment")
# (find-maximanode "Introduction for Runtime Environment" "maxima-init.mac")
# (find-maximanode "Functions and Variables for Runtime Environment" "maxima_userdir")
# (find-man "1 maxima")
# (find-man "1 maxima" "MAXIMA_USERDIR")
# (find-man "1 maxima" "maximarc")
# (find-man "1 maxima" "maxima-init.lisp")
# (find-fline "~/.maxima/")
# (find-fline "~/.maxima/maxima-init.lisp")





#####
#
# to_lisp
# 2021dec24
#
#####

# «to_lisp»  (to ".to_lisp")
# (to "part-and-inpart")
# (find-maximanode "Lisp and Maxima")
# (find-maximanode "Lisp and Maxima" "to_lisp")
# (find-maximanode "Lisp and Maxima" "mfuncall")
# (find-maximanode "Lisp and Maxima" "`#$<expr>$'")
# (find-maximanode "Function")
# (find-maximanode "Macros" "`splice (<x>)'")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load(draw);
to_lisp();
  (+ 1 2)
  #$draw3d$
  (to-maxima)
:lisp #$[x, y, z]$
:lisp (displa '((MLIST SIMP) $X $Y $Z))
:lisp (msetq $foo #$[x, y]$)
foo: [x, y];
foo(x,y) := x*y;
foo;
:lisp #$foo$
:lisp (mfuncall '$foo 'a 'b)
:lisp (number-sequence 0 7)

# (find-node "(sbcl)Top")
# (find-node "(ansicl)Top")
# (find-node "(ansicl)Backquote")
# (find-es "lisp" "dpans2texi")
# (find-elnode "Building Lists" "Function: number-sequence")




#####
#
# defmfun
# 2022aug01
#
#####

# «defmfun»  (to ".defmfun")
# https://jtra.cz/stuff/lisp/sclr/concatenate.html

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
to_lisp();
  (defmfun $foo (str) (concatenate 'string "::" str))
  (to-maxima)
**
foo("bar");








#####
#
# load-path
# 2021dec24
#
#####

# «load-path»  (to ".load-path")
# (find-maximagitgrep "grep --color=auto -nRH --null -e directories *")
# (find-maximanode "Functions and Variables for File Input and Output" "Option variable: file_search_maxima")
# (hyperspec-lookup-reader-macro "#P")
# http://www.lispworks.com/documentation/HyperSpec/Body/02_dhn.htm

<edrx> anyone knows how do I do something equivalent to
       (add-to-list 'load-path
       "/usr/share/emacs/site-lisp/maxima/") in Common Lisp (SBCL)?
<pjb> (push #P"/usr/share/emacs/site-lisp/maxima/"
      asdf:*central-registry*)
<pjb> or (push #P"/usr/share/emacs/site-lisp/maxima/"
      quicklisp-client:*local-project-directories*)





#####
#
# 2021-2-C3-diag-nums
# 2021dec22
#
#####

# «2021-2-C3-diag-nums»  (to ".2021-2-C3-diag-nums")
# «eev-demo»  (to ".eev-demo")
# (c3m212dnp 5 "exercicio-2-maxima")
# (c3m212dna   "exercicio-2-maxima")
# (find-maximanode "plot2d")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
max(2, 4);
min(2, 4);
q(t)   := max(0, t-2);
r(t)   := min(q(t), 2);
S(x,y) := max(r(x), r(y));
plot2d (r(t), [t, 0, 6]);
plot3d (S(x,y), [x, 0, 6], [y, 0, 6]);




#####
#
# online-manual
# 2021dec22
#
#####

# «online-manual»  (to ".online-manual")
# (find-es "texinfo" "makeinfo-html")
# (find-node "(maxima)Introduction to Polynomials")
# https://maxima.sourceforge.io/docs/manual/maxima_75.html
# (find-maximagitfile "doc/info/")



#####
#
# lambda
# 2022may07
#
#####

# «lambda»       (to ".lambda")
# «quote-quote»  (to ".quote-quote")
# (find-maximaindex-links "' '' buildq lambda")
# (find-maximaindex "lambda" :RET)
# (find-maximaindex "lambda" :RET "quote-quote")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
y : x^2;
f : lambda([x], y);
f : lambda([x], ''y);
f(10);
y : x^3;
f(10);
f : lambda([x], ''y);
f(10);



#####
#
# linearize
# 2022may08
#
#####

# «linearize»  (to ".linearize")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
y    : x^(1/2);
f    : lambda([x], ''y);
x0   : 4;
y0   : f(x0);
y_x  : diff(y, x);
ff   : lambda([x], ''y_x);
Dx   : x - x0;
L    : lambda([x], ''(f(x0) + ff(x0) * Dx));
fL   : lambda([x], [f(x), ev(L(x),numer)]);
fL(4);
fL(4.02);
fL(3.95);
** (find-es "maxima" "draw")
draw(gr2d(explicit(f(x),  x,0,6),
          color="red",
          explicit(L(x),  x,0,6)
          )
    );




#####
#
# depends
# 2021dec28
#
#####

# «depends»  (to ".depends")
# (find-maximabookpage (+ 1 50) "depends")
# (find-maximaindex-links "depends")
# (find-node "(maxima)Functions and Variables for Differentiation" "Function: depends")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
? depends

depends ([f, g], x);
depends ([r, s], [u, v, w]);
depends (u, t);
dependencies;
diff (r.s, u);
diff (r.s, t);
remove (r, dependency);
diff (r.s, t);




#####
#
# depends-quadratic
# 2022jan12
#
#####

# «depends-quadratic»  (to ".depends-quadratic")
# (c3m212qp 3 "equacao-da-superficie")
# (c3m212qa   "equacao-da-superficie")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
z : a + b*Dx + c*Dy + d*Dx^2 + e*Dx*Dy + f*Dy^2;
zz : psubst ([Dx=x1-x0, Dy=y1-y0], z);
zz : psubst ([x0=4, y0=3], zz);





#####
#
# The text of my e-mail to the mailing list about dependent variables
# 2022jan11
#
#####

# «depends-email»  (to ".depends-email")
# (find-maximamsg "37415334 202201 11" "Edrx: f:x^2 versus g(x):=x^2")
# (find-maximamsg "37415338 202201 11" "DBillinghurst")
# (find-maximamsg "37415350 202201 11" "Edrx: ta-da")
# (find-maximamsg "37415545 202201 11" "Stavros")
# (find-maximamsg "37415708 202201 11" "RFateman")
# Subj: "f:x^2" versus "g(x):=x^2", and a question on dependent variables
# (to "2-lisp")

Hi list,

I am trying - first - to understand the difference between these ways
of defining functions,

  f    :   x^2;
  g(x) :=  x^3;
  h(x) ::= x^4;

both from a user's points of view and from a common lisper's point of
view, and - second - I'm looking for some references on how people
decided to implement things in this way... let me explain.

First: what are your favorite ways to show how the innards of Maxima
see the "f", the "g(x)", and the "h(x)" above? I executed this,

  f    :   x^2;
  g(x) :=  x^3;
  h(x) ::= x^4;
  f;
  g;
  g(x);
  g(y);
  dispfun(g);
  dispfun(h);

  :lisp #$[f]$
  :lisp #$[F]$
  :lisp #$[g]$
  :lisp #$[g(x)]$
  :lisp         #$[g(y+z)]$
  :lisp (displa #$[g(y+z)]$)
  :lisp         '((MLIST SIMP) ((MEXPT SIMP) ((MPLUS SIMP) $Y $Z) 3))
  :lisp (displa '((MLIST SIMP) ((MEXPT SIMP) ((MPLUS SIMP) $Y $Z) 3)))

  :lisp                $functions
  :lisp           (cdr $functions)
  :lisp (dispfun1 (cdr $functions) t nil)
  :lisp                $macros
  :lisp           (cdr $macros)
  :lisp (dispfun1 (cdr $macros) t nil)

I haven't progressed much beyond this point yet... for example, I
still don't know where f is stored, and I am trying to understand the
"(defmspec $dispfun ...)" and the "(defun dispfun1 ...)" in
src/mlisp.lisp, but my attempts to run parts of their code in "(let
(...) ...)" inside the Lisp REPL, i.e., inside a "to_lisp();" /
"(to-maxima)" block in the Maxima REPL, are not working - and I don't
even know why first line below works but the second one doesn't:

  dispfun(g);
  :lisp #$[dispfun(g)]#

So I'm a beginner asking questions that may look too advanced...
sorry! By the way, my favorite style for explaining these inner
details _in Emacs Lisp_ is with tutorials like this one,

  http://angg.twu.net/eev-intros/find-elisp-intro.html#6

in which I expect people to execute lots of sexps in different orders,
and understand their results.



Now the second question. This one is more open-ended, and any pointer
to references and/or to keywords to search for are more than welcome.

I teach Calculus 2 and 3 in a small university in Brazil - or, more
precisely, in a small countryside campus that is part of a big
university whose main campus is 300 Km away - and I started an
experiment a few semesters ago. Instead of teaching the students only
the modern notational conventions, in which in

  g(x) := x^3;

the name "x" is always totally irrelevant and can be replaced by any
other name, I am trying to teach them both the "old" convention and
the "new" one, and I trying to show how to translate between the two,
even though I don't know all the rules of the translation...

The "old" convention can be seen for example here,

  Silvanus P. Thompson - "Calculus Made Easy" (1914) - p.14:
  https://www.gutenberg.org/files/33283/33283-pdf.pdf#page=25

and the "new" convention is the one that says that variables and
functions must have different names, all arguments should be explicit,
there is no such thing as a "dependent variable", and so on.

I call the "old" convention "physicists' notation" and the "new" one
the "mathematicians' notation", always between quotes, and I always
explain to the students that my attempts to formalize the translation
are totally improvised, and that I've asked my friends who work in
EDPs or in Mathematical Physics where I can find formalizations of the
translation and they simply don't know...

So: Maxima has some support for dependent variables - see "? depends"
- and I _guess_ that as Maxima is quite old some of its old papers may
contain discussions on how people were trying to implement both the
"mathematicians' notation" and the "physicists' notation" on Computer
Algebra Systems, and how they reached the implementation that Maxima
still uses today... I took a look here,

  http://ftp.math.utah.edu/pub/tex/bib/macsyma.html

but that list is huge, it has very few links to online versions, and
most of them are broken, and none of the titles mention dependent
variables explicitly...

  Thanks in advance!!!
    Eduardo Ochs
    http://angg.twu.net/eev-maxima.html


P.S.: for the sake of completeness, my material on the "physicists'
notation" is here -
http://angg.twu.net/LATEX/2021-2-C3-notacao-de-fisicos.pdf - but it is
messy and in Portuguese...




#####
#
# Code for my e-mail on depend variables
# 2022jan10
#
#####

# «depends-email-code»  (to ".depends-email-code")
# (find-maximagitgrep "grep --color=auto -niRH --null -e biblio *")
# (find-maximagitgrep "grep --color=auto -niRH --null -e bibarchive *")
# (find-maximagitfile "")
# (find-maximanode "Functions and Variables for Expressions")
# (find-maximanode "Nouns and Verbs")
# (find-maximanode "Lisp and Maxima")
# (find-maximanode "Functions and Variables for Command Line" "System variable: infolists")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
f    :   x^2;
g(x) :=  x^3;
h(x) ::= x^4;
f;
g;
g(x);
g(y);
dispfun(g);
dispfun(h);
**
:lisp #$[f]$
:lisp #$[F]$
:lisp #$[g]$
:lisp #$[g(x)]$
:lisp         #$[g(y+z)]$
:lisp (displa #$[g(y+z)]$)
:lisp         '((MLIST SIMP) ((MEXPT SIMP) ((MPLUS SIMP) $Y $Z) 3))
:lisp (displa '((MLIST SIMP) ((MEXPT SIMP) ((MPLUS SIMP) $Y $Z) 3)))
**
                      functions;
:lisp                $functions
:lisp           (cdr $functions)
:lisp (dispfun1 (cdr $functions) t nil)
                      macros;
:lisp                $macros
:lisp           (cdr $macros)
:lisp (dispfun1 (cdr $macros) t nil)
**
** The ":lisp" below yields an error:
**
dispfun(g);
:lisp #$[dispfun(g)]#
**
values;
labels;


# Based on a suggestion by David Billinghurst:

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
display2d:false$
f : x^2$
g(x) := x^3$
h(x) ::= x^4$
values;
functions;
macros;
fundef(g);
fundef(h);
**
infolists;




#####
#
# depends-email-lambda
# 2022jan11
#
#####

# «depends-email-lambda»  (to ".depends-email-lambda")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
x       : 3;
y       : 4;
f       :  x^2+y^2;
f1(x)   := x^2+y^2;
f1(z);
  y : 0;
  f1(z);
  y : 4;
  f;
f2(x,y) := x^2+y^2;
f2(w,z);
f3      : lambda([x], x^2+y^2);
f3(z);
f(q)    := q+f;
f(z);
** /*  yes Maxima is like a "2-lisp".  A name can be used for a function and a value */
:lisp $f
:lisp (symbol-plist '$f)

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
f :  x^2;
f(x) := x^3;
g : lambda([x], x^4);

g    : lambda([x], x^2+y^2);
:lisp $f
:lisp (symbol-plist '$f)




#####
#
# quote
# 2022jan12
#
#####

# «quote»  (to ".quote")
# (find-maximanode "Functions and Variables for Command Line" "quote-quote")
# (find-maximanode "Functions and Variables for Evaluation" "Operator: '")
# (find-maximanode "Functions and Variables for Evaluation" "Operator: '")
# (find-maximanode "Functions and Variables for Evaluation" "Operator: ''")
# (find-maximanode "Functions and Variables for Evaluation" "does not prevent simplification")
# (find-maximanode "Functions and Variables for Evaluation")
# (find-maximanode "Functions and Variables for Help" "'describe' quotes its argument")
# (find-maximanode "Functions and Variables for Simplification" "Option variable: simp")
# (find-maximanode "Introduction to Simplification")
# (find-maximanode "Lisp and Maxima" "`#$<expr>$'")
# https://people.eecs.berkeley.edu/~fateman/papers/intro5.txt

# (code-c-d "fatemanp" "$S/https/people.eecs.berkeley.edu/~fateman/papers/")
# (find-fatemanpfile "")
# (find-fatemanpfile "intro5.txt")
# (find-fatemanpfile "intro5.txt" "MACSYMA Syntax and Internal Representation")


* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
a;
?a;
"a";
`a;
:lisp #$x+y$
:lisp #$x-y$

diff(f(x), x);
diff(f(g(x)), x);



#####
#
# input-string-parser-output
# 2022jan13
#
#####

# «input-string-parser-output»  (to ".input-string-parser-output")
# (code-c-d "fatemanp" "$S/https/people.eecs.berkeley.edu/~fateman/papers/")
# (find-fatemanpfile "intro5.txt" "Input String" "Parser Output")
# (find-maximagitfile "src/nparse.lisp")
# (find-maximagitgrep "grep --color=auto -nH --null -e defun src/nparse.lisp")
# (find-maximagitgrep "grep --color=auto -niH --null -e reader src/*.lisp")
#
# Thread: A question about parsing: ":lisp #$expr$" is not low-level enough
# (find-maximamsg "37416623 202201 13" "Edrx: :lisp #$expr$ is not low-level enough")
# (find-maximamsg "37416631 202201 13" "RDodier")
# (find-maximamsg "37416632 202201 13" "RFateman")
# (find-maximamsg "37416641 202201 13" "Edrx")
# (find-maximamsg "37416792 202201 13" "MTalon")
# (find-maximamsg "37416824 202201 13" "Stavros")
# (find-maximamsg "37417262 202201 14" "Edrx")
# (find-maximamsg "37417447 202201 14" "Stavros")
# (find-maximamsg "37417646 202201 14" "RFateman")
# (find-maximamsg "37417663 202201 14" "BWillis")
# (find-maximamsg "37417692 202201 14" "PKlosowski")
# (find-maximamsg "37417720 202201 15" "RFateman")
# (find-maximamsg "37418008 202201 15" "RToy")
# (find-maximamsg "37418382 202201 16" "JVillate")
# (find-maximamsg "37419130 202201 17" "Edrx")
# (find-maximamsg "37419177 202201 17" "RFateman")


Hi Richard and Stavros,

I made some progress on the questions that I asked here,

  https://sourceforge.net/p/maxima/mailman/message/37415334/
  https://sourceforge.net/p/maxima/mailman/message/37415708/

but I need to ask more questions, and I felt that it was better to
create a new thread.

I am reading about expressions, simplification, evaluation, and the
internal representation mainly in these places:

  (info "(maxima)Expressions")
  (info "(maxima)Evaluation")
  (info "(maxima)Simplification")
  (info "(maxima)Lisp and Maxima")
  https://people.eecs.berkeley.edu/~fateman/papers/intro5.txt

The first two sentences of

  (info "(maxima)Introduction to Simplification")

are:

  Maxima performs a cycle of actions in response to each new
  user-typed command. This consists of four steps: reading or
  "parsing" the input, evaluation, simplification and output.

I am still in a stage in which the rules for evaluation and
simplification feel overwhelming, so I'm trying to understand parsing,
evaluation, simplification, and output separately...

The second part of

  https://people.eecs.berkeley.edu/~fateman/papers/intro5.txt

has a table with "Input String"s in the left column and "Parser
Output"s in the right column. The most obvious - and naïve - way to
transform that table into a series of executable examples/tests is to
wrap each "Input String" in a ":lisp #$___$"; I found that if I run a
"simp:false;" before the tests then all these tests yield essentially
the same results as in the paper (obs: I had to fix some typos - or
scanos - in the .txt... Richard, do you want a list of the
typos/scanos?):

  simp:false;
  :lisp #$a$
  :lisp #$?a$
  :lisp #$"a"$
  :lisp #$x+y$
  :lisp #$x-y$
  :lisp #$x*y$
  :lisp #$a(x)$
  :lisp #$a[1,2]$
  :lisp #$a[1,2](x)$
  :lisp #$sin(x)$
  :lisp #$x/y$
  :lisp #$x.y$
  :lisp #$x^2$
  :lisp #$x^^2$
  :lisp #$[a,b,c]$
  :lisp #$if a then b$
  :lisp #$if a then b else c$
  :lisp #$'diff(y,x)$
  :lisp #$'integrate(a,b,c,d)$
  :lisp #$not a$
  :lisp #$a or b$
  :lisp #$a and b$
  :lisp #$a=b$
  :lisp #$a>b$
  :lisp #$a>=b$
  :lisp #$a<b$
  :lisp #$a<=b$
  :lisp #$a#b$

but these entries give outputs that are very wrong:

  :lisp #$'a$
  :lisp #$(a,b,c)$
  :lisp #$for i:a thru b step c unless q do f(i)$
  :lisp #$for i:a next n unless q do f(i)$
  :lisp #$for i in L do f(i)$
  :lisp #$diff(y,x)$
  :lisp #$diff(y,x,2,z,1)$
  :lisp #$integrate(a,b,c,d)$
  :lisp #$block([l1,l2], s1,s2)$
  :lisp #$block(s1,s2)$
  :lisp #$a:b$
  :lisp #$a::b$
  :lisp #$a(x):f$

it seems that there is some kind of evaluation that is still going on.
How can I run just the parser? I guess that it would be something like
this,

  to_lisp();
    (mread-raw "a<b")

but using another function, as mread-raw expects a stream...

  Thanks in advance =),
    Eduardo Ochs
    http://angg.twu.net/eev-maxima.html
    http://angg.twu.net/e/maxima.e.html#input-string-parser-output





#####
#
# parse-string - Robert Dodier's answer to the question above
# 2022jan13
#
#####

# «parse-string»  (to ".parse-string")
# (find-maximanode "stringproc-pkg")
# (find-maximanode "String Processing" "Function: parse_string")
# (find-maximagitsh "find * | grep stringproc")
# (find-maximagitfile "share/stringproc/")
# (find-maximagitfile "share/stringproc/eval_string.lisp" "(defun $parse_string ")
# (find-maximagitfile "share/stringproc/eval_string.lisp" "(defun parse-string ")
# (find-maximagitfile "")
# (find-maximamsg "37416631 202201 13" "RDodier")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load(stringproc);
:lisp ($parse_string "'a")
:lisp ($parse_string "(a,b,c)")
:lisp ($parse_string "for i:a thru b step c unless q do f(i)")
:lisp ($parse_string "for i:a next n unless q do f(i)")
:lisp ($parse_string "for i in L do f(i)")
:lisp ($parse_string "diff(y,x)")
:lisp ($parse_string "diff(y,x,2,z,1)")
:lisp ($parse_string "integrate(a,b,c,d)")
:lisp ($parse_string "block([l1,l2], s1,s2)")
:lisp ($parse_string "block(s1,s2)")
:lisp ($parse_string "a:b")
:lisp ($parse_string "a::b")
:lisp ($parse_string "a(x):f")




#####
#
# displr-email
# 2022jan14
#
#####

# «displr-email»  (to ".displr-email")
# (find-maximamsg "37417262 202201 14" "Edrx: My use case is very atypical")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
simp:false;
q: lambda([foo], x+x);
q2: subst ([x=a+b], q);
to_lisp();
  $q
  (caddr $q)
  (displa (caddr $q))
  (defun $displrl (lambdaexpr) (displa (caddr lambdaexpr)))
  ($displrl $q)
  (to-maxima)
q2;
displrl(q2)$
q3: lambda([foo], integrate(a,b,c,d));
q3: lambda([foo], integrate(a,b));
displrl(q3)$
? integrate
integrate(a,b,c,d);
'integrate(a,b,c,d);
q3: lambda([foo], 'integrate(a,b,c,d));
q3: subst([a=x+y], q3);
displrl(q3)$


doeval(q2);

q: lambda([foo], ('integrate(f(x), x, a, b) = F(b) - F(a)));
  displr(q)$
  displr(subst([a=42, b=99], q))$
  displr(subst([a=42, b=99, f(x)=3*x^2, F(x)=x^3], q))$
  displr(subst([a=42, b=99, f(x)=3*x^2, F=lambda([x],x^3)], q))$



* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
simp:false;
q: lambda([foo], 'integrate (x+x, x, a, b));
to_lisp();
  $q
  (caddr $q)
  (displa (caddr $q))
  (defun $displrl (lambdaexpr) (displa (caddr lambdaexpr)))
  ($displrl $q)
  (to-maxima)
displrl(q)$
displrl(subst([x=y+y], q))$



Nifty!!!!!!! =) =) =)

My use case is very atypical. In my classes I have many students who
have very little practice with using variables - really! It's sad &
scary - and when these students have to take a formula and perform a
substitution on it to obtain a particular case they usually make a big
mess... for example, they often substitute only certain occurrences of
the variables, and leave the other ones unsubsituted. And when they
have to perform substitutions on theorems, propositions, or proofs the
mess is even bigger...

So: I'm trying to teach them that substitution and simplification _can
be treated_ as separate operations, and when we keep them as separate
steps our calculations become much easier to debug... We're doing that
on paper, and I told them that I believe that all decent programs for
Computer Algebra should be able to perform substitution in a purely
syntactical way, without simplification, _if we call the right
low-level functions in them_. With your trick I'm almost there... try
this:

  simp:false;
  to_lisp();
    (defun $displr (lambdaexpr) (displa (caddr lambdaexpr)))
    (to-maxima)
  q: lambda([foo], ('integrate(f(x), x, a, b) = F(b) - F(a)));
  displr(q)$
  displr(subst([a=42, b=99], q))$
  displr(subst([a=42, b=99, f(x)=3*x^2, F(x)=x^3], q))$
  displr(subst([a=42, b=99, f(x)=3*x^2, F=lambda([x],x^3)], q))$

In the last two lines I'm trying to replace all occurrences of F(expr)
by expr^3, but I haven't found the right trick yet...

  Cheers and probably thanks in advance =),

  Eduardo Ochs
    http://angg.twu.net/eev-maxima.html











#####
#
# dosimp-and-doeval
# 2022jan14
#
#####

# «dosimp-and-doeval»  (to ".dosimp-and-doeval")
# (to "simp")
# (find-maximamsg "37417447 202201 14" "Stavros: dosimp and doeval")
# (find-maximanode "simp")
# (find-maximanode "block")
# (find-maximanode "expand")
# (find-maximanode "?")

** dosimp(ex)        - simplifies ex without evaluating it
** doeval(ex)        - evaluates ex without simplifying it
** fullyeval(ex)     - evaluates and simplifies
** parse_string(str) - converts "x+x" to x+x
** tolispstr(ex)     - converts x+x to "((MPLUS) $X $X)"
** fromlispstr(ex)   - "((MPLUS) $X $X)" to x+x

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
simp:false$
dosimp(ex)   := block([simp:true],  expand(ex,0,0))$
doeval(ex)   := block([simp:false], ?meval(ex))$
fulleval(ex) := block([simp:true],  ?meval(ex))$
load(stringproc)$
to_lisp();
  (defun $tolispstr   ($ex)  (format nil "~s" $ex))
  (defun $fromlispstr ($str) (read-from-string $str))
  (to-maxima)
**
q: parse_string("x+x");
dosimp(q);
doeval(q);
tolispstr(parse_string("x+x"));
tolispstr(x + x);
fromlispstr(tolispstr(x + 2));
**
q:  '('integrate(f(x), x, a, b) = F(b) - F(a));
       subst([a=42, b=99, f(x)=3*x^2, F=lambda([x],x^3)], q)$
doeval(subst([a=42, b=99, f(x)=3*x^2, F=lambda([x],x^3)], q));
**
simp:true;
ex1 : 'integrate(exp(2*x), x);
ex2 :  integrate(exp(2*x), x);



#####
#
# trace-parser
# 2022jan13
#
#####

# «trace-parser»  (to ".trace-parser")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
:lisp (trace parser)
(a,b,c);




#####
#
# reader
# 2022jan13
#
#####

# «reader»  (to ".reader")
# (find-maximagitgrep "grep --color=auto -niH --null -e reader src/*.lisp")
# (find-maximagitgrep "grep --color=auto -niH --null -e '#\\$' src/*.lisp")
# (find-maximagitgrep "grep --color=auto -niH --null -e set-dispatch-macro-character src/*.lisp")
# (find-maximagitfile "src/commac.lisp" "(defvar *sharp-read-buffer*")
# (find-maximagitfile "src/intl.lisp")
# (find-maximanode "")

Fantastic! Thanks!!! =)

By the way, where is the code that tells the Lisp reader how to handle
expressions starting with "#$"? This page

  (info "(maxima)Lisp and Maxima")

mentions "The '#$' Lisp macro" but it doesn't give a function name or
the name of a Lisp file, and I grepped a bit and couldn't find it...

  Cheers =),
    E.



# From Michel Talon, 2022jan13:
# (find-maximamsg "37416792 202201 13" "MTalon")

Such stuff from the lisp side is treated by  set-dispatch-macro-character.

For this specific case i think this is the code in commac.lisp starting with

defvar *sharp-read-buffer*  and ending with
(set-dispatch-macro-character #\# #\$ #'x$-cl-macro-read)

Note that  other parsing functions for maxima are rather in intl.lisp.




#####
#
# lambda-simp
# 2022jan13
#
#####

# «lambda-simp»  (to ".lambda-simp")
# (find-maximamsg "37416824 202201 13" "Stavros: to prevent evaluation")

Simplification does not happen as a separate step after evaluation of
the whole expression. Every subexpression that is evaluated is
immediately simplified. Maxima couldn't possibly work otherwise.

Obviously we need to be review our documentation more carefully to
keep such howlers out!

Using :lisp #$ ... $ seems pretty roundabout. To turn off
simplification, set simp:false. To prevent evaluation, use '( ... ).
To show the internal form of something, use ?print(...).

Here's a neat trick: within lambda expressions (as well as named
function definitions), neither simplification nor evaluation is
performed, so q: lambda([simp], ?print(2+2)) might help you see how
things work; look at q, and call q(false) and q(true) .


* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
simp:false;
q: lambda([simp], ?print(2+2));
q;
q(false)$
q(true)$
q: lambda([simp], ?print(x+x));
q: lambda([simp], ?print(x/x));
q2: subst ([x=a/b], q);
q2: subst ([x=a+b], q);
print(q)$
print(q2)$
q2(true);
q2(false);
print(q);
to_lisp();
  $q
  (cdr $q)
  (cddr $q)
  (displa (cddr $q))
  `(a b ,(+ 1 2))
  (to-maxima)
:lisp #$[x, y, z]$
:lisp (displa '((MLIST SIMP) $X $Y $Z))





#####
#
# symbol-plist
# 2022jan11
#
#####

# «symbol-plist»  (to ".symbol-plist")
# (find-maximagitfile "src/mlisp.lisp" "(defmspec $dispfun ")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
to_lisp();
  (describe '$dispfun)
  (describe 'dispfun1)
  (symbol-plist '$dispfun)
  (describe 'getf)
  (describe 'get)
  (get '$dispfun 'mfexpr*)

<Catie> GETF would be like (getf (symbol-plist '$dispfun)
        '$mfexpr).  GETF is for plists, GET is for symbols


  (getf '$dispfun 'mfexpr*)
  (getf 'mfexpr* '$dispfun)
(describe 'getf)



#####
#
# demos
# 2022jan01
#
#####

# «demos»  (to ".demos")
# (find-maximagitsh "find * -type f | sort")
# (find-maximagitsh "find * -type f | sort | grep 'dem$'")
# (find-maximagitfile "share/calculus/fourie.dem")



#####
#
# fourier
# 2022jan01
#
#####

# «fourier»  (to ".fourier")
# (find-maximaindex-links "absint fourexpand fourint foursimp foursin funp remfun")
# (find-maximagitfile "share/calculus/fourie.dem")
# (find-maximagitfile "")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load('fourie)$
funp(sin,sin(a)*cos(x)+sin(b));
funp(sin,sin(a)*cos(x)+sin(b),x);
remfun(abs,abs(a)+sin(abs(b)+c)*abs(d)/e);
remfun(abs,abs(a*abs(x)+abs(b))+abs(c)+abs(x*abs(d)),x);
f(f(f(a)+b)*c)*f(d)^f(e);
remfun(f,''%);
absint(abs(a)*abs(x),x,both);
absint(abs(cos(x)),x);
** absint(abs(a)*exp(-abs(b)*abs(x)),x,minf,inf);
absint(sin(x),x,-%pi,%pi);
absint(abs(sin(x)),x,-%pi,%pi);
fourier(abs(x),x,1);
foursimp(%);
fourexpand(%,x,1,inf);
fourexpand(%th(2),x,1,5);
totalfourier(x,x,%pi);
foursin(1,x,%pi);
foursimp(%);
fourint(exp(-abs(x)),x);



#####
#
# taylor
# 2022jan01
#
#####

# «taylor»  (to ".taylor")
# (find-maximanode "taylor")
# (find-maximanode "trunc")
# (find-maximagitgrep "grep --color=auto -nRH --null -e 'truncated Taylor or Laurent' *")
# (find-maximagitgrep "grep --color=auto -niRH --null -e taylor *")
# (find-maximagitgrep "grep --color=auto -niRH --null -e taylor bin/src/*")
# (find-maximagitgrep "grep --color=auto -niRH --null -e taylor demo*")
# (find-maximagitgrep "grep --color=auto -niRH --null -e taylor share/calc*")
# (find-maximagitgrep "grep --color=auto -niRH --null -e taylor share/builtins-list.txt")
# (find-maximagitgrep "grep --color=auto -niRH --null -e taylor src/*")
# (find-maximagitgrep "grep --color=auto -niRH --null -e taylor tests/*")
# (find-maximagitfile "doc/info/Series.texi" "truncated Taylor or Laurent series")
# (find-maximagitfile "archive/info/maxima.fns" "\\entry {\\code {TAYLOR}}{184}")
# (find-maximagitfile "doc/share/brchre.txt" "has an excellent Taylor series")
# (find-maximagitfile "doc/share/brchre.txt" "A truncated series")
# (find-maximagitfile "om" "processing (SUBC $TAYLOR ...)")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
? taylor

taylor (sqrt (sin(x) + a*x + 1), x, 0, 3);
%^2;
taylor (sqrt (x + 1), x, 0, 5);
%^2;
product ((1 + x^i)^2.5, i, 1, inf)/(1 + x^2);
ev (taylor(%, x,  0, 3), keepfloat);
taylor (1/log (x + 1), x, 0, 3);
taylor (cos(x) - sec(x), x, 0, 5);
taylor ((cos(x) - sec(x))^3, x, 0, 5);
taylor (1/(cos(x) - sec(x))^3, x, 0, 5);
taylor (sqrt (1 - k^2*sin(x)^2), x, 0, 6);
taylor ((x + 1)^n, x, 0, 4);
taylor (sin (y + x), x, 0, 3, y, 0, 3);
taylor (sin (y + x), [x, y], 0, 3);
taylor (1/sin (y + x), x, 0, 3, y, 0, 3);
taylor (1/sin (y + x), [x, y], 0, 3);

taylor (exp(2*x), x, 0, 3);
taylor (exp(2*x), x, 0, 4);
taylor (exp(2*x), x, 0, 5);
ta : taylor (exp(2*x), x, 0, 3);
ta;
:lisp #$ta$
coeff(ta, x, 3);
sta : subst(x=1/2, ta);
ev(sta, NUMER);
ev(sta, FLOAT);



ta : taylor (exp(2*x), x, 0, 3);
:lisp #$ta$

((MRAT SIMP
       (((MEXPT) $%E $X) $X)
       (%e^x491 X492)
       (($X ((3 . 1)) 0 NIL X492 . 2))
       TRUNC)
 PS
 (X492 . 2)
 ((3 . 1))
 ((0 . 1) 1 . 1)
 ((1 . 1) 2 . 1)
 ((2 . 1) 2 . 1)
 ((3 . 1) 4 . 3))




#####
#
# More notes on Taylor series
# 2022apr26
#
#####

# «taylor-2»  (to ".taylor-2")
# (find-maximaindex-links "coeff lambda makelist subst sum taylor trunc")
# (find-maximaindex-links "coeff")
# (find-maximanode "Functions and Variables for Numbers" " map ")
# (find-maximaindex "coeff")
# (find-maximaindex "coeff" :RET)
# (find-maximanode "coeff")
# (find-maximanode "lambda")
# (find-maximanode "makelist")
# (find-maximanode "subst")
# (find-maximanode "sum")
# (find-maximanode "taylor")
# (find-maximanode "trunc")


* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
maxk         : 5;
ta_series    : taylor(exp(10*x), x, 0, 4);
ta_series    : taylor(exp(10*x), x, 0, maxk);
ta_poly      : subst(x=x, ta_series);
ta_coeff     : lambda([k], coeff(ta_series, x, k));
ta_coeff     : lambda([k], coeff(ta_poly,   x, k));
ta_coeff(2);
ta_coeff(3);
ta_coeffs    : makelist(ta_coeff(k), k, 0, maxk);
ta_coeffs    : [1, 10, 50, 300/3, 1250/3, 2500/3];
ta_coeffs    : makelist(ta_coeff(k), k, 0, maxk);
ta_monomial  : lambda([k], ta_coeffs[k+1] * x^k);
ta_monomials : makelist(ta_monomial(k), k, 0, maxk);

ta_at        : lambda([x0], subst(x=x0, ta_poly));
ta_at        : lambda([x0], subst(x=x0, ta_series));
ta_at(0.01);
exp(10*0.01);

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
f   : exp(x);
f   : log(x+1);
fn  : lambda([maxk],            taylor(f, x, 0, maxk) );
fn  : lambda([maxk], subst(x=x, taylor(f, x, 0, maxk)));
display2d : false;
f0  : fn(0);
f1  : fn(1);
f2  : fn(2);
f3  : fn(3);
f4  : fn(4);
minx : -3;
maxx :  1;
draw(gr2d(grid=[2,2],
          color="black",   explicit(f,  x,minx, maxx),
          color="red",     explicit(f0, x,minx, maxx),
          color="orange",  explicit(f1, x,minx, maxx),
          color="green",   explicit(f2, x,minx, maxx),
          color="blue",    explicit(f3, x,minx, maxx),
          color="violet",  explicit(f4, x,minx, maxx)
          )
    );




#####
#
# gradef
# 2022jan15
#
#####

# «gradef»  (to ".gradef")
# (find-maximanode "derivabbrev")
# (find-maximanode "express")
# (find-maximanode "gradef")
# (find-maximanode "gradefs")
# (find-maximanode "Functions and Variables for Differentiation" "Option variable: derivabbrev")
# (find-maximanode "Functions and Variables for Differentiation" "Function: express")
# (find-maximanode "Functions and Variables for Differentiation" "Function: gradef")
# (find-maximanode "Functions and Variables for Differentiation" "System variable: gradefs")
# (find-maximagitgrep "grep --color=auto -niRH --null -e gradef *")
# (find-maximagitgrep "grep --color=auto -niRH --null -e gradef src/*.lisp")
# (find-maximagitgrep "grep --color=auto -niRH --null -e gradef share/*")
# (find-maximagitgrep "grep --color=auto -niRH --null -e gradef tests/*")
# (find-maximabookpage (+ 1 91) "gradef")
# (find-maximabooktext (+ 1 91) "gradef")
# (find-maximagitgrep "grep --color=auto -niRH --null -e pdiff *")
# (find-maximagitgrep "grep --color=auto -niRH --null -e pdiff share/*")
# (find-maximagitfile "share/pdiff/")
# (find-maximagitfile "share/pdiff/" "pdiff-doc")
# (code-pdf-page "pdiff" "~/bigsrc/maxima/share/pdiff/pdiff-doc.pdf")
# (code-pdf-text "pdiff" "~/bigsrc/maxima/share/pdiff/pdiff-doc.pdf")
# (find-pdiffpage)
# (find-pdifftext)
# (find-ssr-links     "gradefjan19" "2022jan19-gradef")
# (code-eevvideo      "gradefjan19" "2022jan19-gradef")
# (code-eevlinksvideo "gradefjan19" "2022jan19-gradef")
# (find-gradefjan19video "0:00")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
? gradef
? gradefs
a_x : 22;
**
taylor(f(x + x^2), x, 1, 1);
gradef(f(x),   f_x(x))$
gradef(f_x(x), f_xx(x))$
taylor(f(x + x^2), x, 1, 2);
? taylor

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
gradef(z  (x,y), z_x (x,y), z_y (x,y));
gradef(z_x(x,y), z_xx(x,y), z_xy(x,y));
gradef(z_y(x,y), z_xy(x,y), z_yy(x,y));
gradef(y(x),     y_x (x));
gradef(y_x(x),   y_xx(x));
z     : z(x, y(x));
z__x  : diff(z,    x);
z__xx : diff(z__x, x);
gradefs;
ex : z__x;
ex : subst([y   (x)=y],      ex);
ex : subst([y_x (x)=y_x],    ex);
ex : subst([y_xx(x)=y_xx],   ex);
ex : subst([z_x (x,y)=z_x],  ex);
ex : subst([z_y (x,y)=z_y],  ex);
ex : subst([z_xx(x,y)=z_xx], ex);
ex : subst([z_xy(x,y)=z_xy], ex);
ex : subst([z_yy(x,y)=z_yy], ex);
ex : expand(ex);

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
gradef(x  (t),   x_t (t));
gradef(x_t(t),   x_tt(t));
gradef(y  (t),   y_t (t));
gradef(y_t(t),   y_tt(t));
gradef(z  (x,y), z_x (x,y), z_y (x,y));
gradef(z_x(x,y), z_xx(x,y), z_xy(x,y));
gradef(z_y(x,y), z_xy(x,y), z_yy(x,y));
z     : z(x(t), y(t));
z__t  : diff(z,    t);
z__tt : diff(z__t, t);
ex : z__t;
ex : z__tt;
ex : subst([x   (t)=x],      ex);
ex : subst([x_t (t)=x_t],    ex);
ex : subst([x_tt(t)=x_tt],   ex);
ex : subst([y   (t)=y],      ex);
ex : subst([y_t (t)=y_t],    ex);
ex : subst([y_tt(t)=y_tt],   ex);
ex : subst([z_x (x,y)=z_x],  ex);
ex : subst([z_y (x,y)=z_y],  ex);
ex : subst([z_xx(x,y)=z_xx], ex);
ex : subst([z_xy(x,y)=z_xy], ex);
ex : subst([z_yy(x,y)=z_yy], ex);
ex : expand(ex);




#####
#
# email-subst-2022jan17
# 2022jan17
#
#####

# «email-subst-2022jan17»  (to ".email-subst-2022jan17")
# (find-maximamsg "37419130 202201 17" "Edrx: Part 1: the groups")
# (find-maximamsg "37417646 202201 14" "RFateman: We see proposed usages")

Hi all,

ok, let me try to explain how and why I am using Maxima in my
classes... I'll have to start with a lot of context, as I'll have to
talk about several different groups of people...


Part 1: the groups that I interact with
=======================================

One of the biggest federal universities in the state of Rio de Janeiro
is called (the) UFF. The main campus of the UFF is in a (big) city
called Niterói, that is very close to Rio de Janeiro (the city - even
bigger than Niterói). The UFF has several campi in other cities, and I
work in a small campi in a (small) city called Rio das Ostras.

Bolsonaro has cut the funding for education at all levels as much as
he could, including the funding for the top universities and for the
top research institutes, that were treated as sacred in the other
governments. On top of that the pandemic came. Several universities,
including UFF, were already having to negotiate a lot every month to
get money to pay basic things like electricity and water, and the
cleaning and the security staff, and when the quarantine started the
message that we received was more or less this: "we know that most of
you have never learned how to so online teaching, so now we will give
you four months to prepare - try to do some courses, and do your best.
This is an emergency, we know that everybody will have to improvise a
lot, etc, etc."

I knew that teaching by Zoom wouldn't work for me because in my
courses I always interact a lot with the students _via writing_ - when
they have doubts I prefer to see how they are trying to write and draw
their ideas rather than to hear them - so I invented a way to teach my
courses in which most of the interaction would be by Telegram, with
people exchanging photos of what they were doing... I would often
LaTeX my ideas and answers instead of writing them by hand on paper,
but that's because I've been using LaTeX for ages and I'm quite fast
with it.

This "teaching by Telegram" thing worked very well. I also used
prerecorded videos, slides in PDF, and a few bits of material by other
people, but I'll refer to that as "teaching by Telegram".

In the middle of 2020 I discovered that a group of about 30 people
from several universities in Brazil were going to meet by Zoom once
every two weeks to discuss mainly a) how do teach online, and b) how
to adapt the contents of some courses to a context in which the
students can use computers to plot graphs and to do some calculations.
Let me call this group the "inter-university group", or the "IUG".

Actually I "discovered" the IUG because one of the organizers was a
friend of mine, and he invited me to participate. At one point I
offered to present how I was "teaching by Telegram", and in one of the
meetings I gave a talk about that, and I showed that all my material
was online - including all the parts in which I presented things in
ways that didn't work, or in which I gave exercises that I had to
change completely later. My presentation was very well-received, and I
found some people there who were also trying to make all their
material available in public places.

So we have three groups:

  UFF - big campus in a big city
  Rio das Ostras - small subcampus in a small city
  Inter-university group, a.k.a. IUG

The people from my department in Rio das Ostras did try to meet by
Zoom to discuss online teaching a few times, but we were only able to
arrange these meeting at most once every semester. We are a small
department, and it seems that each person is trying something totally
different - and everyone is reporting that the students participate
very little, that in most classes by Zoom/Google Meet/whatever very
few students keep their cameras open, and that cheating is rampant
even with their all attempts to make cheating harder... for example,
some of my colleagues learned ways to give a slightly different test
to each student, and learned features of Google Classroom that makes
it auto-correct some kinds of tests, but nothing is working.

Before giving my presentation on "teaching by Telegram" at the IUG a
gave a preliminary version of it in one of these meetings of my
department - in which very few people came - and it was well-received.
Then after my presentation at the IUG I sent the link with the
recording to my dept's mailing list, and some people in my department
FREAKED OUT. They reacted very angrily - I've reread their e-mails to
the mailing lists many times after they were sent and they still don't
look very coherent to me, so I think that "freaked out" is a good
term, at least until I find something better.

So: I was hoping that the people in my department would look at my
material, find some interesting things here and there, and react by
sharing pieces of their own teaching materials and sharing ideas...
now I think that the chance of this happening is small.

A friend of mine from Rio das Ostras is temporarily working at UFF -
the big campus, with big teams teaching each of the basic courses in
Maths - and I asked if he could share with me the material that the
people there use in Calculus 1, 2, and 3. He checked with his
superiors and told me that no, there is a kind of non-disclosure
agreement.

SUMMARY OF PART 1: interacting with the colleagues in my campus is
very hard at the moment, and interacting with the people in the big
campus of UFF is very hard too. So my priority is to interact with
people from the IUG in Portuguese, and with other people from the
internets in English.


Part 2: students
================

Many of my students have very bad internet connections, and bad
computers that they share with other people - so very often they can
only use their cell phones to participate in the classes. But some
other students have, aham, "real computers" - even in this sense:
https://dilbert.com/strip/1995-06-24 - and when they see that I have a
couple of Free Software projects that I take very seriously and that I
am learning to use Maxima (<- was SymPy before, but I gave up) they
ask if I can teach or help them to use these things. My answer is -
ta-da! - yes, but not during class, so let's create another Telegram
group for that. And right now this other Telegram group is dead, the
last message in it was more than a month ago.

Here's an incomplete list of how the students see that I am using
Maxima in the classes that I am teaching. I am using Maxima for some
2D and 3D plots; I am using it to calculate the answers to certain
exercises - for example here:

  http://angg.twu.net/LATEX/2021-2-C3-notacao-de-fisicos.pdf#page=26

so if they want to check the answers that they got by hand they will
have to decypher this slightly obfuscated notation; I am using it as
one of my excuses to stress ALL THE TIME that BASIC mathematical
notation has a very rigid syntax - each one of the books that we use
has slightly different conventions, and Maxima and GeoGebra (that some
of them learned in a previous course) use other syntaxes that are
quite different - and that in my course syntax errors will not be
tolerated...

I am having to deal with several epidemics here - besided Covid,
cheating, and lack of focus, we also have an epidemy of students that
believe that an answer to a test HAS to receive full grade, or almost,
"if the idea is right". I don't know how much this last one affects
other countries - I would really like to know - and I try to deal with
this last one by having a ton of material on how to write answers
"that everyone understands"...

I don't have any idea how my colleagues in my department, or in the
big campus, deal with the epidemy of "if the idea is right that's
enough" - I don't have enough social skills to get answers from them -
so I am sort of trying to get some people from the IUG to share the
materials on that they have, both in Portuguese and in English... and
they're answering very slowly.

About the low-end students: they don't interact, they cheat on the
tests, they're hard to distinguish from the students that are just
very introverted, and _right now_ I don't have the tools to detect
when they're cheating. My resources are limited, we're in an
emergency, I'm doing my best, and this includes that I'm choosing
carefully where to I will invest my energy... and I chose to invest it
on the students who interact, and on producing written material can be
useful to me and to the other people from the IUG in this semester and
in the future...


Part 3: substitution
====================
This is mostly an answer to this message,

  https://sourceforge.net/p/maxima/mailman/message/37417646/

that Richard sent on jan. 14...

Every semester I change my approach to substitution a bit. In this
semester I defined an operation "[:=]" that does substituition
"syntactically" and "naively". The "syntactically" means that the "="
after a substituition is special - it means "the result of this
substitution, WITHOUT ANY SIMPLIFICATIONS, is the expressions at the
right of the equals sign"; so these two lines are right,

  (2 = 3 + a * 4) [a:=5]   = (2 = 3 +  5    * 4)
  (2 = 3 + a * 4) [a:=5+6] = (2 = 3 + (5+6) * 4)

but this one is wrong, because in it the 10*4 was simplified to 40:

  (2 = 3 + a * 4) [a:=10]  = (2 = 3 + 40)

The explanation that I showed to the students is this one - that only
exists in Portuguese at the moment...

  http://angg.twu.net/LATEX/2021-2-C2-intro.pdf#page=8

I also stressed to the students that my "naive substitution", that was
"defined" by text and examples instead of rigorously, and that doesn't
distinguish between free and bound variables, will be enough for our
purposes - and that to understand the "better" substitution operations
they will have to understand free and bound variables well, and free
and bound variables will make much more sense at the end of the couse,
after they were forced to work a lot with sums, integrals,
quantifiers, and set comprehensions.

The first time that I got feedback from an "adult" on this naive
syntactical substituion was just a few weeks ago, from a colleague
that is a logician and who works in a university in the Northeast of
Brazil. He liked it very much as a pedagogical tool, and he also told
me that he's having more or less the same difficulties to deal with
his colleagues as me. Anyway, now I finally have good excuses to write
about that in English - but it's a low-priority task. =/

  Cheers,
    Eduardo Ochs
    http://angg.twu.net/#eev
    http://angg.twu.net/eev-maxima.html
    http://angg.twu.net/math-b.html




#####
#
# plot: examples from the Workbook
# 2022oct09
#
#####

# «plot-wb»  (to ".plot-wb")
# (find-books "__comp/__comp.el" "maxima-workbook")
# (find-books "__comp/__comp.el" "maxima-workbook" "5.2 Plot")
# (find-maximawbpage (+ 20 32) "5.2     Plot")
# (find-maximawbtext (+ 20 32) "5.2     Plot")
# (find-maximawbpage (+ 19 38) "5.2.2.1.3   Discrete plot")
# (find-maximawbtext (+ 19 38) "5.2.2.1.3   Discrete plot")
# (find-maximanode "Functions and Variables for Plotting" "discrete")
# (find-maximawbpage (+ 19 45) "5.3     Draw")
# (find-maximawbtext (+ 19 45) "5.3     Draw")




#####
#
# plot2d-parametric
# 2022feb19
#
#####

# «plot2d-parametric»  (to ".plot2d-parametric")
# (find-maximanode "Functions and Variables for Plotting" "3. Parametric functions")
# (find-maximanode "Functions and Variables for Plotting" "Function: plot3d")
# (find-maximanode "Function and Variable Index" "plot2d")
# (find-maximanode "Function and Variable Index" "plot3d")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
x : cos(t)+t;
y : sin(t);
x : cos(t)+cos(4*t)/2;
y : sin(t)+sin(4*t)/2;
x : cos(t)+cos(3*t)/2;
y : sin(t)+sin(3*t)/2;
plot2d([parametric, x, y, [t, 0, 2*%pi]]);
x : cos(t);
y : sin(2*t);
plot2d([parametric, x, y, [t, 0, 2*%pi]]);
x : cos(2*t);
y : sin(3*t);
plot2d([parametric, x, y, [t, 0, 2*%pi]]);
x : sin(2*t);
y : cos(3*t);
plot2d([parametric, x, y, [t, 0, 2*%pi]]);
x : sin(2*t);
y : sin(3*t);
plot2d([parametric, x, y, [t, 0, 2*%pi]]);
x : cos(2*t);
y : cos(3*t);
plot2d([parametric, x, y, [t, 0, 2*%pi]]);



#####
#
# plot3d-parametric
# 2022feb19
#
#####

# «plot3d-parametric»  (to ".plot3d-parametric")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
plot3d (u^2 - v^2, [u, -2, 2], [v, -3, 3], [grid, 100, 100],
  nomesh_lines)$
plot3d ( log ( x^2*y^2 ), [x, -2, 2], [y, -2, 2], [z, -8, 4],
  nopalette, [color, magenta])$
plot3d (log (x^2*y^2), [x, -2, 2], [y, -2, 2],[grid, 29, 29],
  [palette, [gradient, red, orange, yellow, green]],
  color_bar, [xtics, 1], [ytics, 1], [ztics, 4],
  [color_bar_tics, 4])$

** Two surfaces in the same plot.  Ranges specific to one of the
     surfaces can be given by placing each expression and its ranges in
     a separate list; global ranges for the complete plot are also given
     after the function definitions.

plot3d ([[-3*x - y,                        [x, -2, 2], [y, -2, 2]],
         4*sin(3*(x^2 + y^2))/(x^2 + y^2), [x, -3, 3], [y, -3, 3]],
      [x, -4, 4], [y, -4, 4])$

expr_1: 5*cos(x)*(cos(x/2)*cos(y)+sin(x/2)*sin(2*y)+3)-10$
expr_2: -5*sin(x)*(cos(x/2)*cos(y)+sin(x/2)*sin(2*y)+3)$
expr_3: 5*(-sin(x/2)*cos(y)+cos(x/2)*sin(2*y))$
plot3d ([expr_1, expr_2, expr_3], [x, -%pi, %pi],
  [y, -%pi, %pi], [grid, 50, 50])$

     Plot of a "spherical harmonic" function, using the predefined
     transformation, 'spherical_to_xyz' to transform from spherical
     coordinates to rectangular coordinates.  See the documentation for
     'spherical_to_xyz'.

          (%i1) plot3d (sin(2*theta)*cos(phi), [theta,0,%pi], [phi,0,2*%pi],
                [transform_xy, spherical_to_xyz], [grid, 30, 60], nolegend)$

     Use of the pre-defined function 'polar_to_xy' to transform from
     cylindrical to rectangular coordinates.  See the documentation for
     'polar_to_xy'.

          (%i1) plot3d (r^.33*cos(th/3), [r,0,1], [th,0,6*%pi], nobox,
              nolegend, [grid, 12, 80], [transform_xy, polar_to_xy])$

     Plot of a sphere using the transformation from spherical to
     rectangular coordinates.  Option 'same_xyz' is used to get the
     three axes scaled in the same proportion.  When transformations are
     used, it is not convenient to eliminate the mesh lines, because
     Gnuplot will not show the surface correctly.

          (%i1) plot3d ( 5, [theta,0,%pi], [phi,0,2*%pi], same_xyz, nolegend,
            [transform_xy, spherical_to_xyz], [mesh_lines_color,blue],
            [palette,[gradient,"#1b1b4e", "#8c8cf8"]])$



#####
#
# plot2d-xmaxima
# 2022mar06
#
#####

# «plot2d-xmaxima»  (to ".plot2d-xmaxima")
# For example a plot using Xmaxima as interface:
# https://maxima.sourceforge.io/docs/manual/maxima_singlepage.html#Plotting-Formats

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
plot2d (sin(x), [x, -%pi, %pi], [plot_format, xmaxima]);




#####
#
# partial-fractions
# 2022feb22
#
#####

# «partial-fractions»  (to ".partial-fractions")
# (find-maximanode "Functions and Variables for Number Theory" "Function: partfrac")
# (find-maximanode "partfrac")
# (find-maximanode "denom")
# (find-maximanode "solve")
# (find-maximanode "rat")
# (find-maximanode "ratsimp")
# (c2m212fpp 5 "exercicio-3")
# (c2m212fpa   "exercicio-3")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
f1 : A/(x-a) + B/(x-b);
f2 : ratsimp(f1);
(f1 = f2);
f3 : (c*x+d) / (x^2+e*x+f); 
f4 : subst([e=-a-b, f=a*b, c=A+B, d=-A*b-a*B], f3);
f2 - f4;
**
g1 : (2*x + 3) / (x^2 - 7*x + 10)$
g2 : partfrac(g1, x)$
(g1 = g2);

d2 : denom(f2);
d3 : denom(f3);
d2 - d3;
solve(d2 - d3, [e, f]);
rat(d2 - d3, x);
ratsimp(f2 - f3);
denom(f2)-denom(f3);
d : denom(f2)-denom(f3);
rat(d, x);
solve(denom(f2)-denom(f3), [a, b, e]);

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
** Formula and particular case:
f1 : A/(x-a) + B/(x-b);
f2 : ratsimp(f1);
eq1 : f1=f2;
eq2 : subst([a=3, b=5], eq1);
f3  : subst([a=3, b=5], f1);
rhs(eq2);
den1 : denom(rhs(eq2));
f4 : (3*x+4) / den1;
f5 : partfrac(f4, x);
eq3 : f3 = f5;
eq3 : f3 - f5;
ratsimp(eq3);
f6 : num(ratsimp(eq3));
c1 : coeff(f6, x, 1);
c0 : coeff(f6, x, 0);
[c1, c0];
solve([c1, c0], A);
solve([c1, c0], [A, B]);



#####
#
# Intersection of two conics
# 2022mar25
#
#####

# «two-conics»  (to ".two-conics")
# https://sourceforge.net/p/maxima/code/ci/master/tree/share/contrib/conics_04.mac
# (find-maximamsg "37630334 202203 25" "BWillis: intersection of 2 circles")



#####
#
# float-and-numer
# 2022apr25
#
#####

# «float-and-numer»  (to ".float-and-numer")
# (find-maximabookpage (+ 1 34) "Numerical Output - FLOAT and NUMER")
# (find-maximabooktext (+ 1 34) "Numerical Output - FLOAT and NUMER")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
a:9/4;
exp(a);
ev(exp(a),FLOAT);
ev(exp(a*x),FLOAT);
numerval(b, 25);
a*b;
ev(a*b,FLOAT);
ev(a*b,NUMER);
float(a);
float(b);
float(a*b);




#####
#
# mnewton
# 2022jul04
#
#####

# «mnewton»  (to ".mnewton")
# (find-maximanode "mnewton")
# (find-maximanode "find_root")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load("mnewton")$
mnewton([2*a^a-5],[a],[1]);
f : 1/x;
mnewton([f-4],[x],[1]);

f : 1/x;
f-4;
find_root (f-4, x, 0.01, 2);
find_root (sin(x) - x/2, x, 0.1, %pi);

load(draw);
f : 1/x;
ymax :  4;
ymin : -4;
plot2d(f, [x, -4, 4]);
find_root(f-ymax, x, 0.01, 2);
find_root(f-ymin, x, -2, -0.01);

f : 1/x;
mnewton(f-4,[x],[1]);
mnewton([''f-4],[x],[1]);



#####
#
# Um caso em que o TFC2 falha
# 2022jul04
#
#####

# «TFC2-fails»  (to ".TFC2-fails")
# (c2m212intsp 5 "x^-2")
# (c2m212intsa   "x^-2")
# (find-maximanode "explicit")
# (find-maximanode "yrange")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
f : x^-2;
    integrate(f, x, -1, 1);
F : integrate(f, x);
subst(x=-1, F);
subst(x=1, F);
subst(x=1, F) - subst(x=-1, F);
solve(f-4, x);
solve(F-4, x);
draw2d(yrange=[-4,4],
       explicit(f,x,-4,4),
       explicit(F,x,-4,4),
       xrange=[-4,4]);




#####
#
# numerozinhos
# 2022jun29
#
#####

# «numerozinhos»  (to ".numerozinhos")
# (find-maximanode "Matrices")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
x/(x^2+1);
display2d:false$


* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
Path.prependtopath "~/LUA/?.lua"  -- (find-angg "LUA/Path.lua")
require "ZHA1"                    -- (find-angg "LUA/ZHA1.lua" "AsciiPicture-tests")
= Path.from "path"
ap = AsciiPicture.new("    ")
x0,y0,x1,y1 = -2,-3,4,5
f = function (x,y) return 2*x + 3*y end
for y=y1,y0,-1 do ap:put(x0-1,y, format("%2d:", y)) end
for x=x0,x1    do ap:put(x,y0-1, format("%2d^", x)) end
for   y=y1,y0,-1 do
  for x=x0,x1    do
    ap:put(x, y, format("%3d", f(x,y)))
  end
end


= ap


= format("%04d", 22)
= format("%-4d", 22)
= format("%2d:", 22)

ap:put(0, 0, "foo")




#####
#
# dmiranda
# 2022jul15
#
#####

# «dmiranda»  (to ".dmiranda")
# https://danielmiranda.prof.ufabc.edu.br/maxima/index.html
# http://hostel.ufabc.edu.br/~daniel.miranda/maxima/01introducao.zip
# http://hostel.ufabc.edu.br/~daniel.miranda/maxima/02equacoeseinequacoes.zip
# http://hostel.ufabc.edu.br/~daniel.miranda/maxima/03graficos.zip
# http://hostel.ufabc.edu.br/~daniel.miranda/maxima/maxcalc.pdf




#####
#
# 2022-1-C2-P2
# 2022jul19
#
#####

# «2022-1-C2-P2»  (to ".2022-1-C2-P2")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
f : exp(-2*x) * cos(100*x);
plot2d (f, [x, 0, 2]);
demoivre(f);
exponentialize(f);

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
cd /tmp/
convert plot.png plot.pdf
# (find-pdf-page "/tmp/plot.pdf")



#####
#
# 2022-2-C3-P1
# 2022nov14
#
#####

# «2022-2-C3-P1»  (to ".2022-2-C3-P1")
# (find-LATEX "2022-2-C3-P1.tex" "questao-2-gab")

# (to "plotting-contours")
# (c3m222p1p 6 "questao-2-gab")
# (c3m222p1a   "questao-2-gab")
# (c3m222p1p 4 "questao-2")
# (c3m222p1a   "questao-2")
# (to "ev")
# (find-maximanode "define")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
** (find-angg "MAXIMA/matrixify.mac")
load       ("~/MAXIMA/matrixify.mac");
F   : 2*x^2 + -x*y - y^2;
F_x : diff(F,x);
F_y : diff(F,y);
matrixify (-2,-2, 2,2, F);
matrixify (-2,-2, 2,2, [F_x, F_y]);

define(F(x,y),   F);
define(F_x(x,y), F_x);
define(F_y(x,y), F_y);

sol1(sols)   := rhs(sols[1]);
sol2(sols)   := rhs(sols[2]);
maxsol(sols) := apply('max, map('rhs, sols));
minsol(sols) := apply('min, map('rhs, sols));

sols : solve(F(x,y)=z, x);
sol1(sols);
sol2(sols);
display2d:false$
sol1(sols);
sol2(sols);
display2d:true$

** Expensive definition:
**   zmin(y) : inf({F(x,y) | x in R});
** Cheaper equivalent definitions:
**   xmin    : solve(F_x(x,y)=0, x);
**   xmin(y) : solve(F_x(x,y)=0, x);
**   zmin(y) : F(xmin(y), y);

                     solve(F_x(x,y)=0, x);
define(xmin(y), sol1(solve(F_x(x,y)=0, x)));
define(zmin(y), F(xmin(y), y));

                  solve(zmin(y)=-1, y);
           maxsol(solve(zmin(y)=-1, y));
ylim(z) := maxsol(solve(zmin(y)= z, y));
ylim(-1);

          ylim(-1);
solve(F(x,ylim(-1))=-1, x);

ev(     ylim(-1), numer);
   yl : ylim(-1);
ev(yl,            numer);

   yl : ylim(-2);
ev(yl,            numer);

** ranges for z=-1:
**   y in [ 0.943,  2], with sol1 and sol2
**   y in [-0.943, -2], with sol1 and sol2

** ranges for z=-2:
**   y in [ 1.334,  2], with sol1 and sol2
**   y in [-1.334, -2], with sol1 and sol2

** ranges for z=5:
**   y in [-1, 2] with sol1
**   y in [1, -2] with sol2

** ranges for z=2:
**   y in [-1.64, 2] with sol1
**   y in [-2, 1.64] with sol2

solve(F(2,y)=5, y);
solve(F(2,y)=2, y);
ev(solve(F(2,y)=2, y), numer);



* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
fx1 = function (y,z) return -(math.sqrt(8*z+9*y^2)-y)/4 end
fx2 = function (y,z) return  (math.sqrt(8*z+9*y^2)+y)/4 end
mkpoints = function (fx, ys, z)
    local mkpoint = function (y) return pformat("(%s,%s)", fx(y,z), y) end
    return mapconcat(mkpoint, ys, "--")
  end
nys = 5
nys = 20
paths = {}
paths[-1] = mkpoints(fx1, seqn( 2,  0.943, nys), -1) .."--\n"..
            mkpoints(fx2, seqn( 0.943,  2, nys), -1) .."\n"..
            mkpoints(fx1, seqn(-2, -0.943, nys), -1) .."--\n"..
            mkpoints(fx2, seqn(-0.943, -2, nys), -1)

paths[-2] = mkpoints(fx1, seqn( 2,  1.334, nys), -2) .."--\n"..
            mkpoints(fx2, seqn( 1.334,  2, nys), -2) .."\n"..
            mkpoints(fx1, seqn(-2, -1.334, nys), -2) .."--\n"..
            mkpoints(fx2, seqn(-1.334, -2, nys), -2)

paths[2] = mkpoints(fx1, seqn(-1.64, 2, nys), 2) .."\n"..
           mkpoints(fx2, seqn(-2, 1.64, nys), 2)

paths[5] = mkpoints(fx1, seqn(-1, 2, nys), 5) .."\n"..
           mkpoints(fx2, seqn(-2, 1, nys), 5)

= paths[-1]
= paths[-2]
= paths[2]
= paths[5]


* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
myv : [-1,1,2];
myP : [6,5,0];
myP(t) := myP + t*myv;
myP(0);
myP(1);
makelist(myP(t), t, 0, 3);
expand(myP(6-x));
expand(myP(y-5));

** Beatriz:
makelist([x, 11-x, 12-2*x], x, 0, 10);

** Davi CR:
makelist([11+y, y, -10+2*y], y, 0, 10);

** Davi GPV:
makelist([x, -x+11, -2*x+12], x, 0, 10);

** Esthefanie:
makelist([x, -9-x, 1-x+     y], x, 0, 10);
makelist([x, -9-x, 1-x+(-9-x)], x, 0, 10);

** Fabricio:
makelist([x, 11-x,      y-x+1], x, 0, 10);
makelist([x, 11-x, (11-x)-x+1], x, 0, 10);

** Gabriel SK:
makelist([x, -x+11, -x+  y    +1], x, 0, 10);
makelist([x, -x+11, -x+(-x+11)+1], x, 0, 10);

** Gabriel MdSB:
makelist([0,11,12] + t*[1,1,-2], t, 0, 10);

** Katherine Z:
makelist([x, -x+11, -10+2*y],       x, 0, 10);
makelist([x, -x+11, -10+2*(-x+11)], x, 0, 10);

** João VdSH:
makelist([4,7,4] + t*[1,-1,-2], t, 0, 10);

** Lucas PMT:
makelist([x, 11-x, 1-x+y],      x, 0, 10);
makelist([x, 11-x, 1-x+(11-x)], x, 0, 10);

** Nicolas:
makelist([11-y, y, -10+2*y], y, 0, 10);

** Raphaela:
makelist([x, 11-x, 1-x+     y], x, 0, 10);
makelist([x, 11-x, 1-x+(11-x)], x, 0, 10);



#####
#
# numer-and-float
# 2022nov20
#
#####

# «numer-and-float»  (to ".numer-and-float")
# (to "2022-2-C3-P1")
# (find-maximamsg "37736745 202211 18" "Edrx: first half of plotting contour levels?")
# (find-maximamsg "37737021 202211 18" "Stavros: ratprint / float")
# (find-maximanode "numer")
# (find-maximanode "float")
# (find-maximanode "keepfloat")
# (find-maximanode "ratprint")
# (find-maximanode "Functions and Variables for Polynomials" "'solve' ignores 'keepfloat'")
# (find-maximanode "replaced x by y")

* Solve is designed to give exact solutions, so you will get solutions in
radicals, not floating-point numbers (even with float inputs and
*keepfloat:true*)
* You can silence the "rat replaced" messages by setting *ratprint:false*,
but those warnings are telling you that Maxima is calculating with
rationals rather than floats. e.g., *solve(x^2=.14,x) *gives the exact
solution *sqrt(7)/(5*sqrt(2)) *rather than 0.374
* At the very least, you should convert everything to numbers before any
further calculations (including *min*).
* It is almost always a bad idea to use *ev* in code. I think you can
replace *ev(...,numer)* with *float(...)*




#####
#
# How do I do just the first half of "plotting contour levels"?
# 2022nov19
#
#####

# «plotting-contours»  (to ".plotting-contours")
# (to "2022-2-C3-P1")
# (find-maximamsg "37736745 202211 18" "Edrx: first half of plotting contour levels?")
# (find-maximamsg "37736853 202211 18" "MTalon: gnuplot contours")
# (find-maximamsg "37737021 202211 18" "Stavros: ratprint / float")
# (find-maximamsg "37737109 202211 18" "RDodier: draw2d-implicit")

Hi list,

a few days ago I had to draw some level curves of

  F(x,y) := 2*x^2 - x*y - y^2;

in TikZ. I was in a hurry, so I wrote something that was an uglier
version of this,

  F(x,y)  := 2*x^2 - x*y - y^2;
  xs(y,z) := solve(F(x,y)=z, x);
  maxsol(sols) := apply('max, map('rhs, sols));
  minsol(sols) := apply('min, map('rhs, sols));
  leftx (y,z)  := minsol(xs(y,z));
  rightx(y,z)  := maxsol(xs(y,z));
  seqn(a,b,n)    := makelist(a + (b-a)*k/n, k, 0, n);
  leftxys (ys,z) := ev(makelist([leftx (y,z), y], y, ys), numer);
  rightxys(ys,z) := ev(makelist([rightx(y,z), y], y, ys), numer);
  leftxys (seqn(2, 0.943, 10), -1);
  rightxys(seqn(0.943, 2, 10), -1);

but with more calls to "leftxys" and "rightxys" at the end, and then I
converted the output to a series of "\draw" commands for TikZ using a
throway-ish Lua program.

I'm not in a hurry anymore, and now I can try to learn better ways to
find the points in level curves.

Questions: 1) I got lots of messages like this one:

  rat: replaced 0.110751 by 110751/1000000 = 0.110751

How do I silence them?

And: 2) plot2d knows how to plot "contour levels". It certainly has
separate functions for calculating the points of a level curve and for
converting those points into commands for, say, gnuplot... is it easy
to call just the function that calculates the points? How do I do
that?

  Thanks in advance!
    Eduardo Ochs
    http://angg.twu.net/eev-maxima.html




#####
#
# plotting-contours-2
# 2022nov19
#
#####

# «plotting-contours-2»  (to ".plotting-contours-2")
# (find-es "gnuplot" "tikz")
# (find-maximagitfile "share/draw/draw_gnuplot.dem")
# (find-maximagitfile "share/draw/draw_gnuplot.dem" "Implicit 2D")
# (find-maximagitfile "share/draw/draw_gnuplot.dem" "Map contours")
# (find-maximagitfile "share/draw/draw_gnuplot.dem" "= eps")
# (find-maximagitfile "share/draw/draw_gnuplot.dem" "= animated_gif")
# (find-maximamsg "37737109 202211 18" "RDodier: draw2d-implicit")
# (find-maximanode "draw2d")
# (find-maximanode "plot2d")
# (find-maximanode "gnuplot_term")
# (find-maximanode "gnuplot_out_file")
# (find-fline "~/LOGS/2022nov21.emacs" "MAXIMA> (apropos \"draw_gnuplot\")")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
F(x,y)        := 2*x^2 - x*y - y^2;

set_plot_option ([gnuplot_term,     "tikz"]);
set_plot_option ([gnuplot_out_file, "/tmp/myplot.tikz"]);
plot2d ([contour, F(x, y)], [x, -2, 2], [y, -2, 2]);

to_lisp();
  (apropos "draw_gnuplot")
  *PACKAGE*
  (to-maxima)

level(z)      := implicit(F(x,y)=z, x,-2,2, y,-2,2);
clevel(clr,z) := [color=clr, level(z)];
clevels       :  [clevel(red,   -2),
                  clevel(orange,-1),
                  clevel(green,  0),
                  clevel(blue,   2),
                  clevel(violet, 5)];
draw2d(clevels);
draw2d(file_name="/tmp/myplot", terminal=eps,  clevels);
/* ^ These two "draw2d"s work as expected */

draw2d(file_name="/tmp/myplot", terminal=tikz, clevels);
/* ^ Fails with: "draw: illegal terminal specification: tikz"
 *   Fixed! See: (find-fline "/tmp/myplot.tikz")
*/

set_plot_option ([gnuplot_term,     "tikz"]);
set_plot_option ([gnuplot_out_file, "/tmp/myplot.tikz"]);
draw2d(clevels);
/* ^ The options are ignored */

set_plot_option ([gnuplot_term,     "eps"]);
set_plot_option ([gnuplot_out_file, "/tmp/myplot2.eps"]);
draw2d(clevels);
/* ^ The options are ignored */


/* Lower-level tests: */
draw2d(level(0), level(2), level(5), level(-1), level(-2));
draw2d(level(0), level(2), color=red, level(5), level(-1), level(-2));
draw2d([color=red,    level(-2)],
       [color=orange, level(-1)],
       [color=green,  level(0)],
       [color=blue,   level(2)],
       [color=violet, level(5)]);
draw2d(clevel(red,   -2),
       clevel(orange,-1),
       clevel(green,  0),
       clevel(blue,   2),
       clevel(violet, 5));




#####
#
# "terminal=tikz" doesn't work: e-mail
# 2022nov20
#
#####

# «terminal-tikz»  (to ".terminal-tikz")
# https://mail.google.com/mail/u/0/#sent/QgrcJHrjBQxRMBcWKGMPCNwbccRSMJcMqXL
# (find-maximamsg "37737497 202211 20" "Edrx: terminal=tikz?")
# (find-maximamsg "37737637 202211 20" "RDodier: draw2d and plot2d are separate bodies")
# (find-maximamsg "37737671 202211 20" "MTalon: In grcommon.lisp add $tikz")
# (find-maximamsg "37738749 202211 23" "Edrx: $pict2e also works")
# (find-maximamsg "37738762 202211 23" "RDodier: plot2d is more lenient")
# (find-maximamsg "37738817 202211 23" "Edrx: fails with dimension too large")
# (find-maximagitfile "share/draw/grcommon.lisp")
# (find-maximagitfile "share/draw/grcommon.lisp" "update-terminal")
# (find-maximagitfile "share/draw/gnuplot.lisp")
# (find-maximagitfile "share/draw/gnuplot.lisp" "($gif (format")
# (find-maximagitfile "share/draw/gnuplot.lisp" "($pict2e")
# (find-sh "locate grcommon.lisp")
# (find-sh "locate gnuplot.lisp")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
  draw2d(file_name="/tmp/toto",terminal=tikz,explicit(cos(x),x,1,10));
                        [gr2d(explicit)]


Hi Robert and all,

I am still trying to digest all the hints in this thread...

  https://sourceforge.net/p/maxima/mailman/message/37737109/

First problem: setting the terminal to "tikz" doesn't work for me. I
am running this version of Maxima,

  Maxima branch_5_46_base_555_g6fa201ff5

that I git-pull'ed and compiled a few minutes ago, and a gnuplot from
2020...  but I followed the instructions here

  http://www.gnuplot.info/docs/latex_demo.pdf

to check if my gnuplot supports tikz, and the answer seems to be yes -
I ran "set terminal tikz" in a gnuplot REPL and got:

  gnuplot> set terminal tikz

  Terminal type is now 'tikz'
  Options are 'latex nopreamble color nostandalone nogparrows
  notikzarrows nogppoints picenvironment nooriginreset bitmap rgbimage
  noclip notightboundingbox noexternalimages '

Here's what I tried to do in Maxima (inspired by the file
share/draw/draw_gnuplot.dem):

  F(x,y)        := 2*x^2 - x*y - y^2;
  level(z)      := implicit(F(x,y)=z, x,-2,2, y,-2,2);
  clevel(clr,z) := [color=clr, level(z)];
  clevels       :  [clevel(red,   -2),
                    clevel(orange,-1),
                    clevel(green,  0),
                    clevel(blue,   2),
                    clevel(violet, 5)];
  draw2d(clevels);
  draw2d(file_name="/tmp/myplot", terminal=eps,  clevels);
  /* ^ These two "draw2d"s work as expected */
  
  draw2d(file_name="/tmp/myplot", terminal=tikz, clevels);
  /* ^ Fails with: "draw: illegal terminal specification: tikz" */
  
  set_plot_option ([gnuplot_term,     "tikz"]);
  set_plot_option ([gnuplot_out_file, "/tmp/myplot.tikz"]);
  draw2d(clevels);
  /* ^ The options are ignored */
  
  set_plot_option ([gnuplot_term,     "eps"]);
  set_plot_option ([gnuplot_out_file, "/tmp/myplot2.eps"]);
  draw2d(clevels);
  /* ^ The options are ignored */

I also tried to grep the source tree of Maxima for "tikz"
case-insensitively, and got no matches...

Thanks in advance!
  Eduardo Ochs
  http://angg.twu.net/eev-maxima.html


* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
rm -fv /tmp/my*

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
  F(x,y)        := 2*x^2 - x*y - y^2;
  level(z)      := implicit(F(x,y)=z, x,-2,2, y,-2,2);
  clevel(clr,z) := [color=clr, level(z)];
  clevels       :  [clevel(red,   -2),
                    clevel(orange,-1),
                    clevel(green,  0),
                    clevel(blue,   2),
                    clevel(violet, 5)];
  draw2d(file_name="/tmp/mydraw", terminal=tikz,   clevels);
  draw2d(file_name="/tmp/mydraw", terminal=pict2e, clevels);

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
  F(x,y) := 2*x^2 - x*y - y^2;
  set_plot_option ([gnuplot_term,     "tikz"]);
  set_plot_option ([gnuplot_out_file, "/tmp/myplot.tikz"]);
  plot2d([contour, F(x, y)], [x, -2, 2], [y, -2, 2]);
  set_plot_option ([gnuplot_term,     "pict2e"]);
  set_plot_option ([gnuplot_out_file, "/tmp/myplot.pict2e"]);
  plot2d([contour, F(x, y)], [x, -2, 2], [y, -2, 2]);

/* (find-2a '(find-fline "/tmp/mydraw.pict2e")
            '(find-fline "/tmp/myplot.pict2e"))
   (find-2a '(find-fline "/tmp/mydraw.tikz")
            '(find-fline "/tmp/myplot.tikz"))
*/

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
cd /usr/share/texmf/tex/
cp -v gnuplot-lua-tikz-common.tex /tmp/
cp -v gnuplot-lua-tikz.sty        /tmp/

cd /tmp/

cat > mydraw-tikz.tex <<'---'
  \documentclass{article}
  \usepackage{tikz}
  \usepackage{gnuplot-lua-tikz}
  \begin{document}
  \input mydraw.tikz
  \end{document}
---

cat > mydraw-pict2e.tex <<'---'
  \documentclass{article}
  \usepackage{pict2e}
  \usepackage{xcolor}
  \usepackage{graphicx}
  \begin{document}
  \input mydraw.pict2e
  \end{document}
---

cat > myplot-tikz.tex <<'---'
  \documentclass{article}
  \usepackage{tikz}
  \usepackage{gnuplot-lua-tikz}
  \begin{document}
  \input myplot.tikz
  \end{document}
---

cat > myplot-pict2e.tex <<'---'
  \documentclass{article}
  \usepackage{pict2e}
  \usepackage{xcolor}
  \usepackage{graphicx}
  \begin{document}
  \input myplot.pict2e
  \end{document}
---

# These work:
lualatex myplot-tikz.tex
lualatex myplot-pict2e.tex
xpdf myplot-tikz.pdf
xpdf myplot-pict2e.pdf

# These don't:
lualatex mydraw-tikz.tex
lualatex mydraw-pict2e.tex



  lualatex mydraw-pict2e.tex

fails with:



  lualatex mydraw-pict2e.tex

fails with:

  ! Dimension too large.
  <recently read> \unitlength 
  l.11 \begin{picture}(360000,300000)(0,0)

and

  lualatex mydraw-tikz.tex

fails with:

  ! Dimension too large.
  <recently read> \pgf@xx 
  l.4 \path (0.000,0.000) rectangle (600.000,500.000)
                                                   ;
and







#####
#
# Early references on undefined variables?
# 2022jul27
#
#####

# «early-references-on-und»  (to ".early-references-on-und")
# (find-maximamsg "37686311 202207 27" "Early references on undefined variables?")
# (find-maximamsg "37686436 202207 27" "Richard 1")
# (find-maximamsg "37686954 202207 28" "Stavros 2")
# (find-maximamsg "37687067 202207 28" "Richard 3")
# http://jmc.stanford.edu/articles/lisp.html History of Lisp
# http://jmc.stanford.edu/articles/lisp/lisp.pdf
# https://dl.acm.org/doi/pdf/10.1145/367177.367199 McCarthy: Recursive Functions...
# https://cicm-conference.org/2022/cicm.php


Early references on undefined variables?

Hi list, especially Richard,

I've read a part of Richard's PhD thesis,

  https://apps.dtic.mil/sti/pdfs/AD0740132.pdf

and it gave me the impression that this would be a good place to ask
this... so here it goes. But first a little story.

In the middle of my master's degree, ages ago, I switched from trying
to do research on Maths (that I was finding boring) to trying to do
research on Logic (that looked much more fun). The people in the Logic
group in my university were working mostly on Proof Theory, and every
time that they would start to work on a new logical system they would
try to prove strong normalization for it - and they would usually
succeed, because they had a lot of knowledge about which systems
"looked like something that they would be able to prove strong
normalization for"... systems that were not strongly normalizable were
"bad" to them, and they were put in the box of the toys that they
didn't want to play with. I somehow managed to 1) not learn how to do
strong normalization proofs, and to 2) focus more on Lambda Calculus
than on Proof Theory... so I know a lot of the terminology about
reductions and normalization, but only a few of the techniques.

End of the little story.

So: in Maxima we can change how our reductions work by changing lots
of flags, and in some contexts we can set, say, w to 42, and this
tells the system that from that point onwards every w should be
reduced to 42. And if we turn off most of the actions of the
simplifier we can make both of these expressions

  expr1 : (x + y)(x - y)
  expr2 : (x + y)(x - y) - (x^2 - y^2)

reduce to themselves.

I _guess_ that:

  1. when the first Lisps were being created people saw very quickly
     that evaluation should be different from β-reduction... in
     β-reduction and its variants a free variable like x reduces to
     itself, but it's better to define evaluation in a way in which
     evaluating an undefined variable yields an error... and:

  2. when the first Computer Algebra systems were being created people
     saw very quickly that variables should be treated in other, more
     complex, ways - both expr1 and expr2 above are valid expressions
     that can be manipulated in many ways, but that can't evaluated
     numerically or plotted because they both depend on both x and
     y... and I guess that even the first CASs had simple functions,
     that didn't work in all cases, that could compare expr1 and expr2
     to 0, and answer that "expr1 is not 0 because expr1 depends on x
     and y and 0 doesn't" - and the same for expr2 (ta-da).

My question is: can you recommend good early references that discuss
this, i.e., that discuss how the notion of free/undefined variables in
CASs was invented?

  Thanks in advance!
    Cheers =),
      Eduardo Ochs
      http://angg.twu.net/eev-maxima.html




#####
#
# Classical Mechanics with Maxima
# 2022aug10
#
#####

# «cm-maxima»  (to ".cm-maxima")
# https://sites.berry.edu/ttimberlake/teaching/cm_maxima/
# https://sites.berry.edu/ttimberlake/wp-content/uploads/sites/37/2015/07/AnnotatedCode.zip

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
# (find-fline "~/usrc/cm_maxima/")
rm -Rv ~/usrc/cm_maxima/
mkdir  ~/usrc/cm_maxima/
cd     ~/usrc/cm_maxima/
unzip $S/https/sites.berry.edu/ttimberlake/wp-content/uploads/sites/37/2015/07/AnnotatedCode.zip



#####
#
# defrule
# 2022aug23
#
#####

# «defrule»  (to ".defrule")
# (find-maximanode "defrule")
# (find-maximanode "matchdeclare")




#####
#
# simplifying
# 2022aug28
#
#####

# «simplifying»  (to ".simplifying")
# (find-maximamsg "37699419 202208 27" "BWillis: simpfunmake")
# (find-maximamsg "37699698 202208 29" "Edrx: Here's a beginner's approach")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load(simplifying)$
ex: simpfunmake("+",[2,3]);
expand(%);

texput(ldots, "\\ldots");

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
o : lambda([], 2 + 3);
o : lambda([], 1/(2+3/(4+5/(6+7/(8+9)))));
o : lambda([], 1/(2+3/(4+5/(6+7/(8+ldots)))));
simp : false;
o();
tex(o());




#####
#
# twenty-and-thirty
# 2022sep05
#
#####

# «twenty-and-thirty»  (to ".twenty-and-thirty")
# (find-maximamsg "37702635 202209 04" "Stavros: and *thirty *as a simplifying function")
# (find-maximamsg "37703046 202209 05" "Stavros: (defun simp-thirty")



#####
#
# mfuncall: Calling user-defined function from lisp
# 2022sep12
#
#####

# «mfuncall»  (to ".mfuncall")
# https://mail.google.com/mail/u/0/#inbox/FMfcgzGqQSLWkHhdjXXqPtvzGhHnfSvg
# (find-maximamsg "37703882 202209 07" "TBaruchel: original question")
# (find-maximamsg "37703894 202209 07" "RDodier: (mfuncall '$foo x y z)")
# (find-maximamsg "37703900 202209 07" "RFateman: :lisp (meval '(($f) 4))")
# (find-maximamsg "37703934 202209 07" "TBaruchel:")
# (find-maximamsg "37704291 202209 08" "LButler: You need to declare a toplevel. This works:")
# (find-maximamsg "37704328 202209 08" "TBaruchel:")
# (find-maximamsg "37705348 202209 10" "MTalon: https://www.xach.com/lisp/buildapp/")



#####
#
# apropos
# 2022oct28
#
#####

# «apropos»  (to ".apropos")
# (find-maximamsg "37727454 202210 28" "KrisKatt: root_by_bisection")
# (find-maximanode "find_root")
# (find-maximanode "bf_find_root")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
apropos ("bisect");
cool_bisection_function_without_args ();
apropos ("bisect");



#####
#
# plot-src
# 2022nov18
#
#####

# «plot-src»  (to ".plot-src")
# (find-maximagitfile "")
# (find-maximagitsh "find * | sort | grep -i plot")
# (find-maximagitgrep "grep --color=auto -nRH --null -e gnuplot *")
# (find-maximagitgrep "grep --color=auto -niH --null -e gnuplot $(find * | sort | grep -i plot)")
# (find-maximagitfile "plotting/mgnuplot")
# (find-maximagitfile "plotting/mgnuplot.in")
# (find-maximagitfile "share/draw/")
# (find-maximagitfile "share/draw/gnuplot.lisp")
# (find-maximagitfile "share/draw/draw_gnuplot.dem")
# (find-maximagitfile "src/gnuplot_def.lisp")
# (find-maximagitfile "src/plot.lisp")
# (find-maximagitfile "tests/rtest_plot.mac")
# (find-maximagitfile "tests/rtest_plotoptions.mac")



#####
#
# draw_gnuplot.dem
# 2022nov18
#
#####

# «draw_gnuplot.dem»  (to ".draw_gnuplot.dem")
# (find-maximagitfile "share/draw/")
# (find-maximagitfile "share/draw/draw_gnuplot.dem")
# (find-maximanode "demo")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
demo("draw_gnuplot.dem");
demo("~/bigsrc/maxima/share/draw/draw_gnuplot.dem");

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
cp -v ~/bigsrc/maxima/share/draw/draw_gnuplot.dem /tmp/
# (find-fline "/tmp/draw_gnuplot.dem")



#####
#
# currying / buildq
# 2022nov21
#
#####

# «currying»  (to ".currying")
# «buildq»    (to ".buildq")
# (to "lexical_symbols.mac")
# (find-maximamsg "37738228 202211 21" "Edrx: question")
# (find-maximamsg "37738229 202211 21" "Stavros: use buildq")
# (find-maximanode "buildq")
# (find-maximagitfile "src/buildq.lisp")

Hi list,

what is right & recommended way to write curried functions in Maxima?
For example, in a first moment I though that this

  F : lambda([a], lambda([b], 10*a+b));
  F(2)(3);

would yield 23, but the result was 10*a+3...

Or: is there a simple way to do backquoting in Maxima? What are your
favorite ways to rewrite this - that is lisp-ish pseudocode -

  F : lambda([a], `lambda([b], 10*,a+b));

into real Maxima code?

  Thanks in advance!
    Eduardo Ochs
    http://angg.twu.net/eev-maxima.html


* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
F : lambda([a], buildq([a], lambda([b], 10*a+b)));
F(2);
F(2)(3);



#####
#
# maxima-packages
# 2022nov24
#
#####

# «maxima-packages»  (to ".maxima-packages")
# https://github.com/maxima-project-on-github/maxima-packages
# (find-git-links "https://github.com/maxima-project-on-github/maxima-packages" "maximapackages")
# (code-c-d "maximapackages" "~/usrc/maxima-packages/")
# (find-maximapackagesfile "")
# (find-maximapackagesfile "yitzchak/texify/README.md")



#####
#
# lexical_symbols.mac
# 2022nov24
#
#####

# «lexical_symbols.mac»  (to ".lexical_symbols.mac")
# (to "buildq")
# (find-maximamsg "37739038 202211 23" "RDodier: lexical-symbols")
# (code-c-d "mlexical" "~/usrc/maxima-packages/robert-dodier/lexical_symbols/")
# (find-mlexicalfile "")
# (find-mlexicalfile "README.md")
# (find-mlexicalfile "lexical_symbols.mac")
# (find-maximanode "sconcat")
# (find-maximanode "file_search_lisp")
# (find-maximanode "file_search_maxima")
# (find-maximanode "file_search_demo")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
d: "~/usrc/maxima-packages/robert-dodier/lexical_symbols";
push (sconcat (d, "/###.lisp"), file_search_lisp);
push (sconcat (d, "/###.mac"),  file_search_maxima);
push (sconcat (d, "/###.demo"), file_search_demo);
load ("lexical_symbols.mac");
F  : lambda([a], lambda([b], 10*a+b));
o4 : F(2);
get_envs (o4);
o4(3);
F(2)(3);




#####
#
# lexical-symbols-branch
# 2022nov24
#
#####

# «lexical-symbols-branch»  (to ".lexical-symbols-branch")
# (find-es "git" "git-diff")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
cd ~/bigsrc/maxima/
export PAGER=cat
git diff master lexical-symbols | tee /tmp/o.diff

# (find-gitk "~/bigsrc/maxima/")



#####
#
# EDOLCCs
# 2022nov21
#
#####

# «EDOLCCs»  (to ".EDOLCCs")
# (c2m222edolsp 4 "maxima")
# (c2m222edolsa   "maxima")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
Dplus0 : lambda([k,f], (D+k)*f);
Dplus1 : lambda([k,f], Dx(f)+k*f);
Dx1    : lambda([f], diff(f,x));
subst0 : lambda([r],    subst([Dplus=Dplus0], r));
subst1 : lambda([r,ss], subst([Dplus=Dplus1, ss, Dx=Dx1], r));

r : Dplus(-10, Dplus(2, f));

subst0(r);
subst1(r, f=exp(2*x));
subst1(r, f=exp(-2*x));

subst([Dplus=Dplus0], r);
subst([Dplus=Dplus1], r);
subst([Dplus=Dplus1, f=exp(10*x)], r);
subst([Dplus=Dplus1, f=exp(10*x), Dx=Dx1], r);

gradef(f(x),   f_x (x));
gradef(f_x(x), f_xx(x));

       subst1(r, f=f(x));
expand(subst1(r, f=f(x)));













# https://sourceforge.net/p/maxima/mailman/maxima-discuss/?viewmonth=202208&style=threaded&limit=250

https://sourceforge.net/p/maxima/mailman/maxima-discuss/thread/DM5PR17MB1625F1175AA81CEB6297E021B6749%40DM5PR17MB1625.namprd17.prod.outlook.com/#msg37699419
https://sourceforge.net/p/maxima/mailman/message/37699419/




* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
?? plot
   none
? plot2d
? Introduction to Plotting
? draw
?? draw
   none
? draw2d


# 2021dec22
# [Maxima-discuss] improve integration by change of variable

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
k: exp(atan(v))/ (v^2+1)^(3/2);
integrate(k,v);
changevar(%,v=tan(u),u,v);
%,integrate;








# (find-maximanode "Functions and Variables for Simplification" ": expand")
# (find-maximanode "Functions and Variables for Command Line" "Function: ev")



xyp : Op + x

ev(2 * [2, 3]);



# (find-maximanode "Functions and Variables for Lists" "Function: get")
# (find-maximanode "Arithmetic operators")


# (find-maximanode "Functions and Variables for graphs")
# (find-maximanode "Functions and Variables for implicit_plot")
# (find-maximanode "Introduction to plotdf")
# (find-maximanode "Functions and Variables for plotdf")

# From the wxmaxima tips:
# Maxima uses ':' to set values ('a : 3;') and ':=' to define functions ('f(x) := x^2;').

# (find-fline "/usr/share/wxMaxima/tips.txt")
# (find-fline "/usr/share/wxMaxima/wxmathml.lisp")
# (find-maximanode "Functions and Variables for Input and Output" "tex (<expr>)")

# http://www.csulb.edu/~woollett/
# http://www.csulb.edu/~woollett/mbe7code.txt

http://www.math.utexas.edu/pipermail/maxima/2008/010442.html
http://members3.jcom.home.ne.jp/imaxima/Site/Welcome.html
http://members3.jcom.home.ne.jp/imaxima/Site/Tutorial_of_Imaxima.html
http://members3.jcom.home.ne.jp/imaxima/Site/Easy_Install_on_Windows_XP___Vista.html



* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
f(x) := 4*x^4 - 7*x^2 + 4*x + 6;
f(0);
load(draw);
draw2d(explicit(f(x), x, -3, 3), xaxis = true, yaxis = true);
draw2d(explicit(f(x), x, -1.5, 1.5), xaxis = true, yaxis = true);
draw2d(explicit(f(x), x, -1.5, 1.5), xaxis = true, yaxis = true, yrange = [-10,20]);
draw2d(explicit(f(x), x, -1.2, -0.8), xaxis = true, yaxis = true);
draw2d(explicit(f(x), x, -1.1, -1), xaxis = true, yaxis = true);
draw2d(explicit(f(x), x, -1.06, -1.05), xaxis = true, yaxis = true);

f(-1);
diff(f(x), x);
Df(x) := 16*x^3 - 14*x + 4;
diff(Df(x), x);
DDf(x) := 48*x^2 - 14;
aa : sqrt(7/24);
DDf(aa);
DDf(-aa);
f(-aa);
f(aa);
draw2d(explicit(Df(x), x, -3, 3), xaxis = true, yaxis = true);
solve(Df(x)=0, x);



* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
eq1:x=y+25;
eq2:x+10=2*(y+10);
sol:solve([eq1, eq2], [x, y]);


* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
plot3d(x*y / sqrt(x^2 + y^2), [x, -1, 1], [y, -1, 1]);
plot3d(x*y                  , [x, -1, 1], [y, -1, 1]);
** (find-maximaindex-links "draw plot3d")
plot3d (u^2 - v^2, [u, -2, 2], [v, -3, 3], [grid, 100, 100], nomesh_lines)$
plot3d (u^2 - v^2, [u, -2, 2], [v, -3, 3], [grid, 100, 100])$
plot3d (u^2 - v^2, [u, -2, 2], [v, -3, 3])$




https://wxmaximafor.wordpress.com/

https://news.ycombinator.com/item?id=29289989 Maxima (Software) (wikipedia.org)
https://wxmaxima-developers.github.io/wxmaxima/

https://stackoverflow.com/users/688021/stavros-macrakis

https://www.maplesoft.com/support/help/maple/view.aspx?path=D

https://edu.kde.org/cantor/
https://maxima.sourceforge.io/misc/maxima-opinions.pdf
https://news.ycombinator.com/item?id=24465595 Maxima – A Computer Algebra System built with Lisp (sourceforge.net) - Sage is a python wrapper around other systems such as Maxima or Fricas.

https://www.emacswiki.org/emacs/MaximaMode

https://personal.math.ubc.ca/~cbm/aands/toc.htm A&S
https://dlmf.nist.gov/front/foreword DMLF

# (find-maximamsg "37677504 202207 06" "RDodier: Javascript from Maxima")
# (find-maximamsg "37677924 202207 09" "Stavros: Evaluation happens *before*")

# (find-maximanode "inflag")
# (find-maximamsg "37688002 202207 31" "Maxima functions for plusp, timesp, and exptp in src?")
# (find-maximamsg "37687988 202207 31" "Maxima functions for plusp, timesp, and exptp in src?")
# (find-maximamsg "37687979 202207 31" "Maxima functions for plusp, timesp, and exptp in src?")
# (find-maximamsg "37687732 202207 31" "diff of a block generated by optimize")

# (find-maximamsg "37305728 202106 18" "MTalon: About gentran and cffi")
# (find-maximamsg "37730225 202211 04" "FSFarimani: Discord")

https://www.quora.com/Are-there-higher-forms-of-the-quadratic-formula-such-as-to-find-quartic-or-quintic-polynomials/answer/Stavros-Macrakis

http://michel.gosse.free.fr/exemples/fraccont/fraction-continue-ang.pdf

https://mail.google.com/mail/u/0/#inbox/FMfcgzGqQJkVmvgxvbndhPcpRCFWHnnK matrixmap

https://github.com/mame/quine-relay
https://news.ycombinator.com/item?id=33105706 A Ruby program that generates itself through a 128-language quine loop (github.com/mame)

https://sourceforge.net/p/maxima/mailman/message/37707884/
[Maxima-discuss] remote package installation, was: share package contribution policy, was: A piece of code for computing the Carleman matrix
From: Robert Dodier <rober...@gm...> - 2022-09-15 15:19:27

# (find-maximamsg "37735225 202211 14" "Iterated at")




#  Local Variables:
#  coding:               utf-8-unix
#  modes: (fundamental-mode maxima-mode)
#  End: