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")
# «.stackoverflow»		(to "stackoverflow")
# «.gmane»			(to "gmane")
# «.hyperpolyglot»		(to "hyperpolyglot")
# «.maxima-debs»		(to "maxima-debs")
# «.web-docs»			(to "web-docs")
# «.build-html-index»		(to "build-html-index")
# «.tag-table»			(to "tag-table")
# «.emacsconf2020»		(to "emacsconf2020")
# «.simp»			(to "simp")
# «.ev»				(to "ev")
# «.ev-integrate»		(to "ev-integrate")
# «.read-simp-eval-output»	(to "read-simp-eval-output")
# «.if»				(to "if")
# «.is»				(to "is")
# «.equal»			(to "equal")
# «.describe»			(to "describe")
# «.example»			(to "example")
# «.2-lisp»			(to "2-lisp")
# «.assume»			(to "assume")
# «.changevar»			(to "changevar")
# «.changevar2»			(to "changevar2")
# «.changevar2-trig-subst»	(to "changevar2-trig-subst")
# «.changevar-basic»		(to "changevar-basic")
# «.changevar-trig-email»	(to "changevar-trig-email")
# «.changevar-trig»		(to "changevar-trig")
# «.changevar-trig-2»		(to "changevar-trig-2")
# «.changevar-trig-3»		(to "changevar-trig-3")
# «.changevar-email»		(to "changevar-email")
# «.changevar-figure»		(to "changevar-figure")
# «.3-changevars»		(to "3-changevars")
# «.subst»			(to "subst")
# «.subst-2023-2»		(to "subst-2023-2")
# «.subst-trig-questions»	(to "subst-trig-questions")
# «.antichangevar»		(to "antichangevar")
# «.find-maximaindex»		(to "find-maximaindex")
# «.:lisp»			(to ":lisp")
# «.strings»			(to "strings")
# «.printf»			(to "printf")
# «.format»			(to "format")
# «.dispform»			(to "dispform")
# «.apply»			(to "apply")
# «.myapply»			(to "myapply")
# «.operators»			(to "operators")
# «.mac-nofix»			(to "mac-nofix")
# «.for»			(to "for")
# «.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")
# «.prompt»			(to "prompt")
# «.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")
# «.draw»			(to "draw")
# «.draw-gr2d»			(to "draw-gr2d")
# «.draw2d»			(to "draw2d")
# «.draw2d-implicit»		(to "draw2d-implicit")
# «.draw2d-pdf»			(to "draw2d-pdf")
# «.casting-spels»		(to "casting-spels")
# «.infolists»			(to "infolists")
# «.macros»			(to "macros")
# «.currying»			(to "currying")
# «.buildq»			(to "buildq")
# «.DDef»			(to "DDef")
# «.dispfun»			(to "dispfun")
# «.solve»			(to "solve")
# «.matrix»			(to "matrix")
# «.inner-product»		(to "inner-product")
# «.eigen»			(to "eigen")
# «.eigenvalues»		(to "eigenvalues")
# «.linsolve»			(to "linsolve")
# «.matrix_size»		(to "matrix_size")
# «.vectortolist»		(to "vectortolist")
# «.ode2»			(to "ode2")
# «.separable»			(to "separable")
# «.separable-2»		(to "separable-2")
#   «.2022-2-C2-P2-edovs»	(to "2022-2-C2-P2-edovs")
#   «.2023-1-C2-P2-edovs»	(to "2023-1-C2-P2-edovs")
#   «.2023-1-C2-P2-edolccs»	(to "2023-1-C2-P2-edolccs")
# «.2022-2-C2-P2-edolccs»	(to "2022-2-C2-P2-edolccs")
# «.DtoDx»			(to "DtoDx")
# «.command-line»		(to "command-line")
# «.luatree»			(to "luatree")
# «.luatree-explanation»	(to "luatree-explanation")
# «.luatree-rd»			(to "luatree-rd")
# «.luatree-2023»		(to "luatree-2023")
# «.grind»			(to "grind")
# «.map»			(to "map")
# «.maplist»			(to "maplist")
# «.mapconcat»			(to "mapconcat")
# «.nouns-and-verbs»		(to "nouns-and-verbs")
# «.init-file»			(to "init-file")
# «.to_lisp»			(to "to_lisp")
# «.defmfun»			(to "defmfun")
# «.load»			(to "load")
# «.syntax»			(to "syntax")
# «.block»			(to "block")
# «.local»			(to "local")
# «.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")
# «.varargs»			(to "varargs")
# «.substpart»			(to "substpart")
# «.sly»			(to "sly")
# «.swank»			(to "swank")
# «.lisp-describe-tex»		(to "lisp-describe-tex")
# «.defmspec»			(to "defmspec")
# «.describe-mfexpr»		(to "describe-mfexpr")
# «.fapply»			(to "fapply")
# «.sas»			(to "sas")
# «.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")
#   «.minimal-maxima»		(to "minimal-maxima")
#   «.gurro-book»		(to "gurro-book")
#   «.maxima-workbook»		(to "maxima-workbook")
#   «.diffgeo-of-surfaces»	(to "diffgeo-of-surfaces")
#   «.diffeqs-maxima»		(to "diffeqs-maxima")
#   «.advfree»			(to "advfree")
# «.maxima-cvs»			(to "maxima-cvs")
# «.maxima-git»			(to "maxima-git")
# «.maxima-git-5.47.0»		(to "maxima-git-5.47.0")
# «.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")
# «.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")
# «.align_eqs»			(to "align_eqs")
# «.sum»			(to "sum")
# «.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")
# «.kill»			(to "kill")
# «.variables»			(to "variables")
# «.rubi»			(to "rubi")
# «.display2d»			(to "display2d")
# «.display2d_unicode»		(to "display2d_unicode")
# «.tex»			(to "tex")
#   «.texput»			(to "texput")
#   «.texput-frac»		(to "texput-frac")
#   «.texput-matrix»		(to "texput-matrix")
#   «.texput-Eq5»		(to "texput-Eq5")
#   «.display2d-Eq5»		(to "display2d-Eq5")
#   «.alt-display»		(to "alt-display")
#   «.barematrix»		(to "barematrix")
#   «.imaxima»			(to "imaxima")
#   «.emaxima»			(to "emaxima")
#   «.emaxima-conv»		(to "emaxima-conv")
#   «.savemaximasession-0»	(to "savemaximasession-0")
#   «.savemaximasession-1»	(to "savemaximasession-1")
#   «.emaxima.lisp»		(to "emaxima.lisp")
#   «.Maxima2.lua»		(to "Maxima2.lua")
#   «.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")
# «.runge-kutta»		(to "runge-kutta")
# «.draw3d-points»		(to "draw3d-points")
# «.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")
# «.stringproc»			(to "stringproc")
# «.displr-email»		(to "displr-email")
# «.dosimp-and-doeval»		(to "dosimp-and-doeval")
# «.trace-parser»		(to "trace-parser")
# «.lisp-trace»			(to "lisp-trace")
# «.lambda-simp»		(to "lambda-simp")

# «.symbol-plist»		(to "symbol-plist")
# «.demos»			(to "demos")
# «.fourier»			(to "fourier")
# «.taylor»			(to "taylor")
# «.taylor-2»			(to "taylor-2")
# «.del»			(to "del")
# «.impdiff»			(to "impdiff")
# «.implicit-diff»		(to "implicit-diff")
# «.pn1-folium»			(to "pn1-folium")
# «.pn1-email»			(to "pn1-email")
# «.gradef»			(to "gradef")
# «.gradef-var»			(to "gradef-var")
# «.gradef-remove»		(to "gradef-remove")
# «.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")
# «.plot2d-style-lines»		(to "plot2d-style-lines")
# «.plot2d-stair»		(to "plot2d-stair")
# «.plotdf»			(to "plotdf")
# «.partial-fractions»		(to "partial-fractions")
# «.divide»			(to "divide")
# «.two-conics»			(to "two-conics")
# «.float-and-numer»		(to "float-and-numer")
# «.mnewton»			(to "mnewton")
# «.find_root»			(to "find_root")
# «.quad_qag»			(to "quad_qag")
# «.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")
# «.2023-2-C2-P1»		(to "2023-2-C2-P1")
# «.2023-2-C2-P2»		(to "2023-2-C2-P2")
# «.2023-2-C2-VR»		(to "2023-2-C2-VR")
# «.2023-2-C2-VS»		(to "2023-2-C2-VS")
# «.2023-2-C2-laurent2»		(to "2023-2-C2-laurent2")
# «.2023-2-edos-lineares»	(to "2023-2-edos-lineares")
# «.2023-2-gradefs»		(to "2023-2-gradefs")
# «.2023-2-DDs»			(to "2023-2-DDs")
# «.2023-2-EDOLCCs»		(to "2023-2-EDOLCCs")
# «.2023-2-C3-P1»		(to "2023-2-C3-P1")
# «.2023-2-raio-conv»		(to "2023-2-raio-conv")
# «.numer-and-float»		(to "numer-and-float")
# «.plotting-contours»		(to "plotting-contours")
# «.plotting-contours-2»	(to "plotting-contours-2")
# «.terminal-tikz»		(to "terminal-tikz")
# «.2022-2-C3-P2-Q4»		(to "2022-2-C3-P2-Q4")
# «.2022-2-C3-VR»		(to "2022-2-C3-VR")
# «.myangle»			(to "myangle")
# «.early-references-on-und»	(to "early-references-on-und")
# «.cm-maxima»			(to "cm-maxima")
# «.defrule»			(to "defrule")
# «.step_by_step.mac»		(to "step_by_step.mac")
# «.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")
# «.maxima-packages»		(to "maxima-packages")
# «.lexical_symbols.mac»	(to "lexical_symbols.mac")
# «.lexical-symbols-branch»	(to "lexical-symbols-branch")
# «.gaertner-tutorial»		(to "gaertner-tutorial")
# «.gaertner-dynamic»		(to "gaertner-dynamic")
# «.EDOLCCs»			(to "EDOLCCs")
# «.by-cases»			(to "by-cases")
# «.relational»			(to "relational")
# «.binsearch»			(to "binsearch")
# «.doc-info-figures»		(to "doc-info-figures")
# «.columnvector»		(to "columnvector")
# «.mycolumnvector»		(to "mycolumnvector")
# «.myrowvector»		(to "myrowvector")
# «.basis»			(to "basis")
# «.crossproduct»		(to "crossproduct")
# «.coeff»			(to "coeff")
# «.ratcoef»			(to "ratcoef")
# «.polytoabcdef»		(to "polytoabcdef")
# «.sistemas-de-coordenadas»	(to "sistemas-de-coordenadas")
# «.coord-systems-2»		(to "coord-systems-2")
# «.coord-systems-3»		(to "coord-systems-3")
#   «.coefmatrix»		(to "coefmatrix")
#   «.augcoefmatrix»		(to "augcoefmatrix")
# «.LI_split»			(to "LI_split")
# «.linsolve_ify»		(to "linsolve_ify")
# «.LI_Axb»			(to "LI_Axb")
# «.format.mac»			(to "format.mac")
# «.ODEs-by-differentials»	(to "ODEs-by-differentials")
# «.semicirculo»		(to "semicirculo")
# «.gruntz-and-tlimit»		(to "gruntz-and-tlimit")
# «.2023-1-C4-P1»		(to "2023-1-C4-P1")
# «.2023-1-C4-P2»		(to "2023-1-C4-P2")
# «.inversas»			(to "inversas")
# «.maxima-by-example»		(to "maxima-by-example")
# «.maxima-by-example-dl»	(to "maxima-by-example-dl")
# «.maxima-by-example-ccds»	(to "maxima-by-example-ccds")
# «.maxima-by-example-eev»	(to "maxima-by-example-eev")
# «.qdraw»			(to "qdraw")
# «.qdraw-poly»			(to "qdraw-poly")
# «.parabola-boxes»		(to "parabola-boxes")
# «.parabolas-2024.1»		(to "parabolas-2024.1")
# «.myqdraw-flatten»		(to "myqdraw-flatten")
# «.qdraw-taylor»		(to "qdraw-taylor")
# «.qdraw-imp»			(to "qdraw-imp")
# «.qdraw-orbita»		(to "qdraw-orbita")
# «.qdraw-lissajous»		(to "qdraw-lissajous")
#    «.C3-lissajous»		(to "C3-lissajous")
# «.qdraw-linearize»		(to "qdraw-linearize")
# «.qdraw-proportional»		(to "qdraw-proportional")
# «.qdraw-colors»		(to "qdraw-colors")
# «.qdraw-ex-and-ex1»		(to "qdraw-ex-and-ex1")
# «.qdraw-3Daxes»		(to "qdraw-3Daxes")
# «.qdraw-homogeneous»		(to "qdraw-homogeneous")
# «.qdraw-mis»			(to "qdraw-mis")
# «.qdraw-folium»		(to "qdraw-folium")
# «.qdraw-4-inverses»		(to "qdraw-4-inverses")
# «.qdraw-eigenvectors»		(to "qdraw-eigenvectors")
# «.qdraw1»			(to "qdraw1")
# «.qdraw-contour»		(to "qdraw-contour")
# «.qdraw-bezier1»		(to "qdraw-bezier1")
# «.defstruct»			(to "defstruct")
# «.compile_file»		(to "compile_file")
# «.debugmode»			(to "debugmode")
# «.ratpow»			(to "ratpow")
# «.ratsubst»			(to "ratsubst")
# «.laurent»			(to "laurent")
# «.mpg-p17»			(to "mpg-p17")
# «.ordering»			(to "ordering")
# «.maw-emails»			(to "maw-emails")
# «.maw»			(to "maw")
# «.mysubst»			(to "mysubst")
# «.total-derivative»		(to "total-derivative")
# «.tellsimpafter»		(to "tellsimpafter")
# «.intermediate-vars»		(to "intermediate-vars")
# «.limit»			(to "limit")
# «.improper-integral»		(to "improper-integral")
# «.at»				(to "at")
# «.atvalue»			(to "atvalue")
# «.gf»				(to "gf")
# «.chaosgame»			(to "chaosgame")
# «.radcan»			(to "radcan")
# «.radcan-homogeneous»		(to "radcan-homogeneous")
# «.graphs»			(to "graphs")
# «.package_graph»		(to "package_graph")
# «.finite_model_theory»	(to "finite_model_theory")
# «.maxima-bezier»		(to "maxima-bezier")
# «.simplify_sum»		(to "simplify_sum")
# «.getenv»			(to "getenv")
# «.strang-p1»			(to "strang-p1")
# «.strang-p3»			(to "strang-p3")
# «.pontos-mais-faceis-1»	(to "pontos-mais-faceis-1")
# «.log-constants-anim»		(to "log-constants-anim")
# «.freeof»			(to "freeof")
# «.listofvars»			(to "listofvars")
# «.stewart-pt-p374»		(to "stewart-pt-p374")
# «.leithold-pt-p302»		(to "leithold-pt-p302")
# «.miranda-p191»		(to "miranda-p191")
# «.miranda-p196»		(to "miranda-p196")
# «.linel»			(to "linel")
# «.integral-calculator»	(to "integral-calculator")
# «.mixima»			(to "mixima")
# «.joel-moses»			(to "joel-moses")
# «.cabs»			(to "cabs")
# «.scalarmatrixp»		(to "scalarmatrixp")



# 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)




#####
#
# stackoverflow
# 2023feb22
#
#####

# «stackoverflow»  (to ".stackoverflow")
# https://stackoverflow.com/questions/tagged/maxima




#####
#
# gmane
# 2023jul08
#
#####

# «gmane»  (to ".gmane")
# https://mail.google.com/mail/u/0/#inbox/FMfcgzGtvscWDFBXtHjrbdZmvjJDklzm
# (find-maximamsg "37867861 202307 08" "ThorstenB: gmane.io")




#####
#
# hyperpolyglot
# 2023oct28
#
#####

# «hyperpolyglot»  (to ".hyperpolyglot")
# https://hyperpolyglot.org/computer-algebra




#####
#
# 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")



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

# «web-docs»  (to ".web-docs")
# (to "maxima-git-5.47.0")
# (find-maximanode "funmake")
# https://maxima.sourceforge.io/documentation.html
# https://maxima.sourceforge.io/docs/manual/maxima_toc.html
# https://maxima.sourceforge.io/docs/manual/maxima_423.html Appendix A Function and Variable Index
# https://maxima.sourceforge.io/docs/manual/maxima_170.html#index-funmake
# (find-maximagitsh "find * | sort")
# (find-maximagitfile "doc/info/maxima-index.lisp")
# (find-maximagitfile "doc/info/maxima-index-html.lisp")
# (find-maximagitfile "doc/info/maxima-index-html.lisp" "%and")
# (find-maximagitfile "doc/info/maxima-index-html.lisp" "mode_declare")
# https://maxima.sourceforge.io/docs/manual/maxima_170.html#index-funmake
# https://maxima.sourceforge.io/docs/manual/maxima_170.html#mode_005fdeclare
# https://maxima.sourceforge.io/docs/manual/maxima_381.html#_0025and



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

# «build-html-index»  (to ".build-html-index")
# (find-maximagitfile "doc/info/build-html-index.lisp")
# (find-maximamsg "37690863 202310 06" "Edrx: /usr/local/share/info/maxima-index-html.lisp")
# (find-maximamsg "37690886 202208 07" "RToy: doc/info/build-html-index.lisp")
# https://mail.google.com/mail/u/0/#inbox/QgrcJHsHqfTGBczPsMPxJVNfDQqtMdlbgWv
# (find-fline "/usr/local/share/info/maxima-index-html.lisp")
# (find-angg "LUA/Lisp4.lua")
# (find-blogme3 "maxima-index-html.lua")



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

# «tag-table»  (to ".tag-table")
# (find-es "texinfo" "tag-table")
# (find-angg "blogme3/maxima.lua")
# (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-c-d "maxima" "~/usrc/maxima/")
# (find-maximafile "")
# (find-maximafile "maxima.el")
# (find-maximafile "maxima.el" "maxima-symbol-doc")

(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 "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);



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

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

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





#####
#
# ev(foo,integrate) and read-simp-eval-output
# 2022jun23
#
#####

# «ev-integrate»  (to ".ev-integrate")
# «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")
# (find-maximanode "ev")
# (find-maximanode "ev" "evaluation of noun forms")
# (find-maximanode "ev" "evaluation of noun forms" "integrate")

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




#####
#
# if and is
# 2023sep26
#
#####

# «if»  (to ".if")
# «is»  (to ".is")
# (find-anggfile "luatree/luatree.mac" "if")
# (find-maximanode "if")
# (find-maximanode "if" "prederror")
# (find-maximanode "prederror")
# (find-maximanode "is")
# (find-maximanode "maybe")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
a : '(f(x,y) := 10*x+y);
a : '(b = 42);
           op(a);
      equal(op(a), ":=");
   is(equal(op(a), ":="));
if is(equal(op(a), ":=")) then "yes" else "no";




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

# «equal»  (to ".equal")
# (find-maximanode "equal")
# (find-maximanode "=")
# (find-maximanode "=" "is (a = b);")
# (find-maximanode "symbolp")
# (find-maximanode "stringp")
# (find-maximanode "prederror")
# (find-maximamsg "39730760 202309 30" "Edrx: is(equal(op(f(x,y)), 'del)) -> unknown")
# (find-maximamsg "39730814 202309 30" "BWillis: prederror")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
is(equal(a, b));
is(a=b);

is(equal(op(del(w)), 'del));
is(equal(op(f(x,y)), 'del));
is      (op(del(w)) ='del);
is      (op(f(x,y)) ='del);
if is(equal(op(del(w)), 'del)) then "yes" else "no";
if is(equal(op(f(x,y)), 'del)) then "yes" else "no";
if is      (op(del(w) = 'del)) then "yes" else "no";
if is      (op(f(x,y) = 'del)) then "yes" else "no";

ex : '(a:=b);
ex : f(a);
op(ex);
symbolp(op(ex));
stringp(op(ex));

is('f = "f");
is(op(f(a)) = "f");
is(op(f(a)) = 'f);
is(op('(a:=b)) = ":=");

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
block([prederror : false], is(equal((x+1)^2, x^2+2*x+1)));
block([prederror : true],  is(equal(op(f(x,y)), 'del)));
block([prederror : false], is(equal(op(f(x,y)), 'del)));
block([prederror : true],  is(op(f(x,y))= 'del));
block([prederror : false], is(op(f(x,y))= 'del));



# (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.






#####
#
# ?, ??, and describe
# 2023oct20
#
#####

# «describe»  (to ".describe")
# (find-maximanode "describe")
# (find-maxima-links "describe")
# (find-maximagitfile "src/macdes.lisp" "(defmspec $describe ")
# (find-maximagitfile "src/trans1.lisp" "(def%tr $describe ")
# (find-maximagitfile "src/cl-info.lisp")
# (find-maximagitfile "src/cl-info.lisp" "(defun info-exact ")
# (find-maximagitfile "src/cl-info.lisp" "(defun info-inexact ")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
:lisp (describe '$describe)
:lisp (symbol-plist '$describe)
:lisp (describe 'cl-info::info-exact)
:lisp (describe 'cl-info::info-inexact)




#####
#
# 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")
# (find-maximanode "fundef")
# (find-maximanode "apply")
# (find-maximamsg "37874281 202307 22" "RFateman: f[x]:=x+1")
# (find-elisp-intro "6. Defining functions")
# https://stackoverflow.com/questions/4578574/what-is-the-difference-between-lisp-1-and-lisp-2
# https://news.ycombinator.com/item?id=17536432 I don't really get why you'd ever want a Lisp-2

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


* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
f    :  lambda([x], 2*x);  /* sets the value    cell */
f(x) := 3*x;               /* sets the function cell */

f;                    /* uses the value    cell: lambda([x], 2*x) */
f(10);                /* uses the function cell: 30 */
apply( f, [10]);      /* uses the value    cell: 20 */
apply('f, [10]);      /* uses the function cell: 30 */
ev('f);               /* uses the value    cell: lambda([x], 2*x) */
apply('fundef, ['f]); /* uses the function cell: f(x) := 3 x */

diffxv(g) := diff(ev   (g)(x),  x);  /* uses the value    cell */
diffxf(g) := diff(apply(g,[x]), x);  /* uses the function cell */
diffxv('f);                          /* uses the value    cell: 2 */
diffxf('f);                          /* uses the function cell: 3 */

s    : 'f;
ev    ('f)(10);                       /* uses the value    cell: 20 */
apply ('f,[10]);                      /* uses the function cell: 30 */
ev    ( s)(10);                       /* uses the value    cell: 20 */
apply ( s,[10]);                      /* uses the function cell: 30 */
concat('f,'p);                        /* uses the name     cell: sp */
concat( s,'p);                        /* uses the name     cell: sp */

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
f    :  lambda([y], 2*y);  /* sets the value    cell */
g    :  lambda([y], 3*y);  /* sets the value    cell */
h    :  lambda([y], 4*y);  /* sets the value    cell */
f(y) := 5*y;               /* sets the function cell */
g(y) := 6*y;               /* sets the function cell */
h(y) := 7*y;               /* sets the function cell */

foo(f,g) := block([f0,f1,ex0,ex1],
    f0  : f,
    f1  : concat(f, 'p),
    ex0 : apply(g,[x]),
    ex1 : diff(ex0, x),
    [f0, f1, ex0, ex1],
    buildq([f0,f1,ex0,ex1],
      [f0 = lambda([x],ex0),
       f1 = lambda([x],ex1)
      ])
    );
foo('g,'h);

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
f[x]   := x+1;   /* general case: f[3] will return 4 */
f[1/2] :  34;    /* exception:  f[1/2] will return 34 */
f[10];
f[1/2];



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

# «assume»  (to ".assume")
# (to "inversas")
# (find-maximanode "Functions and Variables for Integration" "neg;")
# (find-maximanode "assume")
# (find-maximanode "facts")
# (find-maximanode "forget")
# (find-maximanode "declare")
# (to "changevar")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
o  : y = x^2;
a1 : 0 <= x;
a2 : x <= 0;
            [a1, assume(a1), facts(x)];
o2 : -sqrt(o);
[forget(a1), assume(a2), facts(x)];
o3 : sqrt(o);

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
o : y = ((x+1)^2 - 3)^4;
a1 : (x+1)^2 - 3 >= 0;
a2 : x+1 >= 0;
assume(a1);
assume(a2);
          o^(1/4);
          o^(1/4)+3;
     sqrt(o^(1/4)+3);
     sqrt(o^(1/4)+3)-1;
o2 : sqrt(o^(1/4)+3)-1;

assume(not equal(k,0));
assume(notequal(k,0));
facts(k);




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

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

* (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;




#####
#
# A variant of changevar that takes only 2 arguments
# 2024apr19
#
#####

# «changevar2»  (to ".changevar2")
# (find-maximanode "ev" "nouns")
# (to "listofvars")
# (to "changevar-trig")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
freevar      (expr)     := listofvars(expr)[1];
changevar2   (expr, cv) := changevar(expr, cv, freevar(lhs(cv)), freevar(rhs(cv)));
changevarback(expr, cv) := subst(cv, expr);

/* A standard example: */
int0 : 'integrate(cos(x^3)*3*x^2, x);
cv01 : u=x^3;
int1 : changevar (int0, cv01, u, x);
int1 : changevar2(int0, cv01);
F1   : ev(int1, nouns);
F0   : changevarback(F1, cv01);




#####
#
# Hacking changevar2 to make it work with trig substs
# 2024apr19
#
#####

# «changevar2-trig-subst»  (to ".changevar2-trig-subst")
# (to "changevar2")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
freevar      (expr)     := listofvars(expr)[1];
changevar2   (expr, cv) := changevar(expr, cv, freevar(lhs(cv)), freevar(rhs(cv)));
changevarback(expr, cv) := subst(cv, expr);

int0 : 'integrate(1/sqrt(1-s^2), s);   /* bad */
int0 : 'integrate(s*sqrt(1-s^2), s);   /* works */
cv01 : sin(th)=s;
cv10 : [cos(th)=sqrt(1-s^2), sin(th)=s, th=asin(s)];
int1 : changevar2(int0, cv01);

  /* fix int1 */
       assume(cos(th) >= 0);
int1 : map(rootscontract, int1);
int1 : map(trigsimp,      int1);

F1   : ev(int1, nouns);
F2   : changevarback(F1, cv10);




#####
#
# A basic example of using changevar (with u=x^2)
# 2023oct10
#
#####

# «changevar-basic»  (to ".changevar-basic")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
ex0 : 'integrate(cos(x^2)*2*x, x);
ex1 : changevar(ex0, u=x^2, u, x);
ex2 : ev(ex1, 'integrate);
ex3 : subst([u=x^2], ex2);



#####
#
# changevar-trig-email
# 2023oct12
#
#####

# «changevar-trig-email»  (to ".changevar-trig-email")
# (find-maximamsg "37675741 202207 02" "Edrx: sqrt(1-sin(t)^2) -> sqrt(1-sin(t))*sqrt(sin(t)+1)")
# (find-maximamsg "37675749 202207 02" "MTalon: rootscontract")

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-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")
# (find-maximanode "rootscontract")
# (find-maximanode "map")

* (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;

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
ex0 : 'integrate(x*sqrt(4-9*x^2), x);
ex0 : 'integrate(x*sqrt(1-9*x^2), x);
ex1 : changevar(ex0, u=3*x, u, x);




#####
#
# changevar-trig: integrate(s*sqrt(1-s^2), s)
# 2023oct10
#
#####

# «changevar-trig-2»  (to ".changevar-trig-2")
# (find-es "maxima" "2023-2-C2-P1")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
assume(c>0);
ex0   : 'integrate(s*sqrt(1-s^2), s);
ex1   : changevar(ex0, s=sin(th), th, s);
  ex1 : map(rootscontract, ex1);
  ex1 : subst([sqrt(1-sin(th)^2)=cos(th)], ex1);
ex2   : changevar(ex1, c=cos(th), c, th);
ex3   : ev(ex2, 'integrate);
ex4   : subst([c=cos(th)], ex3);
ex5   : subst([th=asin(s)], ex4);
ex0 = ex5;
diff(ex5, s);

align_eqs([ex0, ex1, ex2, ex3, ex4, ex5]);



#####
#
# changevar-trig-3
# 2023dec19
#
#####

# «changevar-trig-3»  (to ".changevar-trig-3")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
assume(c>0);
I_s    : 'integrate(s*sqrt(1-s^2), s);
I_th   : changevar(I_s, s=sin(th), th, s);
  I_th : map(rootscontract, I_th);
  I_th : subst([sqrt(1-sin(th)^2)=cos(th)], I_th);
I_c    : changevar(I_th, c=cos(th), c, th);
F_c    : ev(I_c, 'integrate);
F_th   : subst([c=cos(th)], F_c);
I_s    : subst([th=asin(s)], F_th);
I_s = I_s;
diff(I_s, s);

align_eqs([I_s, I_th, I_c, F_c, F_th, I_s]);

I_c    : 'integrate(c/(1-c^2), c);




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

# «changevar-email»  (to ".changevar-email")
# (find-maximamsg "37672073 202206 24" "Edrx: unquote integrate(cos(y),y)")
# (find-maximamsg "37672076 202206 24" "Stavros: ev(...,integrate) or ev(...,nouns)")
# (find-maximamsg "37672078 202206 24" "Edrx: thanks!")

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);




#####
#
# 3-changevars
# 2023oct10
#
#####

# «3-changevars»  (to ".3-changevars")
# (find-angg "MAXIMA/3-changevars1.mac")




#####
#
# subst
# 2023apr14
#
#####

# «subst»  (to ".subst")
# (find-maximanode "subst")
# (find-maximanode "sublis")
# (find-maximanode "psubst")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
subst (a, x+y, x + (x+y)^2 + y);
subst (-%i, %i, a + b*%i);
subst ([a=b, b=c], a+b);
sublis([a=b, b=c], a+b);
subst(["+"="-"],a+b-c);
g1:y(t)=a*x(t)+b*diff(x(t),t);
subst('diff(x(t),t)=1,g1);
at(g1,'diff(x(t),t)=1);

example (subst);



#####
#
# subst-2023-2: idéias para um slide sobre RC[f(x):=bla]
# 2023aug27
#
#####

# «subst-2023-2»  (to ".subst-2023-2")
# See: (to "texput-frac")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
/* RP: regra do produto
 * RE: regra errada
*/
RP : 'diff(x^n,x) = n*x^(n-1);
subst([n=4], RP);
RE : 'diff(x^n,x) = x^(n-1)+10*n;
subst([n=42], RE);

RC : 'diff(f(g(x)),x) = fp(g(x))*gp(x);
ex1g  : lambda([x],42*x);
ex1gp : lambda([x],42);
ex1f  : lambda([x],sin(x));
ex1fp : lambda([x],cos(x));
subst([g=ex1g,gp=ex1gp], RC);
subst([f=ex1f,fp=ex1fp], RC);
subst([f=ex1f], RC);    /* errado! */




* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load("/home/edrx/bigsrc/maxima/interfaces/emacs/emaxima/emaxima.lisp")$
display2d:'emaxima$
a/b;
'diff(y,x);
texput("/", lambda([r],
    block([n,d],
          n:num(r),
          d:denom(r),
          printf(false,"\\frac{~a}{~a}",tex1(n),tex1(d)))))$
a/b;
'diff(y,x);

texput, \frac, and diff
Hi list,

In this message

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

Leo Butler showed a texput that makes tex1 use \frac instead of \over.
But I just noticed that when I use "display2d:'emaxima$" his texput
makes d/dx be displayed as 1/x... and I don't know how to debug that.
Help, please?

Here is the code:

  load("/home/edrx/bigsrc/maxima/interfaces/emacs/emaxima/emaxima.lisp")$
  display2d:'emaxima$
  a/b;
  'diff(y,x);
  texput("/", lambda([r],
      block([n,d],
            n:num(r),
            d:denom(r),
            printf(false,"\\frac{~a}{~a}",tex1(n),tex1(d)))))$
  a/b;
  'diff(y,x);

When I run it in a REPL I get this:

  (%i1) load("/home/edrx/bigsrc/maxima/interfaces/emacs/emaxima/emaxima.lisp")$
  
  (%i2) display2d:'emaxima$
  
  (%i3) a/b;
  (%o3) {{a}\over{b}}
  (%i4) 'diff(y,x);
  (%o4) {{d}\over{d\,x}}\,y
  (%i5) texput("/", lambda([r],
      block([n,d],
            n:num(r),
            d:denom(r),
            printf(false,"\\frac{~a}{~a}",tex1(n),tex1(d)))))$
  
  (%i6) a/b;
  (%o6) \frac{a}{b}
  (%i7) 'diff(y,x);
  (%o7) \frac{1}{x}\,y
  (%i8)

Thanks in advance!
  Eduardo Ochs


texput(fp, "f'")$
texput(gp, "g'")$
linenum:0;


# (find-sh "locate emaxima.lisp")





#####
#
# Choosing good test questions on trigonometric substitution
# 2022nov29
#
#####

# «subst-trig-questions»  (to ".subst-trig-questions")
# (find-es "maxima" "2023-2-C2-P1")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
ff(a,b,c) := x^a * sqrt(1 - c*x^2)^b;
f (a,b)   := x^a * sqrt(1 -   x^2)^b;
FF(a,b,c) := integrate(ff(a,b,c), x);
F (a,b)   := integrate(f (a,b),   x);
Q (a,b)   := ('integrate(f(a,b),x) = integrate(f(a,b),x));
F(1,1);
F(1,3);
F(1,5);

F(2,1);
f(2,1);

F(2,3);   /* has an arcsin */
F(2,5);

F(3,1);
F(3,3);
F(3,5);

ff(3,1,1);
FF(3,1,1);
ff(3,1,4);
FF(3,1,4);

F(4,1);
F(4,3);
F(4,5);

Q(3,3);
Q(0,-1);
Q(-2,1);



#####
#
# antichangevar
# 2022dec13
#
#####

# «antichangevar»  (to ".antichangevar")
# (c2m222p1p 5 "questao-1-gab")
# (c2m222p1a   "questao-1-gab")
# (find-maximanode "changevar")
# (find-maximanode "subst")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
anticv(bodyu, ux, x) := subst(ux, bodyu) * diff(rhs(ux), x);
fu : sin(u);
fx : anticv(fu, u=x^2, x);

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
fx  : x^3 * sqrt(1-4*x^2);
fu  : subst([x=u/2],     fx) * diff(u/2,     u);
fth : subst([u=sin(th)], fu) * diff(sin(th), th);
fth : subst([sqrt(1-sin(th)^2)=cos(th)], fth);
fc  : subst([cos(th)=c], fth) / diff(cos(th), th);
fc  : subst([sin(th)^2=1-c^2], fc);
fc  : expand(fc);




#####
#
# 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>$")




#####
#
# 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")




#####
#
# printf
# 2024apr07
#
#####

# «printf»  (to ".printf")
# (find-maximanode "printf")
# (find-maxima-links "printf")
# (find-maximanode "Introduction to String Processing")
# (find-maximagitsh "find * | sort")
# (find-maximagitfile "share/stringproc/")
# (find-maximagitfile "share/stringproc/stringproc.mac")
# (find-maximanode "setup_autoload")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
:lisp (describe     '$printf)
:lisp (symbol-plist '$printf)

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);




#####
#
# format
# 2024apr06
#
#####

# «format»  (to ".format")
# (find-angg ".maxima/maxima-init.mac" "format")
# (find-es "lisp" "format")
# (find-es "lisp" "format-recipes")
# (find-es "lisp" "format-recipes" "12,'0d")
# (find-maximanode "?")
# (find-maximanode "Lisp and Maxima")
# (find-maximanode "Lisp and Maxima" "?foo")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
format([args]) := apply(?format, append([false], args));
topdfstem(n)   := format("/tmp/pdfs/a_~3,'0d", n);
topdfstem(1);
topdfstem(20);




#####
#
# dispform
# 2024apr07
#
#####

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

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
- x;
?format (true, "~S~%", %);
dispform (- x);
?format (true, "~S~%", %);

sqrt (x);
?format (true, "~S~%", %);
dispform (sqrt (x));
?format (true, "~S~%", %);

expr : sin (sqrt (x));
freeof (sqrt, expr);
freeof (sqrt, dispform (expr));
freeof (sqrt, dispform (expr, all));







#####
#
# apply
# 2023jul20
#
#####

# «apply»  (to ".apply")
# «myapply»  (to ".myapply")
# (find-maxima-links "apply")
# (find-maximanode "apply")
# (find-maximanode "firstn")
# (find-maximanode "last")
# (find-efunctiondescr 'apply)
# (find-efunctiondescr 'funcall)
# (find-efunctiondescr 'butlast)
# (find-efunction      'butlast)

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
butlast     (as)  := firstn(as, length(as)-1);
myapply  (f,[as]) := apply(f, append(butlast(as), last(as)));

        "+"  (1, 2, 3, 4, 5);
  apply("+", [1, 2, 3, 4, 5]);   /* 15 */
  apply("+",  1, 2, 3, [4,5]);   /* err */
myapply("+",  1, 2, 3, [4,5]);   /* 15 */
myapply_1 (  [1, 2, 3, [4,5]]);  /* [1, 2, 3, 4, 5] */




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

# «operators»  (to ".operators")
# (to "texput")
# (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")
# (find-maximanode "sconcat")

* (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);



#####
#
# The nofix("...") trick in my package for Taylors and MacLaurins
# 2023dec06
#
#####

# «mac-nofix»  (to ".mac-nofix")
# (find-angg "MAXIMA/mac1.mac")
# (find-maximanode "taylor")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load("~/MAXIMA/mac1.mac");
        mac(1,2,3);
        mac(1,2,3,...);
        mac(1,2,3,...) * mac(0,1,0,...);
mac_ify(mac(1,2,3,...) * mac(0,1,0,...));
        mac1 : mac(1,2,-3,4,5,...);
        mac2 : mac(a,b,c,d,e,...);
        mac3 : 1/mac1;
        mac1 * mac3;
mac_ify(mac1 * mac3);




#####
#
# for
# 2022dec11
#
#####

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

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
for i: 2 thru 5 do display(i);
for a:-3 thru 26 step 7 do display(a)$

s:0;
for i: 1 while i <= 10 do s: s+i;
s;

     Note that the condition 'while i <= 10' is equivalent to 'unless i
     > 10' and also 'thru 10'.

          (%i1) series: 1$
          (%i2) term: exp (sin (x))$
          (%i3) for p: 1 unless p > 7 do
                    (term: diff (term, x)/p,
                     series: series + subst (x=0, term)*x^p)$
          (%i4) series;
                            7    6     5    4    2
                           x    x     x    x    x
          (%o4)            -- - --- - -- - -- + -- + x + 1
                           90   240   15   8    2

     which gives 8 terms of the Taylor series for 'e^sin(x)'.

          (%i1) poly: 0$
          (%i2) for i: 1 thru 5 do
                    for j: i step -1 thru 1 do
                        poly: poly + i*x^j$
          (%i3) poly;
                            5      4       3       2
          (%o3)          5 x  + 9 x  + 12 x  + 14 x  + 15 x
          (%i4) guess: -3.0$
          (%i5) for i: 1 thru 10 do
                    (guess: subst (guess, x, 0.5*(x + 10/x)),
                     if abs (guess^2 - 10) < 0.00005 then return (guess));
          (%o5)                  - 3.162280701754386

     This example computes the negative square root of 10 using the
     Newton- Raphson iteration a maximum of 10 times.  Had the
     convergence criterion not been met the value returned would have
     been 'done'.

     Instead of always adding a quantity to the control-variable one may
     sometimes wish to change it in some other way for each iteration.
     In this case one may use 'next <expression>' instead of 'step
     <increment>'.  This will cause the control-variable to be set to
     the result of evaluating <expression> each time through the loop.

          (%i6) for count: 2 next 3*count thru 20 do display (count)$
                                      count = 2

                                      count = 6

                                     count = 18

     As an alternative to 'for <variable>: <value> ...do...' the syntax
     'for <variable> from <value> ...do...' may be used.  This permits
     the 'from <value>' to be placed after the 'step' or 'next' value or
     after the termination condition.  If 'from <value>' is omitted then
     1 is used as the initial value.

     Sometimes one may be interested in performing an iteration where
     the control-variable is never actually used.  It is thus
     permissible to give only the termination conditions omitting the
     initialization and updating information as in the following example
     to compute the square-root of 5 using a poor initial guess.

x: 1000$
thru 20 do x: 0.5*(x + 5.0/x)$
x;
sqrt(5), numer;

newton (f, x):= ([y, df, dfx], df: diff (f ('x), 'x),
    do (y: ev(df), x: x - f(x)/y,
        if abs (f (x)) < 5e-6 then return (x)))$
sqr (x) := x^2 - 5.0$
newton (sqr, 1000);

     (Note that 'return', when executed, causes the current value of 'x'
     to be returned as the value of the 'do'.  The 'block' is exited and
     this value of the 'do' is returned as the value of the 'block'
     because the 'do' is the last statement in the block.)

     One other form of the 'do' is available in Maxima.  The syntax is:

          for <variable> in <list> <end_tests> do <body>

     The elements of <list> are any expressions which will successively
     be assigned to the 'variable' on each iteration of the <body>.  The
     optional termination tests <end_tests> can be used to terminate
     execution of the 'do'; otherwise it will terminate when the <list>
     is exhausted or when a 'return' is executed in the <body>.  (In
     fact, 'list' may be any non-atomic expression, and successive parts
     are taken.)

for f in [log, rho, atan] do ldisp(f(1))$







#####
#
# 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")

# (find-maximamsg "37743974 202212 05" "MTalon: declare(integrate,linear);")



#####
#
# 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-angg ".emacs" "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)

# 2022dec07:
# Font locking is much better in upstream Maxima's maxima.el
# https://gitlab.com/sasanidas/maxima/-/issues/40

Hi Fermin,
compare the two screenshots below:

http://angg.twu.net/IMAGES/maxima-mode-melpa-2022.png
http://angg.twu.net/IMAGES/maxima-mode-git-2022.png

The one that says "melpa" is what I get from the Maxima mode from
MELPA; it is quite bad. The one that says "git" is what I get using
the maxima.el from an upstream Maxima git-pull'ed and compiled a few
days ago, and it is much better.

Do you get something similar? If not, should I try to check which
other packages are interfering in on your maxima mode and
maxima-font-lock? They do not affect the maxima mode from upstream...




#####
#
# eepitch-maxima (obsolete)
# 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 (for Fermin's mode?)
# 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)




#####
#
# prompt
# 2023jul13
#
#####

# «prompt»  (to ".prompt")
# (find-maximanode "inchar")
# (find-maximanode "outchar")
# (find-maximanode "linechar")
# (find-maximanode "linenum")
# (find-maximanode "programmode")
# (find-maximanode "labels")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
a : 42;
b : 99;
linenum : 0;
inchar;
inchar: "bla";
inchar: "%i";




#####
#
# 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-maximanode "Lisp and Maxima")
# (find-maximanode "Lisp and Maxima" "same effect as")
# (find-maximanode "Lisp and Maxima" "same effect as" "foo: [x, y]")
# (find-maximanode "Documentation")
# (find-maximanode "Functions and Variables for Help")
# (find-maximanode "Source Level Debugging")
# (find-maximanode "Function and Variable Index")
# (find-maximanode "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-maximanode "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")



#####
#
# 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-maximanode "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");



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

# «draw2d-implicit»  (to ".draw2d-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" );




#####
#
# draw2d-pdf
# 2023nov19
#
#####

# «draw2d-pdf»  (to ".draw2d-pdf")





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

# «casting-spels»  (to ".casting-spels")
# https://riotorto.users.sourceforge.net/Maxima/casting/index.htm 2023sep26
#  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;





#####
#
# infolists
# 2023jul08
#
#####

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


#####
#
# macros
# 2023jul08
#
#####

# «macros»  (to ".macros")
# (to "op-and-args")
# (find-maximanode "::=")




#####
#
# 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);




#####
#
# DDef: define in the default way
# 2023sep25
#
#####

# «DDef»  (to ".DDef")
# (find-angg ".maxima/maxima-init.mac" "DDef")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
DDef1(fxy) := buildq([f:op(fxy),xy:args(fxy)], define(f(splice(xy)),f));
DDef([fxys]) ::= map('DDef1,fxys);

P  : [cos(k*t), sin(k*t)];
Pt : diff(P, t);

macroexpand(DDef( P(t),   Pt(t)   ));
macroexpand(DDef( P(k,t), Pt(k,t) ));

DDef ( P(t), Pt(t) );
P(a);
Pt(a);

DDef ( P(k,t), Pt(k,t) );
P(2,a);
Pt(2,a);





#####
#
# 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);




#####
#
# matrix
# 2023may07
#
#####

# «matrix»  (to ".matrix")
# (find-maximanode "matrix")
# (find-maximanode "dot")

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

A : matrix ([0, 1], [0, 0]);
B : matrix ([0, 0], [1, 0]);
A . B;
B . A;

A : matrix ([a, b]);
B : matrix ([c], [d]);
A;
B;
A . B;
B . A;

L : matrix ([a, 0], [b, c]);
U : matrix ([d, e], [0, f]);
L . U;




#####
#
# inner-product
# 2023jul03
#
#####

# «inner-product»  (to ".inner-product")
# «eigen»  (to ".eigen")
# (find-maximagitfile "share/matrix/" "eigen")
# (find-maximagitfile "share/matrix/eigen.dem")
# (find-maximagitfile "share/matrix/eigen.mac" "columnvector(x):=")
# (find-maximanode "vectors")
# (find-maximagitfile "share/vector/vect.mac")
# (find-maximagitfile "share/vector/vect.mac" "\\gradprod(uu,pv) :=")
# (find-maximagitfile "share/vector/vect.dem")
# (find-maximagitfile "share/vector/" "vect.mac")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
demo  ("eigen");
batch ("eigen");



#####
#
# eigenvalues and eigenvectors
# 2023nov04
#
#####

# «eigenvalues»  (to ".eigenvalues")
# (find-maximanode "eigenvalues")
# (find-maximanode "eigenvectors")
# (find-maximanode "eivals")
# (find-maximanode "eivects")
# (find-maximagitfile "share/matrix/eigen.dem" "eigenvalues(matrix1);")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
M1: matrix([1, 2],
           [2, 5]);
M1: matrix([0, 1, 0, 0],
           [0, 0, 0, 0],
           [0, 0, 2, 0],
           [0, 0, 0, 2]);
[vals, vecss]: eigenvectors (M1);
val  (i) := vals[1][i]$
mult (i) := vals[2][i]$
vecs (i) := vecss[i]$
vecst(i) := map('transpose, vecss[i]);
vmvs (i) := [val(i), mult(i), vecs (i)]$
vmvst(i) := [val(i), mult(i), vecst(i)]$

vmvs(1);
vmvs(2);
vecs(2);
vecst(2);
vmvst(1);
vmvst(2);
float(vmvst(1));
float(vmvst(2));
fpprintprec : 4;
float(vmvst(1));
float(vmvst(2));

                vecst(2)[1];
       M1     . vecst(2)[1];
       val(2) * vecst(2)[1];
expand(M1     . vecst(2)[1]);
expand(val(2) * vecst(2)[1]);





#####
#
# linsolve
# 2022dec07
#
#####

# «linsolve»  (to ".linsolve")
# (find-maximanode "linsolve")
# (find-books "__analysis/__analysis.el" "hefferon")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
linsolve ([3*x + 4*y = 7, 2*x + a*y = 13], [x, y]);
linsolve ([3*x + 4*y, 2*x + a*y] = [7,13], [x, y]); /* err */
linsolve ([3*x + 4*y, 2*x + a*y] - [7,13], [x, y]);

eq_1 : u = a1*x + b1*y + c1;
eq_2 : v = a2*x + b2*y + c2;
eqs_12 : [eq_1, eq_2];
eqs_34 : linsolve([eq_1, eq_2], [x,y]);
eqs_34 : linsolve(eqs_12, [x,y]);
eqs_56 : linsolve(eqs_34, [u,v]);

rlhs(eq) := rhs(eq) - lhs(eq);
lrhs(eq) := lhs(eq) - rhs(eq);
flip(eq) := rhs(eq) = lhs(eq);
keqk(k)  := k = k;

eq_1 : u =   x + 2*y;
eq_2 : v = 3*x + 4*y;
eq_3 : eq_1 + keqk(-2*y);
eq_4 : flip(eq_3);
eq_5 : subst(eq_4, eq_2);
eq_6 : expand(eq_5);
eq_7 : eq_6 + keqk(2*y-v);
eq_8 : eq_7 / 2;
[eq_4, eq_8];
linsolve([eq_1, eq_2], [x,y]);

apply('matrix, map("[", eqs_56));

colv([entries]) := apply('matrix, map("[", entries));
colv(2, 3);
colv(eqs_56);
apply('colv, eqs_56);




#####
#
# matrix_size
# 2023may28
#
#####

# «matrix_size»   (to ".matrix_size")
# «vectortolist»  (to ".vectortolist")
# (find-es "maxima" "linsolve")
# (find-maximanode "matrix_size")
# (find-maximanode "lu_factor")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
matrix_height(v) := matrix_size(v)[1];
matrix_width (v) := matrix_size(v)[2];
vectortolist (v) := makelist(v[i][1], i, 1, matrix_height(v));
A    : matrix([2, 1, -5], [-3, 4, 1], [4, 13, -23]);
determinant(A);
xyz  : [x, y, z];
v    : [1, -2, 1];
eqs1 : A . xyz = v;
eqs2 : A . xyz - v;
eqs3 : vectortolist(eqs2);
linsolve (eqs3, [x, y, z]);

matrix_size(eqs2);
matrix_size(eqs2)[1];
matrix_size(A);
matrix_size(eqs2);
op(eqs2);
eqs2[1];
eqs2[1][1];
args(eqs2);
linsolve (A . xyz - v, [x, y, z]);




#####
#
# ode2
# 2023jul18
#
#####

# «ode2»  (to ".ode2")
# (find-maximanode "ode2")
# (find-maximanode "ic1")
# (find-maximanode "ic2")

# (find-mbe03page 1)
# (find-mbe03text 1)
# (find-mbe-links 3 3 "3.2.2    Exact Solution with ode2 and ic1")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
de : 'diff(u,t)- u - exp(-t);
gsoln : ode2(de,u,t);
psoln : ic1(gsoln,t = 2, u = -0.1);
psoln : ic1(gsoln,t = 2, u = -0.1),ratprint:false;
rhs(psoln),t=2,ratsimp;
de,psoln,diff,ratsimp;
us : rhs(psoln);
plot2d(us,[t,0,7],
          [style,[lines,5]],[ylabel," "],
          [xlabel,"t0 = 2, u0 = -0.1, du/dt = exp(-t) + u"])$


# (find-mbe-links 3 9 "3.3.2   Exact Solution with ode2, ic2, and eliminate")
# (find-mbe03page   9 "3.3.2   Exact Solution with ode2, ic2, and eliminate")
# (find-mbe03text   9 "3.3.2   Exact Solution with ode2, ic2, and eliminate")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
de : 'diff(u,t,2) - 4*u;
gsoln : ode2(de,u,t);
de,gsoln,diff,ratsimp;
psoln : ic2(gsoln,t=2,u=1,'diff(u,t) = 0);
us : rhs(psoln);
us, t=2, ratsimp;
plot2d(us,[t,0,4],[y,0,10],
          [style,[lines,5]],[ylabel," "], 
          [xlabel," U versus t, U''(t) = 4 U(t), U(2) = 1, U'(2) = 0 "])$




#####
#
# 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);



#####
#
# separable-2
# 2022dec06
#
#####

# «separable-2»  (to ".separable-2")
# «2022-2-C2-P2-edovs»  (to ".2022-2-C2-P2-edovs")
# (c2m222p2p 2 "edovs")
# (c2m222p2a   "edovs")
# (c2m222p2p 2 "links-edovs")
# (c2m222p2a   "links-edovs")

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

/* Dados do problema */
define(G(x), x^4 + 5);
define(H(y), y^2 + 3);

x_1  : 3;
y_1  : 4;

define(g(x), diff(G(x),x));
define(h(y), diff(H(y),y));
edo    : dydx = g(x) / h(y);

eq_a   : x = H(y);
         solve(eq_a, y);
eq_b   : solve(eq_a, y)[2];  /* adjust */
define(Hinv(x), rhs(eq_b));

test_v : y = Hinv(H(y));
assume(y >= 0);
test_v : y = Hinv(H(y));

eq_c   : y = Hinv(G(x) + C3);
define(f  (x), rhs(eq_c));
define(f_x(x), diff(f(x), x));
test_gen : subst([y=f(x), dydx=f_x(x)], edo);

eq_d  : subst([x=x_1, y=y_1], eq_c);
        solve(eq_d, C3);
eq_e  : solve(eq_d, C3)[1];  /* adjust */
C3_1  : rhs(eq_e);
eq_f1 : subst([C3=C3_1], eq_c);
define(f_1(x), rhs(eq_f1));
test_xy1 : f_1(x_1) = y_1;

** (find-maximanode "ode2")
** (find-maximanode "ic1")
**
edo2 : subst([dydx='diff(y,x)], edo);
eq_g : ode2 (edo2, y, x);
       solve(eq_g, y);
eq_h : solve(eq_g, y)[2];
eq_i : subst([x=x_1, y=y_1], eq_h);
       solve(eq_i, %c);
eq_j : solve(eq_i, %c)[1];
eq_k : subst(eq_j, eq_h);
eq_l : subst([x=x_1, y=y_1], eq_k);

ic1(solve(eq_g, y)[2], x=x_1, y=y_1);
ic1(eq_h,              x=x_1, y=y_1);



#####
#
# 2023-1-C2-P2-edovs
# 2023jul07
#
#####

# «2023-1-C2-P2-edovs»  (to ".2023-1-C2-P2-edovs")
# (c2m231p2p 2 "questao-1")
# (c2m231p2a   "questao-1")
# (c2m231p2p 7 "questao-1-gab")
# (c2m231p2a   "questao-1-gab")

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

define(G(x), -x);
define(H(y), y^2);
define(g(x), diff(G(x),x));
define(h(y), diff(H(y),y));
myode   :  dydx = g(x) / h(y);

sdydx   :  [dydx='diff(y,x)     ];
sddx(f) := [dydx= diff(f,x), y=f];
                subst(sdydx, myode);
sols    :  ode2(subst(sdydx, myode), y, x);
                  solve(sols, y);
              rhs(solve(sols, y)[1]);
              rhs(solve(sols, y)[2]);
define(f1(x), rhs(solve(sols, y)[2]));
define(f2(x), rhs(solve(sols, y)[1]));

getsolxy(xy, sol) := block(
  [solxy, eqc],
  solxy : subst(xy, sol),
  eqc   : solve(solxy, %c),
  subst(eqc, sol));
eq3 : getsolxy([x=3, y= 2], y=f1(x));
eq4 : getsolxy([x=4, y=-3], y=f2(x));
define(f3(x), rhs(eq3));
define(f4(x), rhs(eq4));

      sddx(f3(x));
                   myode;
subst(sddx(f1(x)), myode);
subst(sddx(f2(x)), myode);
subst(sddx(f3(x)), myode);
subst(sddx(f4(x)), myode);
f3(3) =  2;
f4(4) = -3;




#####
#
# 2023-1-C2-P2-edolccs
# 2023jul07
#
#####

# «2023-1-C2-P2-edolccs»  (to ".2023-1-C2-P2-edolccs")
# (c2m231p2p 3 "questao-2")
# (c2m231p2a   "questao-2")
# (c2m231p2p 7 "questao-2-gab")
# (c2m231p2a   "questao-2-gab")
# (find-maximanode "ode2")
# (find-maximanode "scanmap")
# (find-maximanode "factor")
# (find-maximanode "gfactor")
# (find-maximamsg "37867816 202307 08" "Stavros: scanmap('factor,f2)")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
/* y'' + y' - 20y = 0
   f1(x) = e^{-5x}
   f2(x) = e^{4x}
*/
factor(D^2 + D - 20);
edo     :  y_xx + y_x - 20*y = 0;
edo2    :  subst([y_xx='diff(y,x,2), y_x='diff(y,x)     ], edo);
edo2(f) := subst([y_xx= diff(f,x,2), y_x= diff(f,x), y=f], edo);
sol     :          ode2(edo2,y,x);
define(f(x),   rhs(ode2(edo2,y,x)));
define(f1(x),  subst([%k1=0, %k2=1], f(x)));
define(f2(x),  subst([%k1=1, %k2=0], f(x)));
define(f_x(x), diff(f(x), x));
k1k2    : linsolve([f(0)=4, f_x(0)=5], [%k1, %k2]);
define(g(x),   subst(k1k2, f(x)));
define(g_x(x), diff(g(x), x));
/* Tests: */
[g(0)=4, g_x(0)=5];
       edo2(g(x));
expand(edo2(g(x)));

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
edo       :  y_xx + 4*y_x + 29*y = 0;
edo2      :  subst([y_xx='diff(y,x,2), y_x='diff(y,x)     ], edo);
edo2(f)   := subst([y_xx= diff(f,x,2), y_x= diff(f,x), y=f], edo);
sol       :       ode2(edo2,y,x);
define(f0(x), rhs(ode2(edo2,y,x)));
define(f3(x), subst([%k1=0, %k2=1], f0(x)));
define(f4(x), subst([%k1=1, %k2=0], f0(x)));
mysymp(a) := scanmap('factor,expand(exponentialize(a)));
define(f1(x), mysymp(f3(x) + %i*f4(x)));
define(f2(x), mysymp(f3(x) - %i*f4(x)));
    f1(x);
    f2(x);
log(f1(1));
log(f2(1));
    f3(x);
    f4(x);

gfactor(D^2 + 4*D + 29);





#####
#
# 2022-2-C2-P2-edolccs
# 2022dec07
#
#####

# «2022-2-C2-P2-edolccs»  (to ".2022-2-C2-P2-edolccs")
# (c2m222p2p 3 "edolccs")
# (c2m222p2a   "edolccs")
# (find-maximanode "diff")
# (find-maximanode "del")
# (find-maximanode "ode2")
# (find-maximanode "ic2")
# (find-maximanode "linsolve")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
edo  : y_xx + y_x - 20*y = 0;
edo2 : subst([y_x='diff(y,x), y_xx='diff(y,x,2)], edo);
f    : rhs(ode2(edo2, y, x));
f_x  : diff(f, x);
fs0  : subst([x=0], [f,f_x]);
subst([%k1=4,%k2=3], fs0);

f1   : subst([%k1=1,%k2=0], f);
f2   : subst([%k1=0,%k2=1], f);
g    : 4*f1 + 3*f2;
g_x  : diff(g, x);
gs0  : subst([x=0], [g,g_x]);

linsolve(fs0-[7,1], [%k1, %k2]);




#####
#
# DtoDx
# 2022dec11
#
#####

# «DtoDx»  (to ".DtoDx")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
eq_1 : (D-2)*(D+3)*f = 0;
eq_2 : expand(eq_1);
eq_3 : subst([f=exp(4*x)], eq_2);

Dx                      :  lambda([ex,n], diff(ex,'x,n));
Dxq                     :  lambda([ex,n],'diff(ex,'x,n));
substDn(ex, newD, n)    := newD(ratcoef(ex, 'D, n), n);
substDs(ex, newD, maxn) := sum(substDn(ex, newD, n), n, 0, maxn);
DtoDxs (ex, maxn)       := substDs(ex, Dx,  maxn);
DtoDxqs(ex, maxn)       := substDs(ex, Dxq, maxn);

DtoDxs (lhs(eq_1), 2);
DtoDxqs(lhs(eq_1), 2);




#####
#
# 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'")




#####
#
# 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]));   /* bad */

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load ("~/luatree/luatree.mac");
expr1 : lambda([], a*b + c/d + e);
expr2 : subst([a=x+y], expr1), simp:false;
expr3 : subst([a=2+3], expr1), simp:false;
luatree_rd(expr1);
luatree_rd(expr2);
luatree_rd(expr3);






#####
#
# luatree-2023
# 2023apr14
#
#####

# «luatree-2023»  (to ".luatree-2023")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
** (find-angg "luatree/luatree.mac")
load       ("~/luatree/luatree.mac");
luatree(a+b);

'integrate(x^2, x);
'integrate(x^2, x, a, b);
 integrate(x^2, x);
 integrate(x^2, x, a, b);

luatree('integrate(x^2, x));
luatree('integrate(x^2, x, a, b));




#####
#
# 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 "Functions and Variables for Lists")
# (find-maximanode "append")
# (find-maximanode "cons")
# (find-maximanode "create_list")
# (find-maximanode "makelist")
# (find-maximanode "args")
# (find-maximanode "map")
# (find-maximanode "maplist")
# (find-maximanode "do")
# (find-maximanode "infolists")
# (find-maximanode "for")

# (find-maximanode "Function and Variable Index" "* for:")
# (find-maximanode "Introduction to Expressions")
# (find-maximanode "Introduction to Lists")
# (find-maximanode "makelist")
# (find-maximanode "create_list")

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



#####
#
# map and maplist
# 2023jul19
#
#####

# «map»  (to ".map")
# «maplist»  (to ".maplist")
# (find-maxima-links "maplist")
# (find-maximanode "map")
# (find-maximanode "maplist")
# (find-maximanode "maperror")
# (find-maximanode "outermap")
# (find-maximanode "listarith")
# (find-maximamsg "48131547 202310 23" "Edrx: makelist(apply(f, [a]), a, as)")
# (find-maximamsg "48448811 202310 24" "MTalon: what is the problem with the simpler")
# (find-maximamsg "48496619 202310 24" "Edrx: map sometimes recurses on trees, not on lists")
# (find-maximamsg "48496623 202310 24" "BWillis: listarith")
# (find-maximamsg "48496643 202310 24" "RFateman")
# (find-maximamsg "48496673 202310 24" "Edrx: ouch")
# (find-maximamsg "48496694 202310 24" "Stavros: (nice examples)")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
map    (lambda([x,y], 10*x+y), [1, 2, 3], [4, 5, 6]);
maplist(lambda([x,y], 10*x+y), [1, 2, 3], [4, 5, 6]);

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
f : lambda([x], x+10);
g : lambda([ab], 10*ab[1]+ab[2]);
f([3,4]);
map(f, [[1,2],[3,4],[5,6]]);  /* [[11, 12], [13, 14], [15, 16]] */
map(g, [[1,2],[3,4],[5,6]]);  /* [12, 34, 56] */
map(f, [[1,2],[3,4],5]);      /* [[11, 12], [13, 14], 15] */
map(g, [[1,2],[3,4],5]);      /* error */
listarith : false;
map(f, [[1,2],[3,4],[5,6]]);  /* [[1,2]+10, [3,4]+10, [5,6]+10] */
map(g, [[1,2],[3,4],[5,6]]);  /* [12, 34, 56] */
map(f, [[1,2],[3,4],5]);      /* [[1,2]+10, [3,4]+10, 15] */
map(g, [[1,2],[3,4],5]);      /* error */


map sometimes recurses on trees, not on lists:

It tries to do the right thing and it usually does, but there are some
cases in which its dtrt-iness is not what I expected... so I thought
that it would be nice to also have some functions with a simpler
logic.





#####
#
# mapconcat
# 2023oct19
#
#####

# «mapconcat»  (to ".mapconcat")
# (find-maximanode "makelist")
# (find-maximanode "map")
# (find-elnode "Mapping Functions" "mapconcat")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
concat_with_sep(a, sep) := concat(a[1],
  apply('concat, makelist(concat(sep,a[i]), i, 2,length(a))))$
mapconcat(f,a,sep) := concat_with_sep(makelist(f(x),x,a), sep);

a : [10, 20, 30, 40];
concat_with_sep(a, "_");
b : [x/y, z*w];
makelist(tex1(x), x, b);
mapconcat('tex1, b, " & ");




#####
#
# nouns-and-verbs
# 2023dec04
#
#####

# «nouns-and-verbs»  (to ".nouns-and-verbs")
# (find-maximanode "Nouns and Verbs")
# (find-maximanode "Nouns and Verbs" "noundisp")
# (find-maximanode "verbify")
# (find-maximanode "nounify")
# (to "changevar")
# (to "depends-email")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
foo (x) := x^2;
foo (42);
'foo (42);
'foo (42), nouns;
declare (bar, noun);
bar (x) := x/17;
bar (52);
bar (52), nouns;
integrate (1/x, x, 1, 42);
'integrate (1/x, x, 1, 42);
ev (%, nouns);

nounify('diff);
verbify('derivative);

noundisp : true;
bar (52);
bar (52), nouns;




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

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




#####
#
# block and local
# 2023jul20
#
#####

# «block»  (to ".block")
# «local»  (to ".local")
# (find-maxima-links "block")
# (find-maximanode "block")
# (find-maximanode ":=")
# (find-maximanode ":=" "local(f)")
# (find-maximanode "local")

# Can I define local functions in blocks like this?
#   block([a, b(x,y):=x*y, c], foo)
# No, but we can use "local"...

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



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

# «subst»  (to ".subst")
# (find-maxima-links "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-angg ".maxima/maxima-init.mac" "traverse")
# (find-angg "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(...)*.




#####
#
# varargs
# 2023sep19
#
#####

# «varargs»  (to ".varargs")
# (find-maximanode ":=")
# (find-maximanode ":=" "When the last or only function argument")
# (find-maximanode "::=")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
foo(a,b,[c]) ::= [a,b,c];
bar(a,b,[c]) :=  [a,b,c];
foo(2,3,4,5);
bar(2,3,4,5);
lambda([a,b,[c]], [a,b,c]) (2,3,4,5);




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

# «substpart»  (to ".substpart")
# (find-maximamsg "37690226 202208 05" "Stavros: substpart('t,y,2)")



#####
#
# 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")
# (find-try-sly-links)


* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load("startsly");
:lisp (describe '$changevar)

:lisp 

# (find-maximamsg "37679359 202207 11" "MTalon: swank ***")

* (sly-connect "localhost" 56789)
** (sly-edit-definition "dim-$matrix")





#####
#
# lisp-describe-tex
# 2023jul15
#
#####

# «lisp-describe-tex»  (to ".lisp-describe-tex")
# (find-maximamsg "37871261 202307 15" "Edrx: :lisp (describe '$tex)")
# (find-maximamsg "37871279 202307 15" "JPellegrini: defmspec")
# (find-maximamsg "37871290 202307 15" "RFateman: tex('integrate(f,x)= ratsimp(integrate(f,x)))")
# (find-maximamsg "37871320 202307 16" "RDodier: DEFMSPEC")

Hi list,

I just realized that I don't know how to go to the source of the "tex"
function... I did this,

  f  : x^3 * sqrt(1 - 4*x^2);
  F1 : 'integrate(f, x);
  F2 : changevar(F1, u=2*x, u, x);
  F3 : ev(F2, 'integrate);
  F4 : expand(F3);
  F5 : subst([u=2*x], F4);
  s  : sqrt(1-4*x^2);
  F6 : expand(F5/s)*s;
  tex(F6, false);

  :lisp (describe '$changevar)
  :lisp (describe '$tex)

and the ":lisp (describe '$changevar)" gave me lots of information:

  MAXIMA::$CHANGEVAR
    [symbol]
  
  $CHANGEVAR names a compiled function:
    Lambda-list: (&REST #:REST-ARG-1)
    Derived type: FUNCTION
    Source file: /home/edrx/bigsrc/maxima/src/outmis.lisp
  
  $CHANGEVAR has a compiler-macro:
    Documentation:
      Compiler-macro to convert calls to $CHANGEVAR to CHANGEVAR-IMPL
    Source file: /home/edrx/bigsrc/maxima/src/outmis.lisp
  
  Symbol-plist:
    SUBC -> NIL
    KIND -> (C)
    IMPL-NAME -> CHANGEVAR-IMPL
    TRANSLATED -> T
    ARG-LIST -> (EXPR TRANS NVAR OVAR)

when I'm connected to Sly I can type `M-.' on the "MAXIMA::$CHANGEVAR"
to go to the definition of changevar, and when I'm not using Sly I can
use the "/home/edrx/bigsrc/maxima/src/outmis.lisp" to go to the file
in which changevar is defined - so all good there. But the output of
":lisp (describe '$tex)" was just this:

  MAXIMA::$TEX
    [symbol]
  
  Symbol-plist:
    MFEXPR* -> #<FUNCTION (LAMBDA (L) :IN "/ho..

Is "tex" a different kind of function? Where can I read more about
that? What is the right way to inspect it?

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




#####
#
# defmspec
# 2023jul15
#
#####

# «defmspec»  (to ".defmspec")
# (find-maximamsg "37871279 202307 15" "JPellegrini: defmspec")
# (find-maximamsg "37871320 202307 16" "RDodier: DEFMSPEC")
# (find-maximamsg "37871361 202307 16" "Edrx: found 153")
# (find-maximagitgrep "grep --color=auto -niRH --null -e defmspec *")
# (find-maximagitgrep "grep --color=auto -niH --null -e defmspec $(find * | grep 'lisp$')")
# (find-maximagitfile "src/mactex.lisp")
# (find-maximagitfile "src/mactex.lisp" "(defmspec $tex(l)")

* (eepitch-sly)
* (eepitch-kill)
* (eepitch-sly)
(apropos 'describe-function-source)
(symbol-function 'describe)
(sb-impl::describe-function-source 'describe nil)
(sb-impl::describe-function-source (symbol-function 'describe) nil)

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
tex(x^2, false);
to_lisp()$
  (describe '$changevar)
  (describe '$tex)
  (symbol-plist '$tex)
  (get '$tex 'mfexpr*)
  (describe (get '$tex 'mfexpr*))
  (to-maxima)

Hi Jeronimo and Robert,

I grepped the sources and (I think that I) found 153 Maxima functions
that are defined using defmspec... it would be good to have a nice way
to jump to their sources, but I confess that I would be happy with a
non-nice way, too. I just found that if I run this,

  to_lisp()$
    (describe '$changevar)
    (describe '$tex)
    (symbol-plist '$tex)
    (get '$tex 'mfexpr*)
    (to-maxima)

the output of the "(get '$tex 'mfexpr*)" is:

  #<FUNCTION (LAMBDA (L) :IN "/home/edrx/bigsrc/maxima/src/mactex.lisp") {52FB567B}>

how do I extract the "/home/edrx/bigsrc/maxima/src/mactex.lisp" from
that?

  Thanks in advance =P,
    Eduardo Ochs




#####
#
# describe-mfexpr
# 2023jul16
#
#####

# «describe-mfexpr»  (to ".describe-mfexpr")
# «fapply»  (to ".fapply")
# (find-maximamsg "37871477 202307 16" "RToy: (describe (get '$tex 'mfexpr*))")
# (find-maximamsg "37871481 202307 16" "Edrx: (defun describe-mfexpr ")
# (find-maximamsg "37871601 202307 17" "BWillis: (do-symbols (s (find-package")
# (find-maximamsg "37871681 202307 17" "DBillinghurst: fapply")
# (find-maximagitfile "src/mopers.lisp")

Hi Raymond! Hey, thanks!
SBCL. I got this a few minutes before your answer:

  to_lisp()$
    (defun describe-mfexpr (symbol)
      (sb-impl::describe-function-source
        (get symbol 'mfexpr*) nil))
    (describe-mfexpr '$tex)
    (to-maxima)

But your suggestions are much better:

  (describe (get '$tex 'mfexpr*))
  (inspect  (get '$tex 'mfexpr*))

  (defun describe-mfexpr (symbol) (describe (get symbol 'mfexpr*)))
  (describe-mfexpr '$tex)

Cheers! =)
  Eduardo


Hi Barton!
That's super neat!!! =)
But I don't have fapply here... can you send your definition?
Here's a version that works, but in which the fapply was
(re)constructed by guesswork:

  to_lisp()$
  
    (defun fapply (op lst) `((,op simp) ,@lst))
  
    (defun $defmspec_list ()
      (let ((lst nil))
        (do-symbols (s (find-package "MAXIMA"))
          (when (get s 'mfexpr*)
            (push s lst)))
        (fapply 'mlist lst)))
  
    (to-maxima)
  
  defmspec_list();
  sort(defmspec_list());

Cheers, thanks, etc =),
  Eduardo




#####
#
# sas
# 2023jul16
#
#####

# «sas»  (to ".sas")
# (find-maximamsg "37871360 202307 16" "Edrx: Here is a _VERY_ bare prototype")
# (find-maximamsg "37871501 202307 16" "RDodier: printf")
# (find-maximamsg "37871523 202307 16" "Edrx: Fantastic, thanks! / step-by-step")

# (find-maximanode "tex1")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
f  : x^3 * sqrt(1 - 4*x^2);
F1 : 'integrate(f, x);
F2 : changevar(F1, u=2*x, u, x);
F3 : rootscontract(F2);
F4 : ev(F3, 'integrate);
F5 : expand(F4);
F6 : subst([u=2*x], F5);
s  : sqrt(1-4*x^2);
F7 : expand(F6/s)*s;

nl : "
"$
tex0(ex) := block([s,len],
  s : tex(ex,false),
  len : slength(s),
  substring(s,3,len-2))$
sa2(name,ex)   := sconcat(nl, "\\sa{", name, "}{", tex0(ex), "}")$
sa2(name,ex)   := printf(false, "~%\\sa{~a}{~a}", name, tex1(ex))$
sa1(nameex)    := apply('sa2, nameex)$
sas([nameexs]) := apply('sconcat, map('sa1, nameexs))$

sas(["F1", F1],
    ["F3", F3],
    ["F7", F7]);



% Usage:
%   \sa{42}{foo bar}
%   \ga{42}
% is roughly equivalent to this,
%   \def\myarg42{foo bar}
%   \myarg42
% but with the "4" and the "2" being treated as letters. 
\def\sa#1#2{\expandafter\def\csname myarg#1\endcsname{#2}}
\def\ga#1{\csname myarg#1\endcsname}

\sa{F1}{\int {x^3\,\sqrt{1-4\,x^2}}{\;dx}}
\sa{F3}{{{\int {u^3\,\sqrt{1-u^2}}{\;du}}\over{16}}}
\sa{F7}{\sqrt{1-4\,x^2}\,\left({{x^4}\over{5}}-{{x^2}\over{60}}-{{1}\over{
 120}}\right)}

$$\begin{array}{l}
  \ga{F1} \\
  = \ga{F3} \\
  = \ga{F7} \\
  \end{array}
$$





#####
#
# 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);
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")
# (to "plotdf")
# (find-maximanode "Functions and Variables for drawdf")
# (find-maximanode "drawdf")




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

# «E-and-Einv»  (to ".E-and-Einv")
# Superseded by: (to "laurent")
#                (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")



#####
#
# Minimal Maxima, by Robert Dodier
# 2023oct10
#
#####

# «minimal-maxima»  (to ".minimal-maxima")
# (find-books "__comp/__comp.el" "maxima-minimal")
# https://maxima.sourceforge.io/documentation.html
# https://maxima.sourceforge.io/docs/tutorial/en/minimal-maxima.pdf
# (code-pdf-page "minimaxima" "$S/https/maxima.sourceforge.io/docs/tutorial/en/minimal-maxima.pdf")
# (code-pdf-text "minimaxima" "$S/https/maxima.sourceforge.io/docs/tutorial/en/minimal-maxima.pdf")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
/* (find-minimaximapage 1 "1       What is Maxima?")
 * (find-minimaximatext 1 "1       What is Maxima?")
*/
V: 4/3 * %pi * r^3;
r: 10;
V;
''V;
''V, numer;

/* (find-minimaximapage 2 "2     Expressions")
 * (find-minimaximatext 2 "2     Expressions")
*/
[a, foo, foo_bar, "Hello, world!", 42, 17.29];

[a + b + c, a * b * c, foo = bar, a*b < c*d];

L:  [a, b,  c, %pi,  %e, 1729,  1/(a*d - b*c)];
L2: [a, b, [c, %pi, [%e, 1729], 1/(a*d - b*c)]];
L   [7];
L2  [3];
M:  matrix ([%pi, 17], [29, %e]);
M2: matrix ([[%pi, 17], a*d - b*c], [matrix ([1, a], [b, 7]), %e]);
M  [2][1];
M2 [2][1];

(a: 42) - (b: 17);
[a, b];
block ([a], a: 42, a^2 - 1600) + block ([b], b: 5, %pi^b);
(if a > 1 then %pi else %e) + (if b < 0 then 1/2 else 1/7);

op (p + q);
op (p + q > p*q);
op (sin (p + q));
op (foo (p, q));
op (foo (p, q) := p - q);
args (p + q);
args (p + q > p*q);
args (sin (p + q));
args (foo (p, q));
args (foo (p, q) := p - q);
atom (p);
atom (p + q);
atom (sin (p + q));

op ('(block ([a], a: 42, a^2 - 1600)));
op ('(if p > q then p else q));
op ('(for x in L do print (x)));
args ('(block ([a], a: 42, a^2 - 1600)));
args ('(if p > q then p else q));
args ('(for x in L do print (x)));

block (a: 1, b: 2, e: 5);
[a, b, c, d, e];

  block (x: %pi, y: %e);
  sin (x + y);
  x > y;
  x!;

  foo (p, q) := p - q;
  p: %phi;
  foo (p, q);
  bar (p, q);

  block (a: 1, b: %pi, c: x + y);
  [a, b, c];
  save ("tmp.save", a, b, c);
  f (a) := a^b;
f (7);
kill (a, b, c);
[a, b, c];

  foo (x, y) := y - x;
  block (a: %e, b: 17);
  foo (a, b);
  foo ('a, 'b);
  'foo (a, b);
  '(foo (a, b));

diff (sin (x), x);
foo (x) := diff (sin (x), x);
foo (x) := ''(diff (sin (x), x));

/* (find-minimaximapage 6 "3      Evaluation")
 * (find-minimaximatext 6 "3      Evaluation")
*/
block (xx: yy, yy: zz);
[xx, yy];
foo (x) := ''x;
foo (xx);
bar (x) := ev (x);
bar (xx);

(%i1)   block (a: aa, b: bb, c: cc);
(%i2)   block (aa: 11, bb: 22, cc: 33);
(%i3)   [a, b, c, aa, bb, cc];
(%i4)   apply (kill, [a, b, c]);
(%i5)   [a, b, c, aa, bb, cc];
(%i6)   kill (a, b, c);
(%i7)   [a, b, c, aa, bb, cc];

(%i1) integrate (sin (a*x), x, 0, %pi);
(%i2) foo (x) := integrate (sin (a*x), x, 0, %pi);
(%i3) define (foo (x), integrate (sin (a*x), x, 0, %pi));

/* (find-minimaximapage 10 "4     Simplification")
 * (find-minimaximatext 10 "4     Simplification")
*/
(%i1) '[1 + 1, x + x, x * x, sin (%pi)];
(%i2) simp: false$
(%i3) block ([x: 1], x + x);

(%i1) (a + b)^2;
(%i2) expand (%);
(%i3) a/b + c/b;
(%i4) ratsimp (%);
(%i5) sin (2*x);
(%i6) trigexpand (%);
(%i7) a * exp (b * %i);
(%i8) demoivre (%);

/* (find-minimaximapage 11 "5     apply, map, and lambda")
 * (find-minimaximatext 11 "5     apply, map, and lambda")
*/
(%i1) apply (sin, [x * %pi]);
(%i2) L: [a, b, c, x, y, z];
(%i3) apply ("+", L);

(%i1) map (foo, [x, y, z]);
(%i2) map ("+", [1, 2, 3], [a, b, c]);
(%i3) map (atom, [a, b, c, a + b, a + b + c]);

(%i1) f: lambda ([x, y], (x + y)*(x - y));
(%i2) f (a, b);
(%i3) apply (f, [p, q]);
(%i4) map (f, [1, 2, 3], [a, b, c]);

/* (find-minimaximapage 12 "6      Built-in object types")
 * (find-minimaximatext 12 "6      Built-in object types")
*/

/* (find-minimaximapage 13 "7      How to...")
 * (find-minimaximatext 13 "7      How to...")
*/
(%i1) foo (x) := diff (sin(x)^2, x);
(%i2) foo (u);
(%i3) foo (1);

(%i1) define (foo (x), diff (sin(x)^2, x));
(%i2) foo (u);
(%i3) foo (1);

/* (find-minimaximapage 14 "7.3    Integrate and differentiate")
 * (find-minimaximatext 14 "7.3    Integrate and differentiate")
*/
(%i1) eq_1: a * x + b * y + z = %pi;
(%i2) eq_2: z - 5*y + x = 0;
(%i3) s: solve ([eq_1, eq_2], [x, z]);
(%i4) length (s);
(%i5) [subst (s[1], eq_1), subst (s[1], eq_2)];
(%i6) ratsimp (%);

(%i1) integrate (1/(1 + x), x, 0, 1);
(%i2) integrate (exp(-u) * sin(u), u, 0, inf);
(%i3) assume (a > 0);
(%i4) integrate (1/(1 + x), x, 0, a);
(%i5) integrate (exp(-a*u) * sin(a*u), u, 0, inf);
(%i6) integrate (exp (sin (t)), t, 0, %pi);
(%i7) 'integrate (exp(-u) * sin(u), u, 0, inf);

(%i1) diff (sin (y*x));
(%i2) diff (sin (y*x), x);
(%i3) diff (sin (y*x), y);
(%i4) diff (sin (y*x), x, 2);
(%i5) 'diff (sin (y*x), x, 2);

/* (find-minimaximapage 16 "7.4     Make a plot")
 * (find-minimaximatext 16 "7.4     Make a plot")
*/
(%i1) plot2d (exp(-u) * sin(u), [u, 0, 2*%pi]);
(%i2) plot2d ([exp(-u), exp(-u) * sin(u)], [u, 0, 2*%pi]);
(%i3) xx: makelist (i/2.5, i, 1, 10);
(%i4) yy: map (lambda ([x], exp(-x) * sin(x)), xx);
(%i5) plot2d ([discrete, xx, yy]);
(%i6) plot2d ([discrete, xx, yy], [gnuplot_curve_styles, ["with points"]]);

/* (find-minimaximapage 16 "7.5     Save and load a file")
 * (find-minimaximatext 16 "7.5     Save and load a file")
*/
(%i1) a: foo - bar;
(%i2) b: foo^2 * bar;
(%i3) save ("my.session", a, b);
(%i4) save ("my.session", all);

(%i1) load ("my.session");

(%i5) a;
(%i6) b;

/* (find-minimaximapage 17 "8     Maxima programming")
 * (find-minimaximatext 17 "8     Maxima programming")
*/
(%i1) (x: 42, y: 1729, z: foo*bar);
(%i2) f (x, y) := x*y*z;
(%i3) f (aa, bb);
(%i4) lambda ([x, z], (x - z)/y);
(%i5) apply (%, [uu, vv]);
(%i6) block ([y, z], y: 65536, [x, y, z]);

(%i1)   foo (y) := x - y;
(%i2)   x: 1729;
(%i3)   foo (%pi);
(%i4)   bar (x) := foo (%e);
(%i5)   bar (42);

(%i1) (aa + bb)^2;
(%i2) :lisp $%

(%i1) :lisp (defun $foo (a b) `((mplus) ((mtimes) ,a ,b) $%pi))

(%i1) (p: x + y, q: x - y);
(%i2) foo (p, q);

(%i1) :lisp (defmspec $bar (e) (let ((a (cdr e))) `((mplus) ((mtimes) ,@a)
(%i1) bar (p, q);
(%i2) bar (''p, ''q);
(%i1) blurf (x) := x^2;
(%i2) :lisp (displa (mfuncall '$blurf '((mplus) $grotz $mumble)))




#####
#
# 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-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 1)
;; (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




#####
#
# Book - Classical Differential Geometry with Maxima
# 2023apr01
#
#####

# «diffgeo-of-surfaces»  (to ".diffgeo-of-surfaces")
# https://georgeweigt.github.io/Lindner/DiffGeo-of-Surfaces-Maxima.pdf
# https://georgeweigt.github.io/Lindner/
# https://georgeweigt.github.io/
# https://sourceforge.net/p/maxima/mailman/message/37798754/
# https://sourceforge.net/p/maxima/mailman/message/37798791/
# (find-maximamsg "37798754 202304 01" "WLindner: Classical Differential Geometry with Maxima")
# (find-maximamsg "37798791 202304 01" "RDodier: Classical Differential Geometry with Maxima")

https://independent.academia.edu/LindnerDrWolfgang



#####
#
# diffeqs-maxima
# 2023jun23
#
#####

# «diffeqs-maxima»  (to ".diffeqs-maxima")
# (find-books "__comp/__comp.el" "maxima-diffeqs")
# [Maxima-discuss] Introductory Differential Equations with Maxima
# https://mail.google.com/mail/u/0/#inbox/FMfcgzGsnLFHrMPlXVPMxJvpSzgVPZlW
# https://sourceforge.net/p/maxima/mailman/maxima-discuss/thread/3001e919-eed6-6d42-3c1b-cfcac190592a%40gmail.com/#msg37860621
# https://lindnerdrwg.github.io/DifferentialEquationsMaxima.pdf
# https://lindnerdrwg.github.io/
# (find-maximamsg "37860110 202306 20" "WLindner: Introductory Differential Equations with Maxima")
# (find-maximamsg "37860338 202306 20" "RFateman: Introductory DE")



#####
#
# Justin R. Smith: "Adventures with Free Mathematical Software"
# 2023apr08
#
#####

# «advfree»  (to ".advfree")
# (find-books "__comp/__comp.el" "maxima-advfree")
# (find-maximamsg "37801439 202304 08" "JSmith: New book on Maxima Applications (wxMaxima)")
# (find-advfreepage (+ 16 16) "we need if-statements")
# (find-advfreetext (+ 16 16) "we need if-statements")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
f(x) := if (x<-1) then 0
        else if (x<0) then 1
        else if (x<=1) then x^2
        else 0;
plot2d('f(x), [x,-5,5]);




#####
#
# 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")
# (find-gitk  "~/bigsrc/maxima/")

* (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.47.0
git checkout master

cd ~/bigsrc/maxima/
git clean -dfx
git reset --hard
git pull
find * | sort                 > .files
find * | sort | grep '.lisp$' > .files.lisp
find * | sort | grep '.mac$'  > .files.mac
./bootstrap               |& tee ob
./configure --help        |& tee och
./configure --enable-sbcl |& tee oc
make                      |& tee om
sudo make install         |& tee omi

# (find-maximagitfile "omi")
make check


make                |& tee om
make                |& tee omh

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/")




#####
#
# maxima-git-5.47.0 (for maxima-index-html.lisp)
# 2023oct08
#
#####

# «maxima-git-5.47.0»  (to ".maxima-git-5.47.0")
# (to "web-docs")
# (code-c-d "maxima5470" "~/bigsrc/maxima-git-5.47.0/")
# (find-maxima5470file "")
# (find-maxima5470file "doc/info/maxima-index-html.lisp")
# (find-maxima5470file "doc/info/maxima-index-html.lisp" "mode_declare")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
rm -Rf ~/bigsrc/maxima-git-5.47.0/
mkdir  ~/bigsrc/maxima-git-5.47.0/
cd     ~/bigsrc/maxima-git-5.47.0/
git clone ~/bigsrc/maxima .

git checkout 5.47.0
git clean -dfx
git reset --hard

./bootstrap         |& tee ob
./configure         |& tee oc
make                |& tee om

cp -v doc/info/maxima-index-html.lisp ~/blogme3/







#####
#
# 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")




#####
#
# 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 "listify")
# (find-maximanode "makelist")
# (find-maximanode "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-maximanode "for")
# (find-maximanode "do")
# (find-maximanode "display")
# (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;
seq(a, b) := makelist(i, i, a, b);
for m in seq(1,42) do display('f(m) = factor(f(m)))$

* (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);

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,42) do display('f(m) = factor(f(m)))$




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

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

? makelist

* (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);

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
f(a) := a+x;
makelist(f(i),i,1,5);  /* good */
makelist(f(x),x,1,5);  /* bad  */




#####
#
# align_eqs
# 2023oct10
#
#####

# «align_eqs»  (to ".align_eqs")
# (find-angg ".maxima/maxima-init.mac" "align_eqs")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
a : [11, 22, 33, 44, 55, 66];
align_eqs(as) :=
  apply('matrix,
        append([[as[1], "=", as[2]]],
               makelist(["", "=", as[i]], i, 3, length(as))));
align_eqs(a);






#####
#
# sum
# 2023sep27
#
#####

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




#####
#
# 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")
# (find-maximanode "contour_levels")
# (to "qdraw-imp")

* (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]);

load_qdraw();
qdraw(imp([z=0, z=1, z=-1, z=-2], 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-maximanode "Functions and Variables for Simplification" "example (radcan)")
*;; (find-maximanode "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-maximanode "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-maximanode "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")
# (find-anggfile "GNUPLOT/piramide-2.dem" "find-bgprocess")
# (find-LATEXfile "2021-2-C3-diag-nums.gnuplot" "eepitch-shell")

* (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





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

# «kill»       (to ".kill")
# «variables»  (to ".variables")
# (find-maximanode "kill")
# (find-maxima-links "kill")
# (find-maximagitgrep "grep --color=auto -niH --null -e kill src/*.lisp")
# (find-maximagitfile "src/db.lisp" "(defun kill ")
# (find-maximagitfile "src/trans1.lisp" "(def%tr $kill ")
# (find-maximagitfile "src/suprv1.lisp" "(defmspec $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);



#####
#
# display2d_unicode
# 2023dec30
#
#####

# «display2d_unicode»  (to ".display2d_unicode")
# (find-maximamsg "58718036 202312 30" "RDodier: Unicode pretty printer display merged into master")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
display2d_unicode : true;
'integrate(x^2, x);
'sum(x^2, x, 0, 4);
display2d_unicode : false;
'integrate(x^2, x);
'sum(x^2, x, 0, 4);




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

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

* (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
# 2023jul25
#
#####

# «texput»  (to ".texput")
# (to "operators")
# (find-maximanode "texput")
# (find-maximanode "prefix")
# (find-maximanode "infix")
# (find-maximanode "nofix")
# (find-maximanode "nary")
# (find-maximanode "matchfix")
# (find-maxima-links "texput")
# (find-maxima-links "matrix")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
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>>);




#####
#
# texput for "/" and "matrix"
# 2023jul25
#
#####

# «texput-frac»    (to ".texput-frac")
# «texput-matrix»  (to ".texput-matrix")
# (find-maximamsg "37875726 202307 25" "Edrx: I know two basic formats")
# (find-maximamsg "37875807 202307 25" "LButler: texput(matrix, ...)")
# (find-maximamsg "37888856 202308 29" "Edrx: texput, \\frac, and diff")
# (find-maximamsg "37889136 202308 29" "LButler: simp:false")
# (find-maxima-links "matrix")
# (find-maxima-links "texput")
# (find-maximagitfile "src/mactex.lisp" "(defun tex-mquotient ")
# (find-maximagitfile "src/mactex.lisp" "(defun tex-matrix ")
# (find-maximagitfile "src/mactex.lisp" "(defmfun $texput ")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
A : matrix([10,20],[30,40]);
B : x/y;
:lisp #$A$
:lisp #$B$

properties(matrix);
:lisp (describe '$matrix)
:lisp (symbol-plist '$matrix)
properties("/");
:lisp (describe '$/)
:lisp (symbol-plist '$/)

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
texput("*"," ")$
tex(a*b);
texput("/", lambda([r],
    block([n,d],
          n:num(r),
          d:denom(r),
          printf(false,"\\frac{~a}{~a}",tex1(n),tex1(d)))));
tex(a/b);
tex(a/(b+c/d));
tex(a/(b+c/d+x*y/cos(t)));
texput(matrix, lambda([expr],
    printf(false,
           "\\begin{bmatrix} ~{~{~a~^&~}~^\\\\~} \\end{bmatrix}",
           map(lambda([row],map(lambda([element],tex1(element)),row)),args(expr)))))$
tex(matrix([a,b],[c,d]));
tex(matrix([a,b,c/d],[c,d,a*b],[u,v,sin(t)]));
texput(%i,"\\mathrm{i}");
texput(%e,"\\mathrm{e}");
tex(%i+%e);



# (find-maximamsg "37876999 202307 28" "RDodier: TEX, TEXWORD, and TEXSYM")





#####
#
# 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 "display")
# (find-maximanode "display2d")
# (find-maximanode "get")
# (find-maximanode "mapatom")
# (find-maximanode "alt_display_output_type")
# (find-maximanode "define_alt_display")
# (find-maximanode "info_display")
# (find-maximanode "set_alt_display")
# (find-maximanode "tex_display")
# (find-maximanode "twod_display")
# (find-maxima-links "displa")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load("alt-display.mac")$
? set_alt_display
? define_alt_display
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);

fundef(displa);
grind(fundef(displa));

ochs_display(a*b);
twod_display(a*b);
grind(fundef(ochs_display));
properties(displa);

macroexpand(ochs_display(a*b));
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;


* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load("alt-display.mac")$
? displa
?? displa
fundef(displa);
properties(displa);
:lisp (describe '$displa)
:lisp (symbol-plist '$displa)
:lisp (get '$displa 'lineinfo)
set_alt_display(2, lambda([form], tex(?caddr(form))))$
integrate(exp(-t^2),t,0,inf);



#####
#
# barematrix
# 2023oct20
#
#####

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




#####
#
# 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-maximagitfile "interfaces/emacs/emaxima/emaxima.sty")
# (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 "~/usrc/emaximaintro/")
rm -Rv ~/usrc/emaximaintro/
mkdir  ~/usrc/emaximaintro/
cd     ~/usrc/emaximaintro/
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-c-d      "emaximaintro" "~/usrc/emaximaintro/")
# (code-pdf-page "emaximaintro" "~/usrc/emaximaintro/EMaximaIntro.pdf")
# (code-pdf-text "emaximaintro" "~/usrc/emaximaintro/EMaximaIntro.pdf")
# (find-emaximaintrofile "")
# (find-emaximaintrofile "emaxima.sty")
# (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")
# https://mail.google.com/mail/u/0/#sent/KtbxLzGPpHrHZjRTJnHfpfxTcWlKbxMSNB
# (find-maximamsg "37405293 202112 22" "Edrx 1: Saving a \begin{maximasession} ...")
# (find-maximamsg "37405510 202112 22" "LButler 2")
# (find-maximamsg "37405573 202112 22" "LButler 3")
# (find-maximamsg "37405584 202112 22" "Edrx 4")
# (find-maximamsg "37405793 202112 22" "LButler 5")

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")



#####
#
# emaxima.lisp
# 2023jul23
#
#####

# «emaxima.lisp»  (to ".emaxima.lisp")
# (find-maximagitfile "interfaces/emacs/emaxima/emaxima.lisp")
# (find-maximagitfile "interfaces/emacs/emaxima/emaxima.lisp" "(if (eq $display2d '$emaxima)")

% (setq eepitch-preprocess-regexp "^")
% (setq eepitch-preprocess-regexp "^%T ")
%
%T * (eepitch-maxima)
%T * (eepitch-kill)
%T * (eepitch-maxima)
%T load("emaxima.lisp");
%T load("/usr/share/emacs/site-lisp/maxima/emaxima.lisp")$
%T display2d:'emaxima$




#####
#
# Maxima2.lua - an alternative to emaxima.sty
# 2023sep30
#
#####

# «Maxima2.lua»  (to ".Maxima2.lua")
# (find-angg "LUA/Maxima2.lua")
# (find-TH "eev-maxima" "embedding-in-LaTeX")






#####
#
# 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-angg ".maxima/maxima-init.mac")
# (find-angg ".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 and load-path
# 2023jul19
#
#####

# «load»       (to ".load")
# «load-path»  (to ".load-path")
# (find-maximanode "Files")
# (find-maximanode "load_pathname")
# (find-maximanode "load")
# (find-maximanode "file_search")
# (find-maximanode "file_search_maxima")
# (find-maximanode "file_search_lisp")
# (find-maximanode "file_search_demo")
# (find-maximanode "file_search_usage")
# (find-maximanode "file_search_tests")
# (find-maximamsg "37874366 202307 23" "RToy: The current search paths are now:")
# (find-angg "luatree/luatree.mac")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
file_search_maxima;
file_search_lisp;
file_search_demo;
file_search_usage;
file_search_tests;
:lisp (describe '$load)

# (find-es "lisp" "sharpsign-P")
# (hyperspec-lookup-reader-macro "#P")
# (find-clhsdoc "Body/02_dhn" "Sharpsign P")

<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]);






#####
#
# runge-kutta
# 2023dec03
#
#####

# «runge-kutta»  (to ".runge-kutta")
# (find-maximamsg "58347826 202312 03" "JVillate")
# (find-maximamsg "58347743 202312 03" "KarenKharatian")
# (find-maximanode "rk")
# (find-maximanode "point_type")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
[sigma, rho, beta]: [10, 28, 8/3]$
eq: [sigma*(y-x), x*(rho-z)-y, x*y-beta*z]$
sol: rk(eq, [x, y, z], [1, 0, 0], [t, 0, 50, 1/100])$
len: length(sol)$
x: makelist(sol[k][2], k, len)$
y: makelist(sol[k][3], k, len)$
z: makelist(sol[k][4], k, len)$
draw3d(points_joined=true, point_type=-1, points(x, y, z), proportional_axes=xyz)$

sol;




#####
#
# draw3d-points
# 2024feb27
#
#####

# «draw3d-points»  (to ".draw3d-points")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
seqn(a,b,n)       := makelist(a + (b-a)*k/n, k, 0, n);
mydraw3d([lists]) := apply('draw3d, apply('append, lists))$
mytranspose(m)    := args(transpose(apply('matrix, m)));
mypoints(pts)     := apply('points, mytranspose(pts));

mypoints([[2,3,4],[5,6,7]]);

f0(th) := [cos(th), sin(th), 0];
f1(th) := [cos(th), sin(th), cos(th)^2];

mydraw3d([points_joined=true,
          point_type=-1,
          mypoints(makelist(f0(th), th, seqn(0, 2*%pi, 100))),
          mypoints(makelist(f1(th), th, seqn(0, 2*%pi, 100)))
         ],
         makelist(mypoints([f0(th), f1(th)]), th, seqn(0, 2*%pi, 100))
        );




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

# «online-manual»  (to ".online-manual")
# (find-es "texinfo" "makeinfo-html")
# (find-maximanode "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-maximanode "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: noun/verb")
# (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")




#####
#
# stringproc
# 2023jul15
#
#####

# «stringproc»  (to ".stringproc")
# (find-maximanode "stringproc-pkg")
# (find-sh "locate maxima | grep stringproc")
# (find-maximagitfile "share/stringproc/")
# (find-maximagitfile "share/stringproc/printf.lisp")
# (find-maximagitfile "share/stringproc/stringproc.mac")




#####
#
# 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);




#####
#
# lisp-trace
# 2023jul17
#
#####

# «lisp-trace»  (to ".lisp-trace")
# (find-maximamsg "37872177 202307 17" "RFateman: :lisp (trace")
# (find-es "lisp" "trace")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
v: rat((x+y+5)^2);
:lisp (trace newvar pplus ptimes pexpt)
v: rat((x+y+5)^2);
?print(v);



#####
#
# 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 '$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")
# (to "ratpow")
# (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 ...)")
# (find-maximagitfile "src/hayat.lisp")
# (find-maximagitfile "src/mhayat.lisp")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
** ? taylor
** ?? taylor
:lisp (describe '$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 "taytorat")
# (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)
          )
    );




#####
#
# del
# 2023sep28
#
#####

# «del»  (to ".del")
# (find-maximanode "del")
# (find-maximanode "diff")
# (find-maximanode "derivdegree")
# (find-maximanode "depends")
# (find-maximanode "depends" "remove (<f>, dependency)")
# (find-maximanode "derivabbrev")
# (find-maximanode "gradef")
# (find-mbefile "calc1code.txt" "6.1.2  The Total Differential")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
o1 : diff(x^2);
o2 : diff(x^2*y^3);
o3 : diff(a*x^2*y^3);
subst(del(x) = dx, o1);
subst([del(x)= dx, del(y) = dy, del(a) = da],o3 );
declare (a, constant)$
diff(a*x^2*y^3);
declare([b,c],constant)$
diff( a*x^3 + b*x^2 + c*x );
properties(a);
propvars(constant);
kill(a,b,c)$
propvars(constant);
diff(a*x);
         diff([sin(x),cos(x),tan(x) ], x);
    map('diff,[sin(x),cos(x),tan(x) ] );
o : map('diff,[sin(x),cos(x),tan(x) ] )/del(x);
map('diff,o)/del(x);



#####
#
# impdiff
# 2024apr11
#
#####

# «impdiff»  (to ".impdiff")
# (find-maximanode "Functions and Variables for impdiff")
# (find-sh "locate impdiff")
# (find-maximagitfile "")
# (find-maximagitsh "find *")
# (find-maximagitfile "share/contrib/impdiff.mac")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load (impdiff);
f [0, 0] : x^2 + y^3 - z^4 = 0;
implicit_derivative (f, [x, y], [2, 3], z);
display_array (f);





#####
#
# Implicit differentiation of the Folium of Descartes (with pn1.mac)
# 2023sep28
#
#####

# «implicit-diff»  (to ".implicit-diff")
# «pn1-folium»     (to ".pn1-folium")
# (to "qdraw-folium")
# (find-angg "MAXIMA/pn1.mac")
# (find-angg "MAXIMA/pn1.mac" "folium-depvars")
# (find-angg "MAXIMA/pn1.mac" "folium-depvars-and-ds")
# (find-books "__analysis/__analysis.el" "stewart" "157" "2.6 Implicit Differentiation")
# (find-books "__analysis/__analysis.el" "stewart-pt" "188" "3.5 Derivação Implícita")
# https://en.wikipedia.org/wiki/Folium_of_Descartes

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load("~/MAXIMA/pn1.mac")$
gradef(y(x), y_x(x));   /* these tests don't use gradef(y,x,y_x) */

/* The folium of Descartes */
e1 : x^3 + y^3 = 6*x*y;

/* Test 1: differentiate the folium implicitly,
 * using dependent variables only
*/
               pnex(e1);
          diff(pnex(e1), x);
e2 : pnsh(diff(pnex(e1), x));
e3 : solve(e2, y_x)[1];

/* Test 2: differentiate the folium implicitly,
 * using dependent variables and differentials
*/
          diff(e1);
e2 : pnsh(diff(e1));
            solve(e2, dy)[1];
     factor(solve(e2, dy)[1]);
e3 : factor(solve(e2, dy)[1]) / dx;

plotdf(rhs(e3))$
display2d : false$
e3;




#####
#
# pn1-email
# 2023oct01
#
#####

# «pn1-email»  (to ".pn1-email")
# (find-maximamsg "39730760 202309 30" "Edrx: is(equal(op(f(x,y)), 'del)) -> unknown")
# (find-maximamsg "39730815 202309 30" "RDodier: maybe you can say")
# (find-maximamsg "39794921 202310 01" "Edrx: The code of my current prototype is below")
# http://anggtwu.net/eev-maxima.html#physicists-notation
# (find-angg "MAXIMA/pn1.mac")

Hi all,

thanks for all the responses! Robert, right now what I am trying to do
is to write functions to let me handle shorthands like y=y(x) and
z=z(x,y) as "real shorthands", that can be expanded and
shortened/contracted...

For example, if both "y=y(x)" and "z=z(x,y)" are active in the list of
shorthands then "z" expands to "z=z(x,y(x))", but if only "z=z(x,y)" is
active then "z" expands to "z=z(x,y)".

The code of my current prototype is below, followed by some tests.
About tellsimp and friends: I know vaguely what they do and I'm trying
to understand some examples - and I don't have any idea if they could
be useful in this case or not...

I tried to explain the rationale for the code below here:
  http://anggtwu.net/eev-maxima.html#physicists-notation

Cheers, and please send pointers and suggestions...
  Eduardo Ochs
  http://anggtwu.net/eev-maxima.html

--snip--snip--

...
See: (find-angg "MAXIMA/pn1.mac")







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

# «gradef»  (to ".gradef")
# (find-maximanode "derivabbrev")
# (find-maximanode "depends")
# (find-maximanode "express")
# (find-maximanode "gradef")
# (find-maximanode "gradefs")
# (find-mbe-links)
# (find-mbe-links 6 6 "6.1.3 Controlling the Form of a Derivative with gradef")
# (find-mbe06page   6 "6.1.3 Controlling the Form of a Derivative with gradef")
# (find-mbe06text   6 "6.1.3 Controlling the Form of a Derivative with gradef")
# (find-mbegrep "grep --color=auto -nH --null -e gradef *.txt")
# (find-mbefile "calc1code.txt" "6.1.3 Controlling the Form of a Derivative with gradef(..)")

# (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-fline "/home/angg_slow_html/eev-videos/" "2022jan19-gradef.mp4")
# (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);



#####
#
# gradefs on variables
# 2023sep30
#
#####

# «gradef-var»  (to ".gradef-var")
# (find-maximanode "gradef")
# (find-maximanode "gradef" "gradef (<a>, <x>, <expr>)")
# (find-maximanode "remove")
# (find-maximanode "depends")
# (find-mbefile "calc1code.txt" "6.1.3 Controlling the Form of a Derivative with gradef(..)")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
e1 : x^3 + y^3 = 6*x*y;
gradef(y, x, y_x);
diff(e1, x);
diff(e1);

gradef(y, z, y_z);
diff(e1, x);
diff(e1);
diff(y);




#####
#
# gradef-remove
# 2023sep30
#
#####

# «gradef-remove»  (to ".gradef-remove")
# (find-maximanode "gradef")
# (find-maximanode "remove")
# (find-maximanode "kill")
# (find-maximanode "depends")
# (find-maximanode "properties")
# (find-maximanode "put")
# (find-maximanode "rem")
# (find-maximanode "get")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
gradef(z(x,y), z_x(x,y), z_y(x,y));
gradef(w, x, w_x);
gradef(w, y, w_y);
gradefs;
printprops([z], gradef);
printprops([w], atomgrad);
props;
properties(z);
properties(w);

gradefs;
printprops([z], gradef);
kill(z);
printprops([z], gradef);
gradefs;

dependencies;
printprops([w], atomgrad);
kill(w);
printprops([w], atomgrad);
dependencies;

map('kill, [a,b]);



#####
#
# 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]);




#####
#
# plot2d-style-lines
# 2024apr25
#
#####

# «plot2d-style-lines»  (to ".plot2d-style-lines")
# (find-maximamsg "58763485 202404 22" "JVillate: plot2d ... [style,[lines,1,2]]")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
plot2d ([sin(x), sin(2*x), sin(3*x)], [x, 0, 10]);
plot2d ([sin(x), sin(2*x), sin(3*x)], [x, 0, 10], [style,[lines,1,2]]);




#####
#
# plot2d-stair
# 2024apr25
#
#####

# «plot2d-stair»  (to ".plot2d-stair")
# https://mail.google.com/mail/u/0/#search/maxima/FMfcgzGxSbqkpzvrwXGwlGLswXZfXlrR
# (find-maximamsg "58757280 202404 06" "")
# (find-maximamsg "58757286 202404 06" "")
# (find-maximamsg "58757296 202404 06" "")
# (find-maximamsg "58757304 202404 06" "")
# (find-maximamsg "58757313 202404 06" "")
# (find-maximamsg "58757315 202404 06" "")
# (find-maximamsg "58757317 202404 06" "")
# (find-maximamsg "58757319 202404 06" "")
# (find-maximamsg "58757331 202404 06" "")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
f(x):=1/(1+x)$
E(f,x,n,a,b):=block(if x=b then return(f(b))
    else
    for i:1 thru n do if (x < a+i*(b-a)/n) then return(f(a+(i-1)/n))
);
g(x):=E(f,x,10,0,1)$
plot2d([f,g], [x,0,1]);







#####
#
# plotdf
# 2023sep30
#
#####

# «plotdf»  (to ".plotdf")
# (find-maximanode "plotdf")
# (to "direction-fields")
# (find-maximagitfile "share/dynamics/plotdf.lisp")
# (find-maximagitfile "interfaces/xmaxima/Tkmaxima/Plotdf.tcl")

# (find-sh "locate maxima | grep tcl")
# (find-sh "locate maxima | grep plotdf")
# (find-maximagitfile "interfaces/xmaxima/Tkmaxima/")
# (find-maximagitfile "interfaces/xmaxima/Tkmaxima/NPlot3d.tcl")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
plotdf(exp(-x)+y)$
plotdf(exp(-x)+y,[trajectory_at,2,-0.1])$

plotdf(x-y^2,
   [xfun,"sqrt(x);-sqrt(x)"],
   [trajectory_at,-1,3],
   [direction,forward],
   [y,-5,5], [x,-4,16])$   /* broken: "input file has syntax errors" */

plotdf([v,-k*z/m], [z,v], [parameters,"m=2,k=2"],
     [sliders,"m=1:5"], [trajectory_at,6,0])$

plotdf([y,-(k*x + c*y + b*x^3)/m],
       [parameters,"k=-1,m=1.0,c=0,b=1"],
       [sliders,"k=-2:2,m=-1:1"],[tstep,0.1])$

plotdf([w,-g*sin(a)/l - b*w/m/l], [a,w],
  [parameters,"g=9.8,l=0.5,m=0.3,b=0.05"],
  [trajectory_at,1.05,-9],[tstep,0.01],
  [a,-10,2], [w,-14,14], [direction,forward],
  [nsteps,300], [sliders,"m=0.1:1"], [versus_t,1])$




#####
#
# 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)
together(f) := ratsimp(f);
apart(f)    := partfrac(f,x);

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]);



#####
#
# division of polinomials (with remainder)
# 2023nov06
#
#####

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

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
p1 : x^4 + 1;
p2 : x - 1;
[q,r] : divide(p1, p2, x);
matrix([p1, p2],[r, q]);



#####
#
# 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")
# (to "eigenvalues")
# (find-maximanode "float")
# (find-maximanode "fpprec")
# (find-maximanode "fpprintprec")
# (find-maximabookpage (+ 1 34) "Numerical Output - FLOAT and NUMER")
# (find-maximabooktext (+ 1 34) "Numerical Output - FLOAT and NUMER")
# (find-maximamsg "37781666 202302 22" "RToy: foo,numer, ev(foo,numer), float(foo)")
# (find-maximamsg "37781642 202302 22" "BWillis: block([numer : true], foo)")

* (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);
c : sqrt(2);
float(c);
fpprintprec : 4;
float(c);



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

# «mnewton»  (to ".mnewton")
# (find-maximanode "mnewton")
# (find-maximanode "find_root")
# (find-maximanode "Functions and Variables for mnewton")

* (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]);





#####
#
# find_root and quad_qag
# 2023oct23
#
#####

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

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
f(x)  := 4 - (x-2)^2;
define(g(x), sqrt(1 + diff(f(x), x)^2));
[a,b] : [0,3];
o     : quad_qag(g(x),     x, a, b, 1);
yg    : o[1]/(b-a);
xg    : find_root(g(x)=yg, x, 0, 2);
g(xg) * (b-a);




#####
#
# 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, [x,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);



#####
#
# 2023-2-C2-P1
# 2023oct10
#
#####

# «2023-2-C2-P1»  (to ".2023-2-C2-P1")
# (find-es "maxima" "subst-trig-questions")
# (to "changevar-trig-2")
# (c2m232p1p 6 "questao-2-gab")
# (c2m232p1a   "questao-2-gab")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
/* Questao 1 */
assume(c>0);
ex0   : 'integrate(s^3*sqrt(1-s^2)^3, s);
ex1   : changevar(ex0, s=sin(th), th, s);
  ex1 : map(rootscontract, ex1);
  ex1 : subst([sqrt(1-sin(th)^2)=cos(th)], ex1);
ex2   : changevar(ex1, c=cos(th), c, th);
ex3   : ev(ex2, 'integrate);
ex4   : subst([c=cos(th)], ex3);
ex5   : subst([th=asin(s)], ex4);
ex0 = ex5;
diff(ex5, s);
linel : 100;
align_eqs([ex0, ex1, ex2, ex3, ex4, ex5]);

/* Questao 2
 * (find-angg "MAXIMA/3-changevars1.mac")
 * (find-angg "MAXIMA/3-changevars1.mac" "2023-2-C2-P1")
*/
load("~/MAXIMA/3-changevars1.mac");
load("~/MAXIMA/barematrix1.mac");
f1(y) := sin(y) / 4;
f2(y) := y^4;
f3(y) := log(y);
substs : foo('[[f,f1],[g,f2],[h,f3]]);
OO : subst(substs, MM2);
bare(OO);

/* Questao 3 */
f  : (3*x + 2)/((x+4)*(x-5));
F0 : 'integrate(f, x);
F1 :  integrate(f, x);
F0 = F1;



#####
#
# 2023-2-C2-P2
# 2023dec07
#
#####

# «2023-2-C2-P2»  (to ".2023-2-C2-P2")
# (c2m232p2p 4 "questao-1-gab")
# (c2m232p2a   "questao-1-gab")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
/* Questao 1 */

e1 : 'diff(y,x) = 1/(-2*(y-1));
e2 :  ode2(e1, y, x);
e2 : -ode2(e1, y, x);
e2 : -ode2(e1, y, x) + 1;
e3 : subst([%c=C+1], e2);
e3 : subst([%c=-C+1], e2);
sols : solve(e3, y);
define(fpos(x), rhs(sols[2]));
define(fneg(x), rhs(sols[1]));

e4 : y = fpos(x);
e5 : subst([x=3,y=2], e4);
     solve(e5, C);
e6 : solve(e5, C)[1];
e7 : subst(e6, e4);

e4 : y = fneg(x);
e5 : subst([x=2,y=0], e4);
     solve(e5, C);
e6 : solve(e5, C)[1];
e7 : subst(e6, e4);


* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
/* Questao 2 */
y_x  : 'diff(y,x);
y_xx : 'diff(y,x,2);
e1 : y_xx + 3*y_x -10*y = 0;
e2 : y_xx + 3*y_x -10*y = sin(2*x);
ode2(e1,y,x);
define(f3(x), subst([%k1=aa, %k2=bb], rhs(ode2(e1,y,x))));
define(f3_x(x), diff(f3(x), x)); 
e3 : [f3(0)=3, f3_x(0)=-1];
e4 : solve(e3, [aa,bb])[1];
define(f4(x), subst(e4, f3(x)));

e5 : ode2(e2,y,x);
e6 : subst([%k1=0, %k2=0], e5);
define(f4(x), rhs(e6));

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
/* Questao 2 por s e c */
D_degree (f) := hipow(f, D);
D_to_Dx  (f) := sum(diff(ratcoef(f,D,k),x,k), k, 0, D_degree(f));
ss : sin(2*x);
cc : cos(2*x);
  abbrev(f) := subst([ss=s, cc=c], f);
unabbrev(f) := subst([s=ss, c=cc], f);
             abbrev(diff(unabbrev(s), x));
             abbrev(diff(unabbrev(c), x));
gradef(s, x, abbrev(diff(unabbrev(s), x)));
gradef(c, x, abbrev(diff(unabbrev(c), x)));

L : D^2 + 3*D - 10;
        L*s;
D_to_Dx(L*s);

f1  : A*c + B*s;
      D_to_Dx(L*f1);
e1  : D_to_Dx(L*f1) = s;
ec  : subst([c=1,s=0], e1);
es  : subst([c=0,s=1], e1);
ecs : [ec, es];
      solve(ecs, [A,B]);
eAB : solve(ecs, [A,B])[1];
     subst(eAB, e1);
f2 : subst(eAB, f1);
       D_to_Dx(L*f2);
expand(D_to_Dx(L*f2));

/* (find-angg "MAXIMA/LI_split1.mac")
*/
load("~/MAXIMA/LI_split1.mac");
LI_matreq (e1, [s,c], [A,B]);
LI_matreq3(e1, [s,c], [A,B]);



* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
/* Questao 3 */
y_x  : 'diff(y,x);
e1 : y_x - 2*y/x = 3*x;
ode2(e1, y, x);

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
/* Questao 4 */
load("~/MAXIMA/mac1.mac");
mac1 : mac(1,2,-3,4,5,...);
mac2 : 1/mac1;
mac_ify(mac2);




#####
#
# 2023-2-C2-VR
# 2023dec12
#
#####

# «2023-2-C2-VR»  (to ".2023-2-C2-VR")

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



#####
#
# 2023-2-C2-VS
# 2023dec22
#
#####

# «2023-2-C2-VS»  (to ".2023-2-C2-VS")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
display2d_unicode : false;
display2d_unicode : true;

assume(c>0);
I_x    : 'integrate(x^3*sqrt(1-25*x^2), x);
I_s    : changevar(I_x, s=5*x, s, x);
  I_s  : map(rootscontract, I_s);
I_th   : changevar(I_s, s=sin(th), th, s);
  I_th : map(rootscontract, I_th);
  I_th : subst([sqrt(1-sin(th)^2)=cos(th)], I_th);
I_c    : changevar(I_th, c=cos(th), c, th);
F_c    : ev(I_c, 'integrate);
F_th   : subst([c=cos(th)], F_c);
F_s    : subst([th=asin(s)], F_th);
F_x    : subst([s=5*x], F_s);
I_x = F_x;
diff(I_x, x);
diff(I_s, s);

align_eqs([I_x, I_s, I_th, I_c, F_c, F_th, I_s, F_x]);

R : sqrt(1-25*x^2);
F_x / R;
expand(F_x / R);
factor(expand(F_x / R));




#####
#
# 2023-2, Cálculo 2: como eu expliquei o laurent2
# 2023nov10
#
#####

# «2023-2-C2-laurent2»  (to ".2023-2-C2-laurent2")
# (find-angg "MAXIMA/laurent2.mac")
# (c2m232ncp 5 "maxima")
# (c2m232nca   "maxima")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load("~/MAXIMA/laurent2.mac");
texput(th, "\\theta ");
load("/usr/share/emacs/site-lisp/maxima/emaxima.lisp")$
load("~/MAXIMA/barematrix1.lisp")$
display2d:'emaxima$
linenum:0;
p : 4*x^2 + 5*x^1 + 6*x^0 + 7*x^-1 + 8*x^-2;
q : 4*E^2 + 5*E^1 + 6*E^0 + 7*E^-1;
lpdot(p, x);
lpdot(q, E);
f :  cos(th)^3;
g : ccos(th)^3;
lpe(f);
lpe(g);

                       exponentialize(f);
                expand(exponentialize(f));
       demoivre(expand(exponentialize(f)));
expand(demoivre(expand(exponentialize(f))));
     subst(th_E,expand(exponentialize(f)));
     subst(th_E,expand(exponentialize(g)));

lpE(f);
lpE(g);
lpE(  ccos(th)^3);
lpE(  ccos(th));
lpE(3*ccos(th));
lpE(ccos(3*th));
lpE(ccos(3*th)+3*ccos(th));

lpE( ccos(th)   );
lpE( ccos(th)^2 );
lpE( ccos(th)^3 );
lpE( csin(th)     );
lpE( csin(th)^2   );
lpE( csin(th)^3   );
lpE( csin(2*th)   );
lpE( csin(2*th)^2 );



#####
#
# 2023-2-edos-lineares
# 2023nov14
#
#####

# «2023-2-edos-lineares»  (to ".2023-2-edos-lineares")
# (c2m232edolsp 5 "maxima")
# (c2m232edolsa   "maxima")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
e1 : 'diff(y,x) + 1/x * y = 2;
e2 : ode2(e1,y,x);
     solve(e2, %c);
e3 : solve(e2, %c)[1];
e4 : subst([x=2,y=5], e2);
     solve(e4, %c);
e4 : solve(e4, %c)[1];
                  subst(e4,e2);
define(f2(x), rhs(subst(e4,e2)));
e5 : subst([y=f2(x)], e1);
ev(e5, diff);




#####
#
# 2023-2-gradefs
# 2023nov10
#
#####

# «2023-2-gradefs»  (to ".2023-2-gradefs")
# (c3m232dicasp1p 3 "gradefs")
# (c3m232dicasp1a   "gradefs")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
columnvector(x) := transpose(matrix(x))$
vtolist(v)      := transpose(v)[1]$
mytexputs([ps]) := map(lambda([p],apply('texput,p)), ps);
mytexputs([z_x,"z_x"], [z_xx,"z_{xx}"], [z_xy,"z_{xy}"]);
mytexputs([z_y,"z_y"], [z_yx,"z_{yx}"], [z_yy,"z_{yy}"]);
mytexputs([x_t,"x_t"], [x_tt,"x_{tt}"]);
mytexputs([y_t,"y_t"], [y_tt,"y_{tt}"]);

load("/usr/share/emacs/site-lisp/maxima/emaxima.lisp")$
load("~/MAXIMA/barematrix1.lisp")$
display2d:'emaxima$
linenum:0;
diff(z);
diff(z, t);
diff(z, t, 2);

gradef(z, x, z_x)$
gradef(z, y, z_y)$
gradef(x, t, x_t)$
gradef(y, t, y_t)$
gradef(z_x, x, z_xx)$
gradef(z_x, y, z_xy)$
gradef(z_y, x, z_xy)$
gradef(z_y, y, z_yy)$
gradef(x_t, t, x_tt)$
gradef(y_t, t, y_tt)$
       diff(z);
       diff(z, t);
       diff(z, t, 2);
expand(diff(z, t, 2));

gradef(x_t, t, 0);
gradef(y_t, t, 0);
       diff(z, t, 2);
expand(diff(z, t, 2));

M    : matrix([z_xx,z_xy], [z_xy,z_yy]);
xy_t : columnvector([x_t,y_t]);
ab   : columnvector([a,b]);
cd   : columnvector([c,d]);
ab * cd;
ab . cd;
 M . xy_t;
(M . xy_t) . xy_t;
diff(z, t, 2);



#####
#
# 2023-2-DDs
# 2023nov16
#
#####

# «2023-2-DDs»  (to ".2023-2-DDs")
# (c3m232dicasp1p 6 "diferencas")
# (c3m232dicasp1a   "diferencas")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
columnvector(x):=transpose(matrix(x))$
DD(L)  := makelist(L[i+1]-L[i], i, 1, length(L)-1);
DDs(L) := columnvector([L, DD(L), DD(DD(L)), DD(DD(DD(L)))]);
A : [1,10,100,1000,10000];
DDs(A);
A : [0,3,6,9,12,15,18,21];
DDs(A);
A : [1,4,9,16,25,36,49];
DDs(A);
      DD(makelist(a + b*n,                 n, 1, 10));
   DD(DD(makelist(a + b*n + c*n^2,         n, 1, 10)));
DD(DD(DD(makelist(a + b*n + c*n^2 + d*n^3, n, 1, 10))));



#####
#
# 2023-2-EDOLCCs
# 2023nov18
#
#####

# «2023-2-EDOLCCs»  (to ".2023-2-EDOLCCs")
# (find-anggfile "MAXIMA/laurent2.mac")
# (find-books "__analysis/__analysis.el" "boyce-diprima" "133" "3.5 Nonhomogeneous Equations")
# (find-books "__analysis/__analysis.el" "zill-cullen" "125" "4.1.3 Nonhomogeneous Equations")
# (find-books "__analysis/__analysis.el" "lebl" "104" "2.5 Nonhomogeneous equations")
# (c2m232cdp 2 "links")
# (c2m232cda   "links")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
L : (D-2)*(D-3);
L : (D-4)*(D+1);
g : 0;
Ldegree()   := hipow(expand(L), D);
Lcoef  (k)  := ratcoef(L, D, k);
Ldiffy ()   := sum(Lcoef(k)*'diff(y,x,k), k, 0, Ldegree());
Ldiff  (f)  := sum(Lcoef(k)* diff(f,x,k), k, 0, Ldegree());
Lf0    ()   := rhs(ode2(Ldiffy()=g, y, x));
Lf1    ()   := subst([%k1=1, %k2=0, %k3=0], Lf0());
Lf2    ()   := subst([%k1=0, %k2=1, %k3=0], Lf0());
Lf3    ()   := subst([%k1=0, %k2=0, %k3=1], Lf0());

Ldiffy();
Ldiff (x^2);
Ldiff (exp(2*x));
Lf0();
Lf1();
Lf2();
Lf3();

Ldiff (exp(2*x));
g  : 3*exp(2*x);
Lf3();

Ldiff (sin(x));
Ldiff (cos(x));
g : 2*sin(x);
Lf3();

Ldiff (1);
Ldiff (x);
Ldiff (x^2);
g : 4*x^2 - 1;
Lf3();




L . f;

define(f0(x), Lf0());
solve([f0(0)=2, f0(1)=3], [%k1, %k2]);

ode2(Ldiffy()=0, y, x);
ode2(Ldiffy()=x, y, x);
ode2(Ldiffy()=x^2, y, x);
ode2(Ldiffy()=x^3, y, x);
ode2(Ldiffy()=exp(x), y, x);



#####
#
# 2023-2-C3-P1
# 2023nov22
#
#####

# «2023-2-C3-P1»  (to ".2023-2-C3-P1")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
** (find-es  "maxima" "2022-2-C3-P1")
** (find-angg "MAXIMA/matrixify.mac")
load       ("~/MAXIMA/matrixify.mac");
u   : y - 2*x;
v   : x+y;
matrixify (-2,-2, 2,2, u);
matrixify (-2,-2, 2,2, v);
matrixify (-2,-2, 2,2, u*v);

F   : 2*x^2 + -x*y - y^2;

F   : 2*x^2 + -x*y - y^2;
F_x : diff(F,x);
F_y : diff(F,y);
matrixify (-2,-2, 2,2, y-2*x);
matrixify (-2,-2, 2,2, x+y);
matrixify (-2,-2, 2,2, F);
matrixify (-2,-2, 2,2, [F_x, F_y]);

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
** (find-es  "maxima" "2022-2-C3-P1")
** (find-angg "MAXIMA/matrixify.mac")
load       ("~/MAXIMA/matrixify.mac");
u : x + y - 5;
v : y - 2;
s : 3 + u*v;
p : 4 + u^2 + v^2;
[x0,y0] : [3,2];
matrixify (x0-1,y0-1, x0+1,y0+1, [x,y]);
matrixify (x0-1,y0-1, x0+1,y0+1, u);
matrixify (x0-1,y0-1, x0+1,y0+1, v);
matrixify (x0-1,y0-1, x0+1,y0+1, s);
matrixify (x0-1,y0-1, x0+1,y0+1, p);

hessian(s, [x,y]);
hessian(p, [x,y]);

FNW : matrixify (0,0, 10,10, 6);
FN  : matrixify (0,0, 10,10, 12-2*x);
FW  : matrixify (0,0, 10,10, y-2);
FC  : matrixify (0,0, 10,10, y-x+1);
FR  : matrixify (0,0, 10,10, 0);

/* (6,5,0) + t(-1,1,2) */





#####
#
# Figuras sobre raio de convergência
# 2023nov27
#
#####

# «2023-2-raio-conv»  (to ".2023-2-raio-conv")
# (to "qdraw-taylor")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
derivsn(n,f)  := makelist(diff(f,x,k), k, 0,n)$
derivs0n(n,f) := subst([x=0], derivsn(n,f))$
taylorize(L)  := makelist(L[j]*x^(j-1)/(j-1)!, j, 1,length(L))$
taylorize(L)  := sum     (L[j]*x^(j-1)/(j-1)!, j, 1,length(L))$

load_qdraw();
myqdraw([lists]) := apply('qdraw, apply('append, lists))$
colors : [black, red, orange, forest_green, blue, dark_violet]$

derivsn (7, sin(x));
derivs0n(7, sin(x));
taylorize(derivs0n(7, sin(x)));
Tn(n, f) := taylorize(derivs0n(n, f))
Tn(4, sin(x));

Tn3(N, f, cc) := ex1(Tn(N, f), x, -r,r, lc(colors[cc]))$
Tn3(4, sin(x), 2);
Tns(N, f) := makelist(Tn3(NN, f, NN), NN, 1, N);
Tns(4, sin(x));

r : 2*%pi;
r : 4*%pi;
myqdraw([xr(-r,r),yr(-r,r)], Tns(6, 1/(x-1)));



myexs_1(ii)      := ex1(fs[ii], x, -r,r, lc(colors[ii]))$


myexs()          := makelist(myexs_1(ii), ii, length(fs))$

myexs();





derivsf0     : subst([x=0], derivsf);
derivsfk(k)  := diff(f,x,k);
derivsf0k(k) := subst([x=0], derivsfk(k));
termk(k)     := derivsf0k(k) * x^k/k!;
newf(K)      := sum(termk(k), k, 0, K);
newf(7);






#####
#
# 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")
# (to "2022-2-C3-P2-Q4")
# (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




#####
#
# 2022-2-C3-P2-Q4
# 2022dec13
#
#####

# «2022-2-C3-P2-Q4»  (to ".2022-2-C3-P2-Q4")
# (c3m222p2p 3 "questao-4")
# (c3m222p2a   "questao-4")
# (to "plotting-contours-2")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
H(x,y) := x*y;
E(x,y) := x^2 + 4*y^2;
Hlevel(z)      := implicit(H(x,y)=z, x,-4,4, y,-4,4);
Elevel(z)      := implicit(E(x,y)=z, x,-4,4, y,-4,4);
Hclevel(clr,z) := [color=clr, Hlevel(z)];
Eclevel(clr,z) := [color=clr, Elevel(z)];

clevels        :  [Eclevel(black, 16),
                   Hclevel(red,   -4),
                   Hclevel(orange,-3),
                   Hclevel(green,  0),
                   Hclevel(blue,   3),
                   Hclevel(violet, 4)
                  ];
draw2d(clevels);



#####
#
# 2022-2-C3-VR
# 2022dec16
#
#####

# «2022-2-C3-VR»  (to ".2022-2-C3-VR")
# (c3m222vrp 2 "questao-1")
# (c3m222vra   "questao-1")
# (find-angg "MAXIMA/findchanges1.mac")
# (to "binsearch")
# (find-maximanode "append")
# (find-maximanode "push")
# (find-maximanode "makelist")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
C(x,y)       := x^2 + y^2;
Cth(th)      := [2*cos(th), 2*sin(th)];
insideC(x,y) := is(C(x,y) <= 4);

H(x,y)        := x*y;
Htp(t)        := [t, 1/t];
Htn(t)        := [t, -1/t];
insideH(x,y)  := -1 <= H(x,y) and H(x,y) <= 1;

insideCH(x,y) := insideC(x,y) and insideH(x,y);

seqn(a,b,n) := makelist(a + (b-a)*k/n, k, 0, n);
seq (a,b)   := makelist(i, i, a, b);

binsearch(f,a,b,n) :=
  block([va,vb,c,vc],
        [va,vb] : [f(a),f(b)],
        for i: 1 thru n do
          (c  : (a+b)/2,
           vc : f(c),
           if equal(va,vc) then [a,va]:[c,vc] else [b,vb]:[c,vc]),
        c)$

binsearchins(Fboo,F,points,n, tag) :=
  block([npoints,results,fboo,a,b,xa,ya,xb,yb,c],
        npoints : length(points),
        results : [],
        fboo(t) := Fboo(F(t)[1], F(t)[2]),
        for i: 1 thru npoints-1 do
          (a : points[i],
           b : points[i+1],
           if not equal(fboo(a), fboo(b)) then
	     (c : float(binsearch(fboo,a,b,n)),
              push([F(c), c, tag], results)
             )
          ),
        reverse(results))$

binsearchins(insideH, Cth, seqn( 0,2*%pi,20), 20, "Cth");
binsearchins(insideC, Htp, seqn( 0.1, 10,20), 20, "Htp");
binsearchins(insideC, Htp, seqn(-0.1,-10,20), 20, "Htp");
binsearchins(insideC, Htn, seqn( 0.1, 10,20), 20, "Htn");
binsearchins(insideC, Htn, seqn(-0.1,-10,20), 20, "Htn");

xytfs : float([
[[1.931851704273888, 0.5176378972738332], 0.2617992879306086, Cth], 
[[1.931852068901062, 0.5176379786516739], 1.931852068901062, Htp],
[[0.5176378393173217, 1.931852588904308], 0.5176378393173217, Htp], 
[[0.5176378972738334, 1.931851704273888], 1.308997038864288, Cth], 
[[- 0.5176378972738331, 1.931851704273888], 1.832595614725505, Cth], 
[[- 0.5176378393173217, 1.931852588904308], - 0.5176378393173217, Htn],
[[- 1.931852068901062, 0.5176379786516739], - 1.931852068901062, Htn],
[[- 1.931851704273888, 0.5176378972738335], 2.879793365659185, Cth], 
[[- 1.931851704273888, - 0.517637897273833], 3.403391941520402, Cth], 
[[- 1.931852068901062, - 0.5176379786516739], - 1.931852068901062, Htp],
[[- 0.5176378393173217, - 1.931852588904308], - 0.5176378393173217, Htp],
[[- 0.5176378972738345, - 1.931851704273887], 4.450589692454081, Cth], 
[[0.5176378972738338, - 1.931851704273888], 4.974188268315299, Cth], 
[[0.5176378393173217, - 1.931852588904308], 0.5176378393173217, Htn], 
[[1.931852068901062, - 0.5176379786516739], 1.931852068901062, Htn],
[[1.931851704273887, - 0.5176378972738346], 6.021386019248977, Cth],
[[1.931851704273888, 0.5176378972738332], 0.2617992879306086 + 2*%pi, Cth]
])$

myangle(x, y) := imagpart(float(log(x + y*%i)));
atf(xytf) := [myangle(xytf[1][1], xytf[1][1]), xytf[2], xytf[3]];
atf(xytfs[1]);
atfs : makelist(atf(xytf), xytf, xytfs);

myparametric(i) :=
  block([a1,a2,t1,t2,f],
        a1 : xytfs[i],
        a2 : xytfs[i+1],
        t1 : a1[2],
        t2 : a2[2],
        f  : a1[3],
        parametric(f(t)[1], f(t)[2], t, min(t1,t2), max(t1,t2)))$

myparametric(2);

draw(gr2d(
  myparametric(2),
  myparametric(4),
  myparametric(6),
  myparametric(8),
  myparametric(10),
  myparametric(12),
  myparametric(14),
  myparametric(16)
));

C6 : [myparametric(2),
      myparametric(4),
      myparametric(6),
      myparametric(8),
      myparametric(10),
      myparametric(12),
      myparametric(14),
      myparametric(16)
  ]$

uv0 : [1,0];
uu  : [1,1];
vv  : [-1,1];
M(k,t) := uv0 + t*uu + (k/t)*vv;
Mk(t)  := M(k,t);
k : 2;
Mk(1);
Mk(2);
Mk(0.5);

binsearchins(insideCH, Mk, seqn(0.1,-10,20), 20, "Foo");





# (find-maximanode "parametric")







#####
#
# myangle
# 2022dec17
#
#####

# «myangle»  (to ".myangle")
# (find-maximanode "realpart")
# (find-maximanode "imagpart")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
myangle(x, y) := imagpart(float(log(x + y*%i)));
myangle(4, 0);
myangle(0, 4);
myangle(-4, 0);
myangle(0, -4);










#####
#
# 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 "apply1")
# (find-maximanode "applyb1")
# (find-maximanode "apply2")
# (find-maximanode "matchdeclare")
# (find-maximanode "Introduction to Rules and Patterns")
# (find-maximanode "let")
# (find-maximanode "letsimp")

# (find-angg "MAXIMA/step_by_step.mac")
# (find-maximanode "sublist")



#####
#
# step_by_step.mac
# 2023jul16
#
#####

# «step_by_step.mac»  (to ".step_by_step.mac")
# (find-maximamsg "37871522 202307 16" "RDodier: step_by_step.mac")
# (find-angg "MAXIMA/step_by_step.mac")




#####
#
# 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")



#####
#
# 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/")




#####
#
# Tutorial by Boris Gaertner - has a section about lexical vs dynamic
# 2023feb03
#
#####

# «gaertner-tutorial»  (to ".gaertner-tutorial")
# «gaertner-dynamic»  (to ".gaertner-dynamic")
# https://maxima.sourceforge.io/docs/tutorial/en/gaertner-tutorial-revision/Contents.htm
# https://maxima.sourceforge.io/docs/tutorial/en/gaertner-tutorial-revision/Pages/Programming0003.htm
  ^ lexical vs dynamic

# (find-wgetrecursive-links "https://maxima.sourceforge.io/docs/tutorial/en/gaertner-tutorial-revision/Contents.htm")


Which opinions?
This looks impeccably written to me:

  Maxima was written when Lisp was a dynamically scoped language. Huge
  parts of Maxima still require the availability of dynamic scope
  rules.

and I have to confess that I loved the "Regrettably, scope rules were
later complicated as a consequence of...", and it made me laugh a lot.
DISCLAIMER: I am the author of an Emacs package that needs dynamic
binding in several places, and I think that the right way to teach
Lisp to beginner is to start with dynamic binding and present lexical
binding later.

  Cheers =),
    Eduardo Ochs
    http://anggtwu.net/#eev
    http://anggtwu.net/eev-maxima.html
    http://anggtwu.net/eev-intros/find-lexical-intro.html






#####
#
# 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)));



#####
#
# Definitions by cases
# 2022nov29
#
#####

# «by-cases»  (to ".by-cases")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
F1 : x;
F2 : 2*x;
f1 : diff(F1,x);
f2 : diff(F2,x);
F  : if x<2 then F1 else F2;
f  : if x<2 then diff(F1,x) else diff(F2,x);
f  : if x<2 then f1 else f2;
plot2d(F, [x, 0, 4]);
plot2d(f, [x, 0, 4]);




#####
#
# relational
# 2022dec07
#
#####

# «relational»  (to ".relational")
# (find-maximanode "Relational operators")
# (find-maximanode "is")
# (find-maximanode "if")
# (find-maximanode "and")
# (find-maximanode "and" "forces evaluation")




#####
#
# binsearch
# 2022dec07
#
#####

# «binsearch»  (to ".binsearch")
# (find-maximanode "block")
# (find-maximanode "for")
# (find-maximanode "if")
# (find-maximanode "for" "newton (f, x)")
# (find-maximanode "find_root")
# (find-maximagitsh "find * | sort | grep mac")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
binsearch(f,a,b,n) :=
  block([va,vb,c,vc],
        [va,vb] : [f(a),f(b)],
        for i: 1 thru n do
          (c  : (a+b)/2,
           vc : f(c),
           if equal(va,vc) then [a,va]:[c,vc] else [b,vb]:[c,vc]),
        c);

f : lambda([x], is(x< 666));
f : lambda([x], is(x<=666));
float(binsearch(f, 0, 1024, 12));




#####
#
# doc/info/figures/
# 2022dec07
#
#####

# «doc-info-figures»  (to ".doc-info-figures")
# (find-maximagitfile "doc/info/figures/")
# (find-maximagitfile "doc/info/figures/README" "ADDING FIGURES TO THE MANUAL")
# (find-maximagitsh "find * | sort | grep texi")
# (find-maximagitfile "doc/info/Plotting.texi")
# (find-maximanode "Plotting")



#####
#
# columnvector
# 2022dec09
#
#####

# «columnvector»  (to ".columnvector")
# (find-maximanode "covect")
# (find-maximanode "columnvector")
# (find-maximagitfile "share/matrix/eigen.mac" "columnvector(x):=")
# (find-angg "MAXIMA/crossproduct1.mac")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
A : matrix([a,b],[c,d]);
v : matrix([2], [3]);
load ("eigen");
v : columnvector([2, 3]);
v : covect      ([2, 3]);
colv([entries]) := covect(entries);
colv(2, 3);
                                  map("[", [2,3]);
                   apply('matrix, map("[", [2,3]));
colv([entries]) := apply('matrix, map("[", entries));
colv(2, 3);
A . v;

B : matrix([x,y],[z,w]);
A . B;
A . v;

A . colv(10, 20);


w : covect([2, 3]);
A . w;
transpose(v) . w;
dotproduct(v, w);

op(v);
args(v);
op([2,3]);

"["(2, 3);
list(2, 3);
array(2, 3);
? apply
apply("[", 2, 3);
apply("+", [2, 3]);

dotproduct([2,3], [x,y]);
matrix(2, 3);

colv([entries]) := covect(entries);
colv(2, 3, 4);



#####
#
# mycolumnvector and myrowvector
# 2023aug20
#
#####

# «mycolumnvector»  (to ".mycolumnvector")
# «myrowvector»     (to ".myrowvector")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
/* column vectors: */
V([entries]) := transpose(matrix(entries))$
getx(v)      := v[1][1]$
gety(v)      := v[2][1]$
getxy(v)     := [getx(v),gety(v)]$

   V(2,3);
10*V(2,3) + V(4,5);
getx(V(2, 3));
gety(V(2, 3));

/* row vectors: */
V([entries]) := matrix(entries);
getx(v)      := v[1][1]$
gety(v)      := v[1][2]$
getxy(v)     := [getx(v),gety(v)]$

   V(2,3);
10*V(2,3) + V(4,5);
getx(V(2, 3));
gety(V(2, 3));

P    : V(cos(t), sin(t));
Pt   : diff(P, t);
Ptt  : diff(P, t, 2);
P01  : [P, Pt];
P012 : [P, Pt, Ptt];
P012(t1) := subst(['t=t1], P012);
P012(0);
P012(%pi/8);




#####
#
# basis
# 2023oct07
#
#####

# «basis»  (to ".basis")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
columnvector(x):=transpose(matrix(x))$
basisvector(size,pos) := columnvector(makelist(if is(i=pos) then 1 else 0, i, size));
basisvector(size,pos) := columnvector(makelist(if is(i=pos) then 1 else 0, i, 1,size));
basisvector(5, 2); 




#####
#
# crossproduct
# 2023jul06
#
#####

# «crossproduct»  (to ".crossproduct")
# (find-angg "MAXIMA/crossproduct1.mac")
# (to "2023-1-C4-P2")
# (find-maximanode "determinant")
# (find-maximanode "matrix")
# (find-maximanode "matrixmap")
# (find-maximanode "map")
# (find-maximanode "fullmap")
# (find-maximanode "fullmapl")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
columnvector(x) := transpose(matrix(x));
ii : columnvector([1,0,0]);
jj : columnvector([0,1,0]);
kk : columnvector([0,0,1]);
getx(v) := v[1][1];
gety(v) := v[2][1];
getz(v) := v[3][1];
vtolist(v) := [getx(v), gety(v), getz(v)];
precrossproduct(v, w) := matrix([ii, jj, kk], vtolist(v), vtolist(w));
crossproduct   (v, w) := determinant(precrossproduct(v, w));
div(F) := getx(diff(F, x)) + gety(diff(F, y)) + getz(diff(F, z));

vtolist(ii);
abc : columnvector([a, b, c]);
def : columnvector([d, e, f]);
precrossproduct(abc, def);
   crossproduct(abc, def);



#####
#
# coeff
# 2022dec09
#
#####

# «coeff»  (to ".coeff")
# (find-maximanode "dotproduct")
# (find-maximanode "matrix")
# (find-maximanode ":=")
# (find-maximanode ":=" "variable number of")




#####
#
# ratcoef
# 2022dec09
#
#####

# «ratcoef»  (to ".ratcoef")
# «polytoabcdef»  (to ".polytoabcdef")
# (find-maximanode "coeff")
# (find-maximanode "ratcoef")
# (find-maximanode "lambda")
# (find-maximanode "local")
# (find-angg "MAXIMA/laurent1.mac")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
abcdeftopoly :
  lambda([abcdef],
         local(a,b,c,d,e,f,poly),
         [a,b,c,d,e,f] : abcdef,
         poly : a
              + b*x + c*y
              + d*x^2 + e*x*y + f*y^2,
         poly);

polytoabcdef :
  lambda([poly],
         local(polycoef,a,b,c,d,e,f),
         polycoef(px,py) := ratcoef(ratcoef(poly, 'x, px), 'y, py),
         a : polycoef(0,0),
         b : polycoef(1,0),
         c : polycoef(0,1),
         d : polycoef(2,0),
         e : polycoef(1,1),
         f : polycoef(0,2),
         [a,b,c,d,e,f]);

p : abcdeftopoly([2,3,4,5,6,7]);
polytoabcdef(p);




#####
#
# Sistemas de coordenadas: (x,y) <-> (u,v)
# 2022dec11
#
#####

# «sistemas-de-coordenadas»  (to ".sistemas-de-coordenadas")
# (mpgp 18 "sistemas-de-coordenadas")
# (mpga    "sistemas-de-coordenadas")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
uu : [2,0];
vv : [-1,1];
x(u, v) := u*uu[1] + v*vv[1];
y(u, v) := u*uu[2] + v*vv[2];
eq_x : x = x(u,v);
eq_y : y = y(u,v);
[eq_u,eq_v] : linsolve([eq_x, eq_y], [x,y]);
define(u(x,y), rhs(eq_u));
define(v(x,y), rhs(eq_v));
x(2,0);



#####
#
# coord-systems-2: (x,y) <-> (u,v)
# 2023oct05
#
#####

# «coord-systems-2»  (to ".coord-systems-2")
# (find-angg "MAXIMA/crossproduct1.mac")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
columnvector(x) := transpose(matrix(x));
vtolist(v)      := transpose(v)[1];

M : matrix([a, b], [c, d]);
A  : columnvector([e, f]);

                   A + M . columnvector([x, y]);
[uu, vv] : vtolist(A + M . columnvector([x, y]));

               [u=uu, v=vv];
eqs : linsolve([u=uu, v=vv], [x,y]);
           subst(eqs, [x,y]);
[xx, yy] : subst(eqs, [x,y]);

define(u(x,y), uu);
define(v(x,y), vv);
define(x(u,v), xx);
define(y(u,v), yy);

AA : [u(0,0),v(0,0)];
[u(1,0), v(1,0)];
[u(1,0), v(1,0)] - AA;
[u(0,1), v(0,1)] - AA;



#####
#
# coord-systems-3
# 2023oct07
#
#####

# «coord-systems-3»  (to ".coord-systems-3")
# «coefmatrix»       (to ".coefmatrix")
# «augcoefmatrix»    (to ".augcoefmatrix")
# (find-maximanode      "coefmatrix")
# (find-maxima-links    "coefmatrix")
# (find-maximanode   "augcoefmatrix")
# (find-maxima-links "augcoefmatrix")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
columnvector(x) := transpose(matrix(x));
vtolist(v)      := transpose(v)[1];
Mtolist(M)      := args(M);
lastrow(M)      := M[length(M)];
lastcolumn(M)   := transpose(lastrow(transpose(M)));
M  : matrix([a, b], [c, d]);
A  : columnvector([e, f]);
xy : columnvector([x, y]);
uv : columnvector([u, v]);
    M.xy;
A + M.xy;
A + M.xy = uv;
eqs : maplist("=", vtolist(M.xy), vtolist(uv));
              coefmatrix(eqs, [x, y]);
           augcoefmatrix(eqs, [x, y]);
lastcolumn(augcoefmatrix(eqs, [x, y]));

eqs2 : A+M.xy=uv;
map('vtolist, eqs2);  /* bad */
map("=", lhs(eqs2), rhs(eqs2));
map("=", vtolist(lhs(eqs2)), vtolist(rhs(eqs2)));

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
? augcoefmatrix
? coefmatrix
m: [2*x - (a - 1)*y = 5*b, c + b*y + a*x = 0];
augcoefmatrix (m, [x, y]);
m: [2*x-(a-1)*y+5*b = 0, b*y+a*x = 3];
coefmatrix(m, [x,y]);




#####
#
# Superseded by LI_Axb, below
# 2023dec08
#
#####

# «LI_split»  (to ".LI_split")
# (find-angg "MAXIMA/LI_split1.mac")
# (to "linsolve_ify")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
LI_delta(i,j)       := if is(ii=k) then 1 else 0;
LI_s(vs, k)         := makelist(vs[ii]=LI_delta(ii,k), ii,1,length(vs));
LI_subst(ex, vs, k) := subst(LI_s(vs, k), ex);
LI_split(ex, vs)    := makelist(LI_subst(ex, vs, k), k,1,length(vs));

LI_split(A*s+B*c=C*s, [s,c]);




#####
#
# linsolve_ify
# 2024apr22
#
#####

# «linsolve_ify»  (to ".linsolve_ify")
# (to "basis")
# (to "LI_split")
# (find-angg "MAXIMA/LI_Axb1.mac")

# (find-strang4page (+ 10 1) "1.1 Introduction")
# (find-strang4page (+ 10 2) "Ax = b")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
mycolumnvector([entries])   := transpose(matrix(entries))$
LI_2to1              (eqs2) := makelist(lhs(eqs2[ii])-rhs(eqs2[ii]), ii,1,length(eqs2))$
LI_delta              (i,j) := if is(i=j) then 1 else 0$
LI_makesubsts    (vars,pos) := makelist(vars[ii]=LI_delta(ii,pos),   ii,1,length(vars))$
LI_b0       (eqs1,vars)     := -subst(LI_makesubsts(vars,0), eqs1)$
LI_b        (eqs1,vars)     := apply('mycolumnvector, LI_b0(eqs1,vars));
LI_eqs1b    (eqs1,vars)     := eqs1 + LI_b0(eqs1,vars);
LI_A00      (eqs1,vars,pos) := subst(LI_makesubsts(vars,pos), LI_eqs1b(eqs1,vars))$
LI_A0       (eqs1,vars)     := makelist(LI_A00(eqs1,vars,ii),        ii,1,length(vars))$
LI_A        (eqs1,vars)     := apply('matrix, LI_A0(eqs1, vars));
LI_x             (vars)     := apply('mycolumnvector, vars);
LI_Axb      (eqs1,vars)     := [LI_A(eqs1,vars), LI_x(vars), LI_b(eqs1,vars)];

myvars  : [x,y];
myeqs2  : [1*x + 2*y = 3, 4*x + 5*y = 6];
myeqs1  :   LI_2to1(myeqs2);
mycolumnvector(2,3,4);
LI_makesubsts          (myvars, 2);
LI_makesubsts          (myvars, 1);
LI_makesubsts          (myvars, 0);
LI_b0          (myeqs1, myvars);
LI_b           (myeqs1, myvars);
LI_eqs1b       (myeqs1, myvars);
LI_A00         (myeqs1, myvars, 1);
LI_A00         (myeqs1, myvars, 2);
LI_A0          (myeqs1, myvars);
LI_A           (myeqs1, myvars);
LI_x                   (myvars);
LI_Axb         (myeqs1, myvars);




#####
#
# Treat some variables as linearly independent vectors, and split (something)
# 2024apr22
#
#####

# «LI_Axb»  (to ".LI_Axb")
# (to "linsolve_ify")
# (find-angg "MAXIMA/LI_Axb1.mac")

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





#####
#
# format.mac
# 2023jan19
#
#####

# «format.mac»  (to ".format.mac")
# (find-maximamsg "37765019 202301 18" "RDodier: Bruce Miller")
# (find-maximamsg "37764945 202301 18" "Stavros: pickapart")
# (find-maximamsg "37764915 202301 18" "CSangwin: format.mac")
# (find-maximamsg "37764894 202301 18" "RFateman: spreadsheet / Bruce Miller")
# https://nvlpubs.nist.gov/nistpubs/Legacy/IR/nistir5618.pdf An Expression Formatter for MACSYMA
# https://sourceforge.net/p/maxima/code/ci/master/tree/share/contrib/format/
# (find-maximagitfile "share/contrib/format/")
# (find-maximagitsh "find * | sort | grep format")
# (find-sh "locate format.mac")





#####
#
# How to solve a differential equation defined by differentials?
# 2023feb02
#
#####

# «ODEs-by-differentials»  (to ".ODEs-by-differentials")
# (find-maximamsg "37772984 202302 02" "TFinke: ODEs defined by differentials?")
# (find-maximamsg "37773011 202302 02" "MTalon: answer")
MMenzel:
https://www.acadpubl.eu/jsi/2017-117-11-14/articles/14/18.pdf

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
declare([cp, cv], constant);      /* heat capacity         */
u : cv * T;                       /* spec. internal energy */
h : cp * T;                       /* spec. enthalpy        */
U : m * u;                        /* internal energy       */
E : diff(U) = -h * diff(m);       /* energy conservation   */

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
declare(cp,constant);
declare(cv,constant);
ode2(cv*m*'diff(T,m)+(cp+cv)*T=0,T,m);




#####
#
# semicirculo
# 2023feb05
#
#####

# «semicirculo»  (to ".semicirculo")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
f : sqrt(1-x^2);
define(F(x), integrate(f, x));
F(1) - F(0);
F(1) - F(sqrt(2)/2);



#####
#
# gruntz-and-tlimit
# 2023mar02
#
#####

# «gruntz-and-tlimit»  (to ".gruntz-and-tlimit")
# (find-maximamsg "37785498 202303 02" "RFateman: gruntz / tlimit")
# (find-maximanode "gruntz")





#####
#
# 2023-1-C4-P1
# 2023jun11
#
#####

# «2023-1-C4-P1»  (to ".2023-1-C4-P1")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
F   : x^3 * y;
G   : subst([x=r*cos(th), y=r*sin(th)], F);
GG  : integrate(G*r, th, 0, %pi/2);
GGG : integrate(GG,  r,  1, 2);

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
vprod(v, w) := v[1]*w[1] + v[2]*w[2];
vprod([1,2], [10, 200]);

F : [x^2*y^2, x];
xt : 2;
yt : t;
xt_t : diff(xt, t);
yy_t : diff(yt, t);
vp : vprod(F, [xt_t, yt_t]);




#####
#
# 2023-1-C4-P2
# 2023jul06
#
#####

# «2023-1-C4-P2»  (to ".2023-1-C4-P2")
# (to "crossproduct")
# (c4m231p2p 2 "questao-1")
# (c4m231p2a   "questao-1")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
columnvector(x) := transpose(matrix(x));
vtolist(v)      := transpose(v)[1];
ii : columnvector([1,0,0]);
jj : columnvector([0,1,0]);
kk : columnvector([0,0,1]);
precrossproduct(v, w) := matrix([ii, jj, kk], vtolist(v), vtolist(w));
crossproduct   (v, w) := determinant(precrossproduct(v, w));
prenorm(v) :=      v.v;
norm   (v) := sqrt(v.v);
getx(v) := v[1][1];
gety(v) := v[2][1];
getz(v) := v[3][1];
div(F)  := getx(diff(F, x)) + gety(diff(F, y)) + getz(diff(F, z));

/* Spherical coordinates, as a substitution */
ssph : [x = ρ*sin(ϕ)*cos(θ),
        y = ρ*sin(ϕ)*sin(θ),
        z = ρ*cos(ϕ)];

/* Item a: calcula o divergente */
FF : (x^3+y^3)*ii + (y^3+z^3)*jj + (z^3+x^3)*kk;
F0 : div(FF);

 /* Pra um teste que calcula o volume da esfera:
F0 : 1;
 */

/* Item c: calcula a integral tripla do F0 */
G0 : subst(ssph, F0) * ρ^2 * sin(ϕ);
G1 : integrate(G0, ρ, 0, 2);
G2 : integrate(G1, ϕ, 0,   %pi);
G3 : integrate(G2, θ, 0, 2*%pi);

/* Item b: calcula a integral de superficie */
suv   : [ρ = 2,
         ϕ = u,
         θ = v];
subst(suv, ssph);
                  subst(ssph, columnvector([x, y, z]));
rr   : subst(suv, subst(ssph, columnvector([x, y, z])));
rr_u : diff(rr, u);
rr_v : diff(rr, v);

nn0  : crossproduct(rr_u, rr_v);
nnn  : norm   (nn0);
nn   : nn0 / nnn;

mysimp(a) := ratsimp(expand(demoivre(expand(exponentialize(expand(a))))));
nn   : mysimp(nn);

nn2  : prenorm(nn0);
nn2  : expand(nn2);
nn2  : exponentialize(nn2);
nn2  : expand(nn2);
nn2  : demoivre(nn2);
nn2  : expand(nn2);

plot3d ( nnn, [u, 0, 1], [v, 0, 1])$





#####
#
# inversas
# 2023jun16
#
#####

# «inversas»  (to ".inversas")
# (to "assume")
# (to "separable")
# (c2m211edovsp 15 "funcoes-inversas")
# (c2m211edovsa    "funcoes-inversas")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
eq1 : y = 2 + 3 * sqrt(5*x+6);
assume(y > 2);
         solve(eq1, x);
  sol1 : solve(eq1, x)[1];
forget(y > 2);
assume(y < 2);
         solve(eq1, x);
  eq2  : solve(eq1, x)[1];
  eq3  : lhs(eq2)^2 = rhs(eq2)^2;
         solve(eq3, x);
  sol2 : solve(eq3, x)[1];
forget(y < 2);
facts();
sol1;
sol2;

       subst(sol1, eq1);
       subst(sol2, eq1);
s2   : rhs(subst(sol2, eq));
expand(s2);
plot2d (s2, [y, -4, 4]);



#####
#
# maxima-by-example
# 2023jul09
#
#####

# «maxima-by-example»  (to ".maxima-by-example")
# (setq eepitch-preprocess-regexp "^(%i[0-9]+) ?")
# (find-mbefile "mbe6calc1.tex")
# (find-mbefile "qdraw.mac")
# (find-mbefile "" "qdraw.mac")
# (find-sh "cp -v $S/https/home.csulb.edu/~woollett/qdraw.mac /tmp/")
# (find-mbe13page)
# (find-mbe13text)
# (find-mbe-links)
# (find-mbe-links 13 6 "cos(x)")
# (find-mbe13page    6 "cos(x)")
# (find-mbe13text    6 "cos(x)")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
file_search_maxima: append (file_search_maxima, ["/tmp/###.mac"])$
load(qdraw);
qdraw ( ex (cos(x), x, 0, 6));
qdraw ( ex1 (cos(x), x, 0, 6, lc(red)))$

qdraw ( ex1 (cos(x), x, 0, 6, lc(red)),
     more (xlabel = "X", ylabel = "COS(X)", title = "single function"))$
qdraw ( ex1 (cos(x), x, 0, 6, lc(red)),
    line ( 0,0,6,0, lc(brown), lw(1)),
    more (xlabel = "X", ylabel = "COS(X)", title = "single function"))$
qdraw ( ex1 (cos(x), x, 0, 6, lc(red)), yr (-1.2, 1.2),
   line ( 0,0,6,0, lc(brown), lw(1)),
   more (xlabel = "X", ylabel = "COS(X)", title = "single function"))$
qdraw ( ex ( [x,x^2,x^3],x,-3,3),
      line ( -3,0,3,0, lc(brown), lw(1)),
      more (xlabel = "X", title = "Using ex(..) for three functions"))$
qdraw ( ex ( [x,x^2,x^3],x,-3,3), yr (-2, 2),
 line ( -3,0,3,0, lc(brown), lw(1)), key (bottom),
  more (xlabel = "X", title = "Using ex(..) for three functions"))$
qdraw ( ex ( [x,x^2,x^3],x,-3,3), yr (-2, 2),
        line ( -3,0,3,0, lc(brown), lw(1)), key (bottom),
        pts ( [ [-1,-1], [0,0],[1,1] ] ),
        more (xlabel = "X", title = "Using ex(..) for three functions"))$
qdraw ( ex ( [x,x^2,x^3],x,-3,3), yr (-2, 2),
 line ( -3,0,3,0, lc(brown), lw(1)), key (bottom),
 pts ( [ [-1,-1], [0,0],[1,1] ], ps(2), pc(magenta)),
 more (xlabel = "X", title = "Using ex(..) for three functions"))$
qdraw ( ex ( [x,x^2,x^3],x,-3,3), yr (-2, 2),
  line ( -3,0,3,0, lc(brown), lw(1)), key (bottom),
  pts ( [ [-1,-1], [0,0],[1,1] ], ps(2), pc(magenta), pk("intersections")),
  more (xlabel = "X", title = "Using ex(..) for three functions"))$
default_colors(15)$
(L1:[[-1,-1],[-1,0],[-1,1]], L2:[[1,-1],[1,0],[1,1]],
       qdraw ( pts(L1), pts(L2), xr(-2,2),yr(-2,2)))$






#####
#
# Maxima by Example: download the chapters with a recursive wget
# 2023jul17
#
#####

# «maxima-by-example-dl»  (to ".maxima-by-example-dl")
# https://home.csulb.edu/~woollett/
# https://home.csulb.edu/~woollett/mbe.html
# https://home.csulb.edu/~woollett/mbe5matrix.pdf
#
# (find-wgetrecursive-links "https://home.csulb.edu/~woollett/")
# (find-sh-at-dir "/tmp/wget-recursive/" "find * | sort")
# (find-sh-at-dir "/tmp/wget-recursive/" "find * | sort | grep pdf")

# (find-angg "LUA/QPDFMerge.lua")




#####
#
# Maxima by Example: the "code-c-d"s pointing to individual chapters
# 2023jul17
#
#####

# «maxima-by-example-ccds»  (to ".maxima-by-example-ccds")
# (find-angg ".emacs.papers"     "maxima-by-example")
# (find-books "__comp/__comp.el" "maxima-by-example")




#####
#
# Maxima by Example: how to use it from eev
# 2023jul18
#
#####

# «maxima-by-example-eev»  (to ".maxima-by-example-eev")
# (find-es "mbe")



#####
#
# qdraw
# 2023jul09
#
#####

# «qdraw»  (to ".qdraw")
# (find-angg ".maxima/maxima-init.mac" "load_qdraw")
# (find-mbefile "" "mbe13qdraw.pdf")
# (find-mbe13page)
# (find-mbe13text)
# (find-mbefile "" "qdraw.mac")
# (find-mbefile "qdraw.mac")
# (find-mbefile "qdrawcode.txt")
# (find-mbe-links 13  1 "")
# (find-mbe-links 13  8 "")
# (find-mbe-links 13 39 "11.1       line(...)")
# (find-mbe-links 13 18 "4    Parametric plots with para(...)")
# (find-mbe13page    18 "4    Parametric plots with para(...)")
# (find-mbe13text    18 "4    Parametric plots with para(...)")
# (find-mbe13page    47 "11.5     vector(...)")
# (find-mbe13text    47 "11.5     vector(...)")
# (find-mbe13page    56 "13 Even More with more(...)")
# (find-mbe13text    56 "13 Even More with more(...)")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load_qdraw();
qdraw(
  ex ( [x,x^2,x^3],x,-3,3),
  line ( -3,0,3,0, lc(brown), lw(1)),
  more (xlabel = "X", title = "Using ex(..) for three functions")
  )$

qdraw(xr(-1.5,2),yr(-2,2),
   para(sin(t),sin(2*t),t,0,2*%pi ),
   pts( [ [0,0] ],ps(1),pc(brown),pk("t = 0")),
   pts( [ [sin(%pi/8),sin(%pi/4)] ],ps(1),pc(red),pk("t = pi/8")),
   pts( [ [1,0] ],ps(1),pc(green),pk("t = pi/2")),
   more (title = "parametric plot", xlabel = "sin(t)", ylabel = "sin(2*t)"))$



#####
#
# Draw boxes on the 5 "simplest" points of a parabola using qdraw
# 2023sep25
#
#####

# «qdraw-poly»      (to ".qdraw-poly")
# «parabola-boxes»  (to ".parabola-boxes")
# (find-mbe-links 13  5 "poly(")
# (find-mbe13page     5 "poly(")
# (find-mbe13text     5 "poly(")
# (find-TH "eev-maxima" "maxima-by-example")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load_qdraw();
myqdraw([lists]) := apply('qdraw, apply('append, lists));
P   : [cos(t), sin(t)];
Pt  : diff(P, t);
Ptt : diff(P, t, 2);
define(P(t),   P);
define(Pt(t),  Pt);
define(Ptt(t), Ptt);

t0 : %pi/4;
t0 : 0;

[A,uu,vv] : [P(t0), Pt(t0), Ptt(t0)];
B(u,v)    := A + u*uu + v*vv/2;
B(0,0);
Q         : P(t0) + t*Pt(t0) + t^2*Ptt(t0)/2;
define(Q(t), Q);

qdraw(
  xr(-4.5,4.5), yr(-4,4),
  poly([B(0,0), B( 1,0), B( 1,1), B(0,1)], lc(brown)),
  poly([B(0,0), B(-1,0), B(-1,1), B(0,1)], lc(brown)),
  poly([B(0,0), B( 2,0), B( 2,4), B(0,4)], lc(brown)),
  poly([B(0,0), B(-2,0), B(-2,4), B(0,4)], lc(brown)),
  para(P[1],P[2], t, 0,2*%pi, lc(red)),
  para(Q[1],Q[2], t, -2,2,    lc(orange))
)$

[Q(0),  Q(1) , Q(2)];
[Q(0), Q(-1), Q(-2)];



#####
#
# parabolas-2024.1
# 2024mar27
#
#####

# «parabolas-2024.1»  (to ".parabolas-2024.1")
# «myqdraw-flatten»  (to ".myqdraw-flatten")
# (find-angg ".maxima/maxima-init.mac" "load_qdraw")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load_qdraw();
myqdraw0([lists]) := apply('qdraw, flatten([lists]));
myqdraw ([lists]) := block([], myqdraw_body : lists, apply('myqdraw0, lists));
mypoly([pts])     := poly(pts, lc(orange));
myvec(xy, dxdy)   := vector(xy, dxdy, hl(0.1), lw(5), lc(purple));

defs1() := block([],
  define(Pt(t),  diff(P(t),t)),
  define(Ptt(t), diff(P(t),t,2)),
  [A,uu,vv] : [P(0), Pt(0), Ptt(0)],
  B(u,v)    := A + u*uu + v*vv/2,
  PP(t)     := A + t*uu + t^2/2 * vv
  )$

parabola_rects() := [
  mypoly(B(0,0), B( 1,0), B( 1,1), B(0,1)),
  mypoly(B(0,0), B(-1,0), B(-1,1), B(0,1)),
  mypoly(B(0,0), B( 2,0), B( 2,4), B(0,4)),
  mypoly(B(0,0), B(-2,0), B(-2,4), B(0,4))
  ]$
parabola_vecs() := [
  myvec(P(0), Pt(0)),
  myvec(P(1), Pt(1)),
  myvec(P(-1), Pt(-1)),
  myvec(P(-2), Pt(-2))
  ]$

P(t) := [3,1] + t*[1,0] + t^2*[0,1];
defs1();
P(t);
PP(t);

P(t) := [cos(t), sin(t)];
defs1();
P(t);
PP(t);

P(t) := [2,6] + t*[1,1] + t^2*[2,-1];
defs1();
myqdraw(
  xr(0,12), yr(0,8), more(proportional_axes=xy),
  parabola_rects(),
  parabola_vecs(),
  para(P(t)[1],P(t)[2], t, -2,2, lc(red))
  )$

myqdraw0(
  more(terminal=pdf, file_name="/tmp/parabola"),
  myqdraw_body
  )$

** (find-maximanode "flatten")
** (find-pdf-page "/tmp/parabola.pdf")
** (find-pdf-text "/tmp/parabola.pdf")








#####
#
# qdraw-taylor
# 2023oct03
#
#####

# «qdraw-taylor»  (to ".qdraw-taylor")
# (to "2023-2-raio-conv")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load_qdraw();
DDef1(fxy) := buildq([f:op(fxy),xy:args(fxy)], define(f(splice(xy)),f));
DDef([fxys]) ::= map('DDef1,fxys);
colors : [black, red, orange, forest_green, blue, dark_violet]$

f            : sin(x);
derivsf      : makelist(diff(f,x,k), k, 0,7);
derivsf0     : subst([x=0], derivsf);
derivsfk(k)  := diff(f,x,k);
derivsf0k(k) := subst([x=0], derivsfk(k));
termk(k)     := derivsf0k(k) * x^k/k!;
newf(K)      := sum(termk(k), k, 0, K);
newf(7);
f0 : newf(0);
f1 : newf(1);
f3 : newf(3);
f5 : newf(5);
f7 : newf(7);

r : 2*%pi;
r : 3*%pi;
qdraw(xr(-r,r), yr(-r,r),
      ex1(f,  x, -r,r, lc(colors[1]), lk("orig")),
      ex1(f0, x, -r,r, lc(colors[2]), lk("grau 0")),
      ex1(f1, x, -r,r, lc(colors[3]), lk("grau 1")),
      ex1(f3, x, -r,r, lc(colors[4]), lk("grau 3")),
      ex1(f5, x, -r,r, lc(colors[5]), lk("grau 5")),
      ex1(f7, x, -r,r, lc(colors[6]), lk("grau 7"))
     );

define(f7(x), f7);
sin(0.1);
f7(0.1);
sin(0.1) - f7(0.1);

define(f5(x), f5);
sin(0.1);
f5(0.1);
sin(0.1) - f5(0.1);




#####
#
# qdraw-imp
# 2023sep28
#
#####

# «qdraw-imp»  (to ".qdraw-imp")
# (find-mbe-links 13 20 "6     Implicit plots with imp(...) and imp1(...)")
# (find-mbe13page    20 "6     Implicit plots with imp(...) and imp1(...)")
# (find-mbe13text    20 "6     Implicit plots with imp(...) and imp1(...)")
# (to "matrixify")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load_qdraw();
e : sin(2*x)*cos(y)$
qdraw(imp( e=0.4,x,-3,3,y,-3,3 ),
      cut(key),
      more(title=" sin(2 x) cos(y) = 0.4 ",
      xlabel = "x",
      ylabel = "y"))$
qdraw(imp( [e=0.4,e=0.7,e=0.9],x,-3,3,y,-3,3 ),
      cut(key),
      more(title=" sin(2 x) cos(y) = 0.4,0.7,0.9 ",
      xlabel = "x",
      ylabel = "y"))$




#####
#
# qdraw-orbita
# 2023sep26
#
#####

# «qdraw-orbita»  (to ".qdraw-orbita")
# See: (c3m232trp     9 "orbita")
#      (c3m232tra       "orbita")
#      (c3m221orbitap 3 "orbita")
#      (c3m221orbitaa   "orbita")
# Based on: (to "C3-lissajous")
# Uses:     (to "DDef")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load_qdraw();
myqdraw([lists]) := apply('qdraw, apply('append, lists));
seqn(a,b,n)      := makelist(a + (b-a)*k/n, k, 0, n);
DDef1(fxy)       := buildq([f:op(fxy),xy:args(fxy)], define(f(splice(xy)),f));
DDef([fxys])    ::= map('DDef1,fxys);

h                : 2*%pi / 12;

/* configs */
[adjvel,adjacc,r,ts] : [1,   1,   9, seqn(0*h, 12*h, 6)];
[adjvel,adjacc,r,ts] : [1/4, 1/4, 3, seqn(0*h, 12*h, 6)];
[adjvel,adjacc,r,ts] : [1/4, 1/10, 3, seqn(0*h, 12*h, 6)];
[adjvel,adjacc,r,ts] : [1/4, 1/4, 3, seqn(0*h, 12*h, 3)];
[adjvel,adjacc,r,ts] : [1/4, 1/4, 3, seqn(2*h, 14*h, 3)];
[adjvel,adjacc,r,ts] : [1,   1,   9, seqn(0*h, 12*h, 3)];
[adjvel,adjacc,r,ts] : [1,   1,   9, seqn(2*h, 14*h, 3)];
[adjvel,adjacc,r,ts];

P       :       [cos(t),   sin(t)];
R       : 1/2 * [cos(4*t), sin(4*t)];
S       : P + R;
St      : diff(S, t);
Stt     : diff(S, t, 2);
vel     : vector([S[1],S[2]], [St [1],St [2]]*adjvel, hl(0.1), lc(orange));
acc     : vector([S[1],S[2]], [Stt[1],Stt[2]]*adjacc, hl(0.1), lc(purple));
define(vel(t), vel);
define(acc(t), acc);
vels    : makelist(vel(t), t, ts);
accs    : makelist(acc(t), t, ts);
bbox    : [ xr(-r,r), yr(-r,r) ];
orbit   : [ para(S[1],S[2], t, 0,2*%pi, lc(red)) ];

myqdraw(bbox, orbit, vels, accs);

vel(0);
vel(%pi);
acc(0);
acc(%pi);



vels;
adjvel  : 1;
adjacc  : 1;
myqdraw(orbit, vels, accs);

acc(0);
acc(%pi);

myqdraw([ xr(-2,2),yr(-2,2),
          para(S[1], S[2], t, 0,2*%pi, lc(red))
        ]);

S(t)[1];
S(t);




#####
#
# Exercises on Lissajous figures (for Calculus 3)
# 2023oct07
#
#####

# «qdraw-lissajous»  (to ".qdraw-lissajous")
#    «C3-lissajous»  (to ".C3-lissajous")
# (c3m232trp 8 "lissajous")
# (c3m232tra   "lissajous")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load_qdraw();
myqdraw([lists]) := apply('qdraw, apply('append, lists));
seqn(a,b,n)      := makelist(a + (b-a)*k/n, k, 0, n);

P       : [cos(t), sin(2*t)];   /* trajectory */
ts      : seqn(0, 2*%pi, 8);    /* times      */
shrink  : 4;                    /* how much to shrink the vectors */

Pt      : diff(P, t)    / shrink;
Ptt     : diff(P, t, 2) / shrink;
vel     : vector([P[1],P[2]], [Pt [1],Pt [2]], hl(0.1), lc(orange));
acc     : vector([P[1],P[2]], [Ptt[1],Ptt[2]], hl(0.1), lc(purple));
vel(t1) := subst([t=t1], vel);
acc(t1) := subst([t=t1], acc);
vels    : makelist(vel(t1), t1, ts);
accs    : makelist(acc(t1), t1, ts);

myqdraw([ xr(-2,2),yr(-2,2),
          para(P[1],P[2], t, 0,2*%pi, lc(red))
        ], vels, accs);

/* original: */
qdraw( xr(-2,2),yr(-2,2),
       para(P[1],P[2], t, 0,2*%pi, lc(red)),
       vel(0),
       acc(0) );



#####
#
# qdraw-linearize
# 2023oct03
#
#####

# «qdraw-linearize»  (to ".qdraw-linearize")
# (find-mbe-links 13 18 "4    Parametric plots with para(...)")
# (find-mbe13page    18 "4    Parametric plots with para(...)")
# (find-mbe13text    18 "4    Parametric plots with para(...)")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load_qdraw();
myqdraw([lists]) := apply('qdraw, apply('append, lists));
colors;
colors : [red, orange, forest_green, blue, dark_violet];

F   : sqrt(1-x^2);
x0  : 0.3;
x1  : 0.8;
[xx1,xx2,xx3,xx4] : [-1.5,-1,1,1.5];

Fx  : diff(F, x);
DDef(F(x), Fx(x));
L   : F(x0) + (x-x0)*Fx(x0);
DDef(L(x));

qdraw(xr(xx1,xx4),yr(xx1,xx4),
      ex1(F, x, xx2, xx3, lc(colors[1])),
      ex1(L, x, xx1, xx4, lc(colors[2])),
   pts( [ [x0,0], [x0,F(x0)], [0,F(x0)] ],ps(1.5),pc(colors[3]),pk("(x0,f(x0))")),
   pts( [ [x1,0], [x1,F(x1)], [0,F(x1)] ],ps(1.5),pc(colors[4]),pk("(x1,f(x1))")),
   pts( [         [x1,L(x1)], [0,L(x1)] ],ps(1.5),pc(colors[5]),pk("(x1,L(x1))"))
   )$

FL(x1) := [F(x1), L(x1), F(x1)-L(x1)];
FL(4.1);
FL(4.01);
FL(4.001);



#####
#
# qdraw-proportional
# 2023nov18
#
#####

# «qdraw-proportional»  (to ".qdraw-proportional")
# (find-anggfile "MAXIMA/eigshow1.mac" "proportional_axes")
# (find-maximanode "Functions and Variables for draw" "proportional_axes")
# (find-mbe-links 13 56 "13 Even More with more(...)")
# (find-mbe13page    56 "13 Even More with more(...)")
# (find-mbe13text    56 "13 Even More with more(...)")



#####
#
# qdraw-colors
# 2023oct03
#
#####

# «qdraw-colors»  (to ".qdraw-colors")
# (find-mbe-links 13 10 "3.1 Default colors and available colors")
# (find-mbe13page    10 "3.1 Default colors and available colors")
# (find-mbe13text    10 "3.1 Default colors and available colors")

# (find-maximanode "")
# (find-maximanode "set_plot_option")
# (find-maximanode "color")
# (find-maximanode "proportional_axes")
# (find-maximanode "Functions and Variables for draw" ": color")
# (find-maximanode "Functions and Variables for draw" "#23ab0f")
# (find-maximanode "Functions and Variables for draw" "proportional_axes")

/* Missing: light_magenta, light_turquoise, dark_pink, dark_yellow */

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load_qdraw();

show_colors([white, black, gray0, grey0, gray10, grey10, gray20,
  grey20, gray30, grey30, gray40, grey40, gray50, grey50, gray60,
  grey60, gray70, grey70, gray80, grey80, gray90, grey90, gray100,
  grey100, gray, grey, light_gray, light_grey, dark_gray, dark_grey],
  20);

show_colors([red, light_red, dark_red, yellow, light_yellow], 12);

show_colors([green, light_green, dark_green, spring_green,
  forest_green, sea_green], 12);

show_colors([blue, light_blue, dark_blue, midnight_blue, navy,
  medium_blue, royalblue, skyblue], 12);

show_colors([cyan, light_cyan, dark_cyan, magenta, dark_magenta,
  turquoise, dark_turquoise, pink, light_pink], 12);

show_colors([coral, light_coral, orange_red, salmon, light_salmon,
  dark_salmon,
  orange, dark_orange,
  aquamarine, khaki,
  light_goldenrod,
  dark_khaki, goldenrod,
  dark_goldenrod,
  brown,  gold, beige,
  violet, dark_violet, plum, purple], 12);

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load_qdraw();
show_colors([red, orange, yellow], 3);
show_colors([red, orange, yellow], 2);




#####
#
# qdraw-ex-and-ex1
# 2023nov09
#
#####

# «qdraw-ex-and-ex1»  (to ".qdraw-ex-and-ex1")
# (find-mbe-links 13  6 "3     Quick Plots for Explicit Functions: ex(...) and ex1(...)")
# (find-mbe13page     6 "3     Quick Plots for Explicit Functions: ex(...) and ex1(...)")
# (find-mbe13text     6 "3     Quick Plots for Explicit Functions: ex(...) and ex1(...)")
# (find-mbe-links 13 10 "3.1 Default colors and available colors")
# (find-mbefile "qdraw.mac")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load_qdraw();
qdraw();
qdraw1();

 /*(%i3)*/ qdraw ( ex (cos(x), x, 0, 6))$
 /*(%i4)*/ qdraw ( ex (cos(x), x, 0, 6, lc(red)))$
 /*(%i5)*/ qdraw ( ex1 (cos(x), x, 0, 6, lc(red)))$
 /*(%i6)*/ qdraw ( ex1 (cos(x), x, 0, 6, lc(red)),
                   more (xlabel = "X", ylabel = "COS(X)", title = "single function"))$
 /*(%i7)*/ qdraw ( ex1 (cos(x), x, 0, 6, lc(red)),
                   line ( 0,0,6,0, lc(brown), lw(1)),
                   more (xlabel = "X", ylabel = "COS(X)", title = "single function"))$
 /*(%i8)*/ qdraw ( ex1 (cos(x), x, 0, 6, lc(red)), yr (-1.2, 1.2),
                   line ( 0,0,6,0, lc(brown), lw(1)),
                   more (xlabel = "X", ylabel = "COS(X)", title = "single function"))$
 /*(%i9)*/ qdraw ( ex ( [x,x^2,x^3],x,-3,3),
                   line ( -3,0,3,0, lc(brown), lw(1)),
                   more (xlabel = "X", title = "Using ex(..) for three functions"))$
/*(%i10)*/ qdraw ( ex ( [x,x^2,x^3],x,-3,3), yr (-2, 2),
                   line ( -3,0,3,0, lc(brown), lw(1)), key (bottom),
                   more (xlabel = "X", title = "Using ex(..) for three functions"))$
/*(%i11)*/ qdraw ( ex ( [x,x^2,x^3],x,-3,3), yr (-2, 2),
                   line ( -3,0,3,0, lc(brown), lw(1)), key (bottom),
                   pts ( [ [-1,-1], [0,0],[1,1] ] ),
                   more (xlabel = "X", title = "Using ex(..) for three functions"))$
/*(%i12)*/ qdraw ( ex ( [x,x^2,x^3],x,-3,3), yr (-2, 2),
                   line ( -3,0,3,0, lc(brown), lw(1)), key (bottom),
                   pts ( [ [-1,-1], [0,0],[1,1] ], ps(2), pc(magenta)),
                   more (xlabel = "X", title = "Using ex(..) for three functions"))$
/*(%i13)*/ qdraw ( ex ( [x,x^2,x^3],x,-3,3), yr (-2, 2),
                   line ( -3,0,3,0, lc(brown), lw(1)), key (bottom),
                   pts ( [ [-1,-1], [0,0],[1,1] ], ps(2), pc(magenta), pk("intersections")),
                   more (xlabel = "X", title = "Using ex(..) for three functions"))$
/*(%i14)*/ default_colors(15)$
/*(%i15)*/ (L1:[[-1,-1],[-1,0],[-1,1]], L2:[[1,-1],[1,0],[1,1]],
           qdraw ( pts(L1), pts(L2), xr(-2,2),yr(-2,2)))$
/*(%i16)*/ mycL : [aquamarine,beige,blue,brown,cyan,gold,goldenrod,green,khaki,
            magenta,orange,pink,plum,purple,red,salmon,skyblue,turquoise,
            violet,yellow ]$
/*(%i17)*/ show_colors(mycL,10)$
/*(%i18)*/ qdraw( ex1(bessel_j(0,x),x,0,20,lc(red),lw(6),lk("bessel_j ( 0, x)") ),
          ex1(bessel_j(1,x),x,0,20,lc(blue),lw(5),lk("bessel_j ( 1, x)")),
          ex1(bessel_j(2,x),x,0,20,lc(brown),lw(4),lk("bessel_j ( 2, x)") ),
          ex1(bessel_j(3,x),x,0,20,lc(green),lw(3),lk("bessel_j ( 3, x)") ) )$
/*(%i19)*/ qdraw(line(0,0,50,0,lc(red),lw(2) ),
               ex1(bessel_j(0, sqrt(x)),x,0,50 ,lc(blue),
                lw(7),lk("J0( sqrt(x) )") ) )$




#####
#
# qdraw-3Daxes
# 2023oct14
#
#####

# «qdraw-3Daxes»  (to ".qdraw-3Daxes")
# (find-angg "MAXIMA/crossproduct1.mac")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
M1 : matrix([ cos(aa), sin(aa),     0  ],
            [-sin(aa), cos(aa),     0  ],
            [    0,       0,        1  ]);

M2 : matrix([    1,       0,        0  ],
            [    0,    cos(bb), sin(bb)],
            [    0,   -sin(bb), cos(bb)]);
M2.M1;

columnvector(x) := transpose(matrix(x));
vtolist(v)      := transpose(v)[1];
ii : columnvector([1,0,0]);
jj : columnvector([0,1,0]);
kk : columnvector([0,0,1]);
getx   (v) := v[1][1];
gety   (v) := v[2][1];
getz   (v) := v[3][1];
getxy  (v) := [getx(v), gety(v)];

aa : 0.2;
bb : 0.5;

AA : [0,0];
BB : ev(getxy(M2.M1.ii));
CC : ev(getxy(M2.M1.jj));
DD : ev(getxy(M2.M1.kk));

load_qdraw();
qdraw( xr(-2,2),yr(-2,2),
       vector(AA,BB, hl(0.1)),
       vector(AA,CC, hl(0.1)),
       vector(AA,DD, hl(0.1)) );




#####
#
# qdraw-homogeneous
# 2023oct16
#
#####

# «qdraw-homogeneous»  (to ".qdraw-homogeneous")
# (to "radcan-homogeneous")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load_qdraw();
myqdraw([lists]) := apply('qdraw, apply('append, lists));
colors  : [red, orange, forest_green, blue, dark_violet];
colors2 : [gray60, gray40];

f(x)       := a*x^k;
exf(a,n)   := ex1(a*x^k, x, -r, r, lc(colors [n]));
vline(x,n) := poly([[x,-r],[x,r]], lc(colors2[n]), lw(6));
qdraw_h()  := qdraw(
      xr(-r,r), yr(-r,r),
      exf(-1,    1),
      exf(-1/2,  2),
      exf( 0,    3),
      exf( 1/2,  4),
      exf( 1,    5),
      vline(b,   1),
      vline(c,   2)
     );

r          :  2;
b          : 4/4;
c          : 5/4;

k:0; qdraw_h();   /* k=0 */
k:1; qdraw_h();   /* k=1 */
k:2; qdraw_h();   /* k=2 */
k:3; qdraw_h();   /* k=3 */




#####
#
# The magical points - `m_i's - in a Riemann sum
# 2023oct21
#
#####

# «qdraw-mis»  (to ".qdraw-mis")
# (c2m232coap 7 "pontos-magicos-2")
# (c2m232coaa   "pontos-magicos-2")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
y : 4 - (x-2)^2;
define(f (x), y);
define(fp(x), diff(f(x),x));
sols : solve(y-y0, x);
define(g1(y0), rhs(sols[1]));
define(g2(y0), rhs(sols[2]));
g1(3);
g2(3);
define(I(a,b),  integrate(f(x), x, a, b));
define(m(a,b),          g2(I(a,b)/(b-a)));
define(m1(a,b), ratsimp(g1(I(a,b)/(b-a))));
define(m2(a,b), ratsimp(g2(I(a,b)/(b-a))));
m(3, 4);
m(2, 3);
display2d : false;
m(a,b);
display2d : true;

[a,b] : [2,4];
define(xi(i,N), a+(b-a)*i/N);
define(ai(i,N), xi(i-1,N));
define(bi(i,N), xi(i,N));
assume(N > 0);
define(mi(i,N), ratsimp(m(ai(i,N),bi(i,N))));

load_qdraw();
myqdraw([lists]) := apply('qdraw, apply('append, lists));
colors : [red, orange, blue, dark_violet];
colors : [red, orange, forest_green, blue, dark_violet];
colors : [red, orange, yellow, blue];
myrect(y,a,b,c)  := rect(a,0, b,y, lw(0.01), fill(colors[c]));

myrect_low_ab (a,b) := myrect(f(b),     a,b,1);
myrect_mid_ab (a,b) := myrect(f(m(a,b)),a,b,2);
myrect_high_ab(a,b) := myrect(f(a),     a,b,3);
myrect_low_iN (i,N) := myrect_low_ab (ai(i,N),bi(i,N));
myrect_mid_iN (i,N) := myrect_mid_ab (ai(i,N),bi(i,N));
myrect_high_iN(i,N) := myrect_high_ab(ai(i,N),bi(i,N));
myrects_low     (N) := makelist(myrect_low_iN (i,N), i, 1, N);
myrects_mid     (N) := makelist(myrect_mid_iN (i,N), i, 1, N);
myrects_high    (N) := makelist(myrect_high_iN(i,N), i, 1, N);

mypoint_mid_xy(x,y) := pts([[x,0],[x,y]], ps(2), pc(colors[4]));
mypoint_mid_ab(a,b) := mypoint_mid_xy(m(a,b), f(m(a,b)));
mypoint_mid_iN(i,N) := mypoint_mid_ab(ai(i,N),bi(i,N));
mypoints_mid    (N) := makelist(mypoint_mid_iN(i,N), i, 1, N);

myqdraw_mids (N) :=
  myqdraw([xr(0,4), yr(0,4)],
           myrects_high(N),
           myrects_mid(N),
           myrects_low(N),
          [ex1(f(x), x, 0,4, lc(black))],
           mypoints_mid(N),
          []);

myqdraw_mids(1);
myqdraw_mids(2);
myqdraw_mids(4);
myqdraw_mids(8);

/* 2023oct24 */
mypts(myps)         := pts(myps, ps(2), pc(colors[4]));
myline(xa,ya,xb,yb) := line(xa,ya,xb,yb, lw(2), lc(colors[4]));

myslope(x0,y0,slope,xa,xb) := block([ya,yb],local(f),
  f(x1) := y0 + (x1-x0)*slope,
  ya : apply('f,[xa]),
  yb : apply('f,[xb]),
  [mypts([[xa,ya],[x0,y0],[xb,yb]]),
   myline(xa,ya,          xb,yb)
  ]);

[a,b] : [0,3];
slop : (f(b)-f(a))/(b-a);
xs : rhs(solve(fp(x)=slop,x)[1]);
ys : f(xs);

myqdraw([xr(0,6), yr(0,6)],
        [ex1(f(x), x, 0,4, lc(black))],
        myslope(xs,ys,fp(xs),a,b),
        [myline(a,f(a), b,f(b))],
        []);

define(g(x), sqrt(1+diff(f(x),x)^2));
o     : quad_qag(g(x),     x, a, b, 1);
yg    : o[1]/(b-a);
xg    : find_root(g(x)=yg, x, 0, 2);
g(xg) * (b-a);

myqdraw([xr(0,7), yr(0,7)],
        [ex1(g(x), x, 0,4, lc(black))],
     /* [myline(a,g(a), b,g(b))], */
        [mypts([[xg,0],[xg,yg]])],
        [myline(a,yg, b,yg)],
        []);

myqdraw([xr(0,7), yr(0,7)],
        [ex1(f(x), x, 0,4, lc(black))],
        myslope(xs,ys,fp(xs),a,b),
        myslope(xg,f(xg),fp(xg),a,b),
        [myline(a,f(a), b,f(b))],
        []);




ml : m1(0,4);
mr : m2(0,4);
     ratsimp(f(ml));
     ratsimp(f(mr));
ym : ratsimp(f(ml));

myqdraw([xr(0,4), yr(0,4)],
        [myrect(ym,0,4,2)],
        [ex1(f(x), x, 0,4, lc(black))],
        [mypoint_mid_xy(ml,ym),
         mypoint_mid_xy(mr,ym)],
        []);

show_colors(colors, 12);



#####
#
# qdraw-folium
# 2023oct28
#
#####

# «qdraw-folium»  (to ".qdraw-folium")
# (to "pn1-folium")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
e1 : x^3 + y^3 = 6*x*y;
sols : solve(e1, y);
sols[1];
sols[2];
sols[3];
define(f1(x), rhs(sols[1]));
define(f2(x), rhs(sols[2]));
define(f3(x), rhs(sols[3]));
load_qdraw();
qdraw(xr(-4,4),
      yr(-4,4),
      ex([f1(x), f2(x), f3(x)],x,-4,4));

e1 - x^3;
factor(e1 - x^3);


#####
#
# qdraw-4-inverses
# 2023nov05
#
#####

# «qdraw-4-inverses»  (to ".qdraw-4-inverses")
# (c2m232edovsp 13 "4-inversas-maxima")
# (c2m232edovsa    "4-inversas-maxima")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load_qdraw();
colors : [gray, red, orange, forest_green, blue, dark_violet];
f(x) := (x^2-1)^2;
sols : solve(y=f(x), x);
define(g1(y), rhs(sols[1]));
define(g2(y), rhs(sols[3]));
define(g3(y), rhs(sols[4]));
define(g4(y), rhs(sols[2]));
f(g1(y));
f(g2(y));
f(g3(y));
f(g4(y));

qdraw(xr(-2,2), yr(-2,2),
      ex1(f(x), x, -4, 4, lc(colors[1])),
      ex1(g1(y), y, 0, 4, lc(colors[2])),
      ex1(g2(y), y, 0, 1, lc(colors[3])),
      ex1(g3(y), y, 0, 1, lc(colors[4])),
      ex1(g4(y), y, 0, 4, lc(colors[5]))
      );



#####
#
# qdraw-eigenvectors
# 2023nov18
#
#####

# «qdraw-eigenvectors»  (to ".qdraw-eigenvectors")
# (find-angg "MAXIMA/eigshow1.mac")
# (to "eigenvalues")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
M1: matrix([1, 2],
           [2, 5]);
[vals, vecss]: eigenvectors (M1);
[[vals, multiplicities], vecss]: eigenvectors (M1);
vals;
la1 : vals[1];
la2 : vals[2];
vecss;
vecss[1];
vecss[2];
x1 : columnvector(vecss[1][1]);
x2 : columnvector(vecss[2][1]);



#####
#
# qdraw1
# 2023nov21
#
#####

# «qdraw1»  (to ".qdraw1")
# (find-mbefile "qdraw.mac" "qdraw calls qdraw1 then passes drlist")
# (find-maximanode "point_size")
# (find-maximanode "line_width")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load_qdraw();
drlist : qdraw1(
  xr(-2,2),yr(-2,2),
  more(line_width=4),
  ex1(x,x,-3,3),
  more(line_width=8),
  ex1(x+1,x,-3,3)
  );
grind(drlist);




#####
#
# qdraw-contour
# 2023nov28
#
#####

# «qdraw-contour»  (to ".qdraw-contour")
# (find-mbe-links 13 20 "6     Implicit plots with imp(...) and imp1(...)")
# (find-mbe13page    20 "6     Implicit plots with imp(...) and imp1(...)")
# (find-mbe13text    20 "6     Implicit plots with imp(...) and imp1(...)")
# (find-mbe-links 13 26 "6.6 Implicit Plots with Greater Control: imp1(...)")
# (find-mbe13page    26 "6.6 Implicit Plots with Greater Control: imp1(...)")
# (find-mbe13text    26 "6.6 Implicit Plots with Greater Control: imp1(...)")
# (find-mbe-links 13 27 "7    Contour Plots with contour(...)")
# (find-mbe13page    27 "7    Contour Plots with contour(...)")
# (find-mbe13text    27 "7    Contour Plots with contour(...)")



#####
#
# qdraw-bezier1
# 2024apr01
#
#####

# «qdraw-bezier1»  (to ".qdraw-bezier1")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
towt(A, B) := A + t*(B-A);
[Q0, Q1, Q2] : [towt(P0,P1), towt(P1,P2), towt(P2,P3)];
[R0, R1]     : [towt(Q0,Q1), towt(Q1,Q2)];
[S0]         : [towt(R0,R1)];
define(S0(t), ev(S0));

[P0,P1,P2,P3] : [[0,0], [0,1], [1,1], [1,0]];
[P0,P1,P2,P3] : [[0,0], [0,1], [2,1], [1,0]];
define(S0(t), ev(S0));

load_qdraw();
qdraw(xr(-2,2),yr(-2,2),
      para(S0(t)[1], S0(t)[2], t,0,1 )
     );




#####
#
# defstruct
# 2023jul13
#
#####

# «defstruct»  (to ".defstruct")
# (find-maximanode "Introduction to Structures")
# (find-maximanode "defstruct")
# (find-maximanode "build_info")
# (find-maximagitgrep "grep --color=auto -nRH --null -e struct *")
# (find-maximagitgrep "grep --color=auto -nRH --null -e defstruct *")
# (find-maximagitgrep "grep --color=auto -nRH --null -e defstruct tests/*")
# (find-maximagitfile "archive/share/trash/defstruct.lisp")
# (find-maximagitfile "tests/rtest_mset.mac")
# (find-maximagitfile "tests/rtestdefstruct.mac")

# (find-man "grep")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
structures;
build_info();
display2d : false;
build_info();
display2d : true;
op  (build_info());
args(build_info());




#####
#
# compile_file
# 2023jul15
#
#####

# «compile_file»  (to ".compile_file")
# (find-maximamsg "37870260 202307 15" "RFateman: compile_file(filename)")
# (find-maximanode "compile_file")
# (find-maxima-links "compile_file")
# (find-maxima-links "translate")



#####
#
# debugmode
# 2023jul19
#
#####

# «debugmode»  (to ".debugmode")
# (find-maximamsg "37868332 202307 10" "MTalon: debugmode(true)")
# (find-maximanode "Source Level Debugging")
# (find-maximanode "debugmode")
# (find-maximanode "get")
# (find-maximanode "put")
# (find-maximanode "properties")
# (find-angg "MAXIMA/laurent1.mac")
# (find-maxima-links "lpx")
# (find-es "lisp" "get")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load("~/MAXIMA/laurent1.mac");
fundef(lpx);
properties(lpx);
:lisp (describe '$lpx)
:lisp (symbol-plist '$lpx)
:lisp (get '$lpx 'lineinfo)

:br lpx
lpx(x^4);



#####
#
# ratpow
# 2023jul19
#
#####

# «ratpow»  (to ".ratpow")
# (find-maximamsg "37872009 202307 17" "Edrx: Internal representation of")
# (find-maximamsg "37872053 202307 17" "Stavros: ratpow")
# (find-maximamsg "37872061 202307 17" "RDodier: ratdisrep")
# (find-maximamsg "37872132 202307 17" "RFateman: Fateman-Salz_Simplifier")
# (find-maximamsg "37872775 202307 19" "Edrx: Laurent polynomials")

# (find-books "__comp/__comp.el" "maxima-fatemansimp")
# (find-maximagitfile "share/contrib/ratpow.lisp")
# (find-maximagitfile "share/contrib/ratpow.lisp" "showratvars")
# (find-maximagitgrep "grep --color=auto -nRH --null -e showratvars *")
# (find-maximagitfile "")
# (find-maximanode "ratdisrep")
# (find-maximanode "showratvars")
# (find-maximanode "print")
# (find-maximanode "rat")
# (find-maximanode "%edispflag")
# (find-maximanode "exptdispflag")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
a : taylor(exp(2*x),x,0,5);
b : ratdisrep(a);
:lisp #$b$
:lisp #$a$
load("ratpow.lisp")$
ratp_hipow(a, x);
ratp_lopow(a, x);
ratp_coeffs(a, x);
ratp_dense_coeffs(a, x);
ratp_dense_coeffs_lo(a, x);

Hi all, especially Stavros...
First: thanks for all the hints!
Second: this is a simple demo of ratpow.lisp:

  a : taylor(exp(2*x),x,0,5);
  b : ratdisrep(a);
  :lisp #$b$
  :lisp #$a$
  load("ratpow.lisp")$
  ratp_hipow(a, x);
  ratp_lopow(a, x);
  ratp_coeffs(a, x);
  ratp_dense_coeffs(a, x);
  ratp_dense_coeffs_lo(a, x);

Third: this _almost_ gives me a very nice way to implement a method
that I always teach to my students!!! Suppose that E is exp(%i*x);
this code

  f  : sin(x)^4 * cos(x)^2;
  f1 : expand(exponentialize(f));
  f2 : subst([x=1/%i, %e=E], f1);
  f3 : rat(f2, E);

converts f to a rational function of E. What do I need to use instead
of the "rat" in the last step to convert f to a _Laurent polynomial_
of E instead of a _rational function_ of E?

  Thanks in advance!
  Cheers,
    Eduardo Ochs


:lisp (describe '$ratdisrep)




Internal representation of "Taylor sums"
Hi list,

a few hours ago I tried to use my luatree thing -
http://anggtwu.net/eev-maxima.html#luatree - to understand the
low-level representation of Taylor series, and I discovered that

  1) it doesn't recognize the difference between "Taylor sums" - this
     is an informal term; the correct term is canonical rational
     expressions, a.k.a. CREs - and normal sums,

  2) op and args also don't recognize the difference,

  3) the internal representation of "Taylor sums" and "normal sums" is
     very different, and ratp distinguishes them.

We can see all that in this example:

  a : taylor(sin(x),x,0,5);
  b : x - x^3/6 + x^5/120;
  op(a);
  op(b);
  args(a);
  args(b);
  :lisp #$a$
  :lisp #$b$
  ratp(a);
  ratp(b);

it yields:

  (%i1) a : taylor(sin(x),x,0,5);
                                    3    5
                                   x    x
  (%o1)/T/                     x - -- + --- + . . .
                                   6    120
  (%i2) b : x - x^3/6 + x^5/120;
                                    5     3
                                   x     x
  (%o2)                            --- - -- + x
                                   120   6
  (%i3) op(a);
  (%o3)                                  +
  (%i4) op(b);
  (%o4)                                  +
  (%i5) args(a);
                                         3   5
                                        x   x
  (%o5)                           [x, - --, ---]
                                        6   120
  (%i6) args(b);
                                    5      3
                                   x      x
  (%o6)                           [---, - --, x]
                                   120    6
  (%i7) :lisp #$a$
  
  ((MRAT SIMP (((%SIN SIMP) $X) $X) (sin(x)490 X491)
    (($X ((5 . 1)) 0 NIL X491 . 2)) TRUNC)
   PS (X491 . 2) ((5 . 1)) ((1 . 1) 1 . 1) ((3 . 1) -1 . 6) ((5 . 1) 1 . 120))
  (%i7) :lisp #$b$
  
  ((MPLUS SIMP) $X ((MTIMES SIMP) ((RAT SIMP) -1 6) ((MEXPT SIMP) $X 3))
   ((MTIMES SIMP) ((RAT SIMP) 1 120) ((MEXPT SIMP) $X 5)))
  (%i7) ratp(a);
  (%o7)                                true
  (%i8) ratp(b);
  (%o8)                                false
  (%i9) 

In the example above a is a MRAT and b is a MPLUS. Is there a standard
way to access the components of an MRAT from Maxima? What do people
use when they need to inspect the innards of MRATs from Maxima?

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




  exptdispflag : false;
  f2 ;
  f4 : taylor(f2 * E^6, E, 0, 12);
  rat(f4, E);
? taylor




#####
#
# ratsubst
# 2023jul19
#
#####

# «ratsubst»  (to ".ratsubst")
# (find-maxima-links "ratsubst")
# (find-maximanode "ratsubst")
# (find-maximanode "fullratsubst")
# (find-maximanode "fullratsubstflag")
# (find-maximanode "lratsubst")
# (find-maximanode "ratsubst")
# (find-mbe-links 1 26 "1.8.6 Examples of subst, ratsubst, part, and substpart")
# (find-maximagitfile "src/nrat4.lisp" "(defmfun $ratsubst ")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
e0 : a*f(x) + b*g(y);
e1 : ratsubst(cos(z), f(z), e0);
e1 : ratsubst(cos(x), f(x), e0);
e2 : ratsubst(x^3*sin(x), g(x), e1);
e2 : ratsubst(x^3*sin(y), g(y), e1);
:lisp (describe '$ratsubst);


 -- Function: bothcoef (<expr>, <x>)

     Returns a list whose first member is the coefficient of <x> in
     <expr> (as found by 'ratcoef' if <expr> is in CRE form otherwise by
     'coeff') and whose second member is the remaining part of <expr>.
     That is, '[A, B]' where '<expr> = A*<x> + B'.

     Example:

          (%i1) islinear (expr, x) := block ([c],
                  c: bothcoef (rat (expr, x), x),
                  is (freeof (x, c) and c[1] # 0))$
          (%i2) islinear ((r^2 - (x - r)^2)/x, x);
          (%o2)                         true

 -- Function: coeff
          coeff (<expr>, <x>, <n>)
          coeff (<expr>, <x>)




#####
#
# Laurent polynomials: first notes
# 2023jul19
#
#####

# «laurent»  (to ".laurent")
# (find-angg "MAXIMA/laurent1.mac")
# (find-angg "MAXIMA/laurent2.mac")
# (find-maximamsg "37873006 202307 19" "RFateman: ratexpand(ratsubst(...))")
# (find-maximamsg "37873482 202307 20" "Edrx: laurent1.mac")
# (find-maximamsg "37873595 202307 20" "Edrx: most of the students ... very weak")
# (find-maximanode "powerdisp")
# (find-maximanode "ratexpand")
# (find-maximanode "declare_index_properties")
# (find-maximanode "makelist")
# (find-maximanode "sum")

ratexpand(f3) produces this display  (it looks better in 2-D)...
1/16+1/(64*E^6)-1/(32*E^4)-1/(64*E^2)-E^2/64-E^4/32+E^6/64.
It takes the E^0 term out front, which may not fit the pattern you are
looking for.  

or just
powerdisp:true;
ratexpand(ratsubst(E, exp(%i*x),exponentialize(f)));

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
f   : sin(x)^4 * cos(x)^2;
f1  : expand(exponentialize(f));
f2a : ratexpand(ratsubst(E, exp(%i*x), f1));
f2  : subst([x=1/%i, %e=E], f1);
f3  : rat(f2, E);
powerdisp:false;
exptdispflag:false;
declare_index_properties(EE, [postsuperscript]);
f4  : ratexpand(f3);
f5  : makelist(ratcoef(f4,E,k)*EE[k], k, 6, -6, -2);
f6  : apply("+", f5);

concat([10, 20, 30], [400, 500]);
matrix(append([10, 20, 30], ["."], [400, 500]));

f4 : ratexpand(ratsubst(E, exp(%i*x),exponentialize(f)));


g1 : 10*x^2 + 20*x^1 + 30*x^0 + 40*x^-1 + 50*x^-2;


g1 : 4*x^2 + 5*x^1 + 6*x^0 + 7*x^-1 + 8*x^-2;
subst([x=10], g1), float;
mycoeffs    (ex,var,a,b) := makelist(ratcoef(ex,var,k), k, a, b, -1);
dottedcoeffs(ex,var,a,b) :=
  matrix(append(mycoeffs(ex,var,a,0), ["."],
         mycoeffs(ex,var,-1,b)));
dottedcoeffs(g1,x,2,-2);


poscoeffs(ex,var,a,b) 

ratcoef(f4, E, -2);
ratcoef(f4, E, 0);
         ratcoef (<expr>, <x>, <n>)
 
makelist(k, k, -6, 6, 2);
makelist(k, k, 6, -6, -2);
makelist([ratcoef(f4,E,k),k], k, 6, -6, -2);


EE[42];

# (find-maxima-links "degree")

Hi Richard,

most of the students in my courses are very weak, and many of them are
so weak that the idea of creating auxiliary notations to visualize
what some objects "mean" is totally alien to them.

In my course on integration and basic ODEs there are several topics
that I introduce by saying: in this part of the course you will learn
how to do some calculations by hand, and this will be practically
useless to you later, because after you grow up you will always do
these calculations using a CAS... but there are some parts of the
course that are useful because of their side effects - for example,
_most_ people who spend many hours doing integrations by partial
fractions by hand learn how to visualize polynomials in ways similar
to this,

          4*10^2 + 5*10^1 + 6*10^0 + 7*10^-1 + 8*10^-2
  --->  [ 4        5        6      . 7         8       ]

and this is something that will be useful in several places later.

I always present these auxiliary notations as something that is
totally optional, but what happens is that some students understand
these notations in seconds, and they start to use them; then the other
students see that these students are now solving problems that looked
huge very quickly, and they decide to learn these notations too - and
they lose a bit of their fear of auxiliary notations.

In the pre-pandemic times I always had time to cover trigonometric
identities in the course, and I showed the students that we could
solve something like this

  integrate(sin(4*x)^2 * cos(5*x)^2, x);

either in way that is most commonly taught, i.e., by applying several
trigonometric identities, or by exponentialization and demoivrization;
and with the right auxiliary notations the exponentialization and
demoivrization can be done by hand very quickly. In that specific case
the notation like "[ 1 0 -1 . 0 1 ]" for the Laurent polynomials on E
is not very adequate because the degree is too high, but other
auxiliary notations work well.

I hope that this makes sense...
  Cheers,
    E.




#####
#
# mpg-p17
# 2023aug20
#
#####

# «mpg-p17»  (to ".mpg-p17")
# (mpgp 17 "intersecoes-de-retas")
# (mpga    "intersecoes-de-retas")
# MpgP17
# (to "myrowvector")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
/* (to "myrowvector")
*/
V([entries]) := matrix(entries);
getx(v)      := v[1][1]$
gety(v)      := v[1][2]$
getxy(v)     := [getx(v),gety(v)]$
tolist(v)    := makelist(v[1][i], i, length(v[1]))$

R(t) := V(3,3) + t*V(2,-1);
S(u) := V(4,1) + u*V(-1,1);
[V(1,4), R(-1), S(3)];

              R(t)-S(u);
sys1 :  getxy(R(t)-S(u));
sys1 : tolist(R(t)-S(u));
tu   : linsolve(sys1, [t,u]);
    subst(tu, [R(t), S(u)]);
P : subst(tu,  R(t));

/* a) */
R(t) := V(1,0) + t*V(0,3);
S(u) := V(0,4) + u*V(2,0);

/* b) */
R(t) := V(1,0) + t*V(3,1);
S(u) := V(0,2) + u*V(2,3);

/* c) */
R(t) := V(1+3*t, t);
S(u) := V(2*u, 2+3*u);

/* d) */
R(t) := V(0,3) + t*V(2,-1);
S(u) := V(1,0) + u*V(1,3);

[R(t), S(u)];
sys1 : tolist(R(t)-S(u));
tu   : linsolve(sys1, [t,u]);
P    : subst(tu, [R(t), S(u)]);




#####
#
# ordering
# 2023jul19
#
#####

# «ordering»  (to ".ordering")
# (find-maximamsg "37870989 202307 14" "RDodier: orderlessp")
# (find-maximamsg "37871041 202307 14" "RFateman: depends on culture and context")
# (find-maximanode "orderlessp")



#####
#
# maw-emails
# 2023aug25
#
#####

# «maw-emails»  (to ".maw-emails")

Hi Robert,

Thanks! I found this before your e-mail,

  https://robert-marik.github.io/wiki
  https://github.com/robert-marik
  https://github.com/robert-marik/maw-html
  https://github.com/robert-marik/maw-html/issues/1

where the last link points to a question that I sent to the author,
and that he answered... the Maxima code in not in maw-html, though. To
download it we have to go to this link that you sent,

  https://sourceforge.net/projects/mathassistant/

and click on the "Download" button. It downloads a shell script that
runs this,

hg clone http://mathassistant.hg.sourceforge.net:8000/hgroot/mathassistant/maw
hg clone http://mathassistant.hg.sourceforge.net:8000/hgroot/mathassistant/maw-html

unzips a zip file, and a does a few other (mostly) trivial things. The
code that solves integrals in several steps is in this file,

  maw/integral/matchint.mac

and I'll see if I can make it work from a Maxima REPL...

  Cheers =),
    Eduardo




#####
#
# Maw - Mathematical Assistant on Web
# 2023aug25
#
#####

# «maw»  (to ".maw")
# (find-maximamsg "37887419 202308 25" "Edrx:")
# (find-maximamsg "37887392 202308 25" "RDodier:")
# (find-maximamsg "37887193 202308 24" "Przemek:")
# (find-maximamsg "37886977 202308 24" "Edrx:")

# (find-fline "~/usrc/maw/")
# (find-fline "~/usrc/maw/maw/")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
rm -Rv ~/usrc/maw/
mkdir  ~/usrc/maw/
cd     ~/usrc/maw/
cp -iv /tmp/install_maw .

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
rm -Rv ~/usrc/maw/maw/
mkdir  ~/usrc/maw/maw/
cd     ~/usrc/maw/maw/
sh ../install_maw

# (find-fline "~/usrc/maw/")
# (code-c-d "maw" "~/usrc/maw/maw/maw/")
# (find-mawfile "")
# (find-mawfile "integral/")
# (find-mawfile "integral/matchint.mac")




#####
#
# mysubst
# 2023sep26
#
#####

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

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
mysubst_f(fxye) := buildq([
    f  : op  (lhs(fxye)),
    xy : args(lhs(fxye)),
    e  :      rhs(fxye)],
  f = lambda([splice(xy)],e))$
mysubst_1(ab) := if is(equal(op(ab), ":="))
                 then mysubst_f(ab)
                 else ab$
mysubst_ify(fxyes) := map('mysubst_1, fxyes);

            '[f(x,y):=10*x+y, g(x):=10*x, a=42];
mysubst_ify('[f(x,y):=10*x+y, g(x):=10*x, a=42]);

gradef(g(x), g_x(x));
gradef(F(u), f(u));

BB : F(g(x));
CC : F(u);
aa : diff(BB, x);
dd : diff(CC, u);
AA : integrate(aa, x);
DD : integrate(dd, u);

M4(a,b,c,d) := matrix([a,"=",b], ["","=",c], ["","=",d])$
MM : M4(AA,BB,CC,DD);

substs0 : '[g(x):=2*x, g_x(x):=2];
substs0 : '[g(x):=2*x, g_x(x):=2, F(u):=sin(u), f(u):=cos(u)];
substs  : mysubst_ify(substs0);
MM2     : subst(substs, MM);
MM3     : ev(MM2, 'integrate);
MM4     : subst([u=2*x], MM3);




#####
#
# total-derivative
# 2023sep30
#
#####

# «total-derivative»  (to ".total-derivative")
# (find-angg "MAXIMA/pn1.mac")

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

  "Use z=z(x,y) and y=y(x)"$
map('kill, [z,y]);
gradef(z(x,y), z_x(x,y), z_y(x,y));
gradef(y(x),   y_x(x));
gradefs;
pnas : [z(x,y),z_x(x,y),z_y(x,y), y(x),y_x(x)];

          pnex(z);
     diff(pnex(z),x);
pnsh(diff(pnex(z),x));

  "Use only z=z(x,y)"$
map('kill, [z,y]);
gradef(z(x,y), z_x(x,y), z_y(x,y));
gradefs;
pnas : [z(x,y),z_x(x,y),z_y(x,y)];

          pnex(z);
     diff(pnex(z),x);
pnsh(diff(pnex(z),x));



o1 : pnexpand(p2, z);
o2 : diff(o1, x);
o3 : pnshortenr(p2, o2);

o1 : pnexpand(p1, z);
o2 : diff(o1, x);
o3 : pnshortenr(p1, o2);




o1 : subst([z=z(x,y)],        z);
o2 : subst([z=z(x,y),y=y(x)], z);
o3 : diff(o1, x);
o4 : diff(o2, x);
o5 : diff(o1);
o6 : diff(o2);
subst([del(x)=dx, del(y)=dy], o5);
subst([del(x)=dx, del(y)=dy], o6);


shorten_del(delx) := buildq([delx, dx:concat('d,args(delx)[1])], delx=dx)$
shorten_f  (zxyz) := buildq([
    z  : op  (lhs(zxyz)),
    xy : args(lhs(zxyz))],
  z(splice(xy)) = z)$
shorten_1 (pexpr) := if is(op(pexpr)='del)
                     then shorten_del(pexpr)
                     else shorten_f(pexpr)$
shorten(pexprs,o) := subst(map('shorten_1,pexprs), o);

shorten_ify([y(x),del(x)]);

shorten([y(x),del(x)], (y(x1)-y(x))*del(x));

 [z(a,b,c), y(x), del(z), del(x)]);

map('shorten_1, [z(a,b,c), y(x), del(z), del(x)]);


shorten_del(del(w));

shorten_del(del(w));
op(del(w));

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
is(equal(op(del(w)), 'del));
is(equal(op(f(x,y)), 'del));
if is(equal(op(del(w)), 'del)) then "yes" else "no";
if is(equal(op(f(x,y)), 'del)) then "yes" else "no";
if is(eql  (op(f(x,y)), 'del)) then "yes" else "no";
if is(      op(f(x,y))= 'del ) then "yes" else "no";
? eql
??eql
??equal

is(a=33);


Hi list,

if I run these expressions in the REPL

  is(equal(op(del(w)), 'del));
  is(equal(op(f(x,y)), 'del));
  if is(equal(op(del(w)), 'del)) then "yes" else "no";
  if is(equal(op(f(x,y)), 'del)) then "yes" else "no";

I get this:

  (%i1) is(equal(op(del(w)), 'del));
  (%o1)                                true
  (%i2) is(equal(op(f(x,y)), 'del));
  (%o2)                               unknown
  (%i3) if is(equal(op(del(w)), 'del)) then "yes" else "no";
  (%o3)                                 yes
  (%i4) if is(equal(op(f(x,y)), 'del)) then "yes" else "no";
  (%o4)                     if unknown then yes else no
  (%i5) 

The is(equal(op(o),'del)) returns "true", "false", or "unknown". How
do I replace it by something that converts the "unknown"s to "false"s?

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




#####
#
# tellsimpafter
# 2023oct01
#
#####

# «tellsimpafter»  (to ".tellsimpafter")
# (find-maximamsg "39730837 202309 30" "BWillis: Avoiding trig in calculus solutions")




#####
#
# intermediate-vars
# 2023oct03
#
#####

# «intermediate-vars»  (to ".intermediate-vars")
# (find-books "__analysis/__analysis.el" "stewart" "951" "intermediate variables")
# (find-stewart7page (+ 32 951) "intermediate variables")
# (find-stewart7text (+ 32 951) "intermediate variables")
# Stew14p53
# See: (to "depends")
#
# Example 4: f=f(x,y,z,t), x=x(u,v), y=(u,v), z=z(u,v), t=t(u,v)

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
depends (f,[x,y,z,t]);
depends (  [x,y,z,t],[u,v]);
dependencies;
diff(f);
diff(f,x);
diff(f,u);
diff(f,v);

diff(f);
diff(x,u);
              diff(x);
                        diff(f);
subst([del(x)=diff(x)], diff(f));

o : diff(f);
traverse(o);
traverse(o, 1);
traverse(o, 1,1);
traverse(o, 1,1,op);
traverse(o, 1,1,args);
traverse(o, 1,2);
traverse(o, 1,2,op);
traverse(o, 1,2,args);


diff (r.s, u);
diff (r.s, t);
remove (r, dependency);
diff (r.s, t);




#####
#
# limit
# 2023oct09
#
#####

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

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
F(k,a,b) := integrate(t^k, t, a, b);
F(2,10,100);
assume(x-1>0);
F(-2,1,x);
limit(F(-2,1,x), x, inf);
limit(1/x^4,     x, inf);




#####
#
# improper-integral
# 2023nov28
#
#####

# «improper-integral»  (to ".improper-integral")
# (find-maximanode "limit")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
f(x) := 1/x;
f(x) := 1/x^2;

F(x) := integrate(f(t), t, 1, x);
F(10);
F(1000);
assume(x-1>0);
assume(x>42);
limit(F(x), x, inf, minus);

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
assume(N>1);
f    :  1 / 2^x;
F    :  integrate(f, x);
F(N) := integrate(f, x, 1, N);
F(N);
limit(F(N), N, inf);

f    :  1 / x;
F    :  integrate(f, x);
F(N) := integrate(f, x, 1, N);
F(N);
limit(F(N), N, inf);

limit(      sum(1/x, x, 1, N), N, inf);
limit(integrate(1/x, x, 1, N), N, inf);




#####
#
# at and atvalue
# 2023oct17
#
#####

# «at»       (to ".at")
# «atvalue»  (to ".atvalue")
# (find-maximanode "at")
# (find-maximanode "atvalue")
# (find-maximamsg "45940337 202310 17" "DVolinski:")
# (find-maximamsg "45940361 202310 17" "LButler:")
# (find-maximamsg "45940395 202310 17" "DVolinksi:")
# (find-maximamsg "58764589 202404 25" "RDodier: g(x) := at (diff (f(u), u), u = x);")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
g(x) := at (diff(f(u),u), u=x)$
g(0);
f(x) := x^2 + 3*x + 7 $
g(0);





#####
#
# gf
# 2023oct26
#
#####

# «gf»  (to ".gf")
# (find-maximanode "modulus")
# https://www.math.wustl.edu/~victor/classes/ma450/gf_manual.pdf
# (code-c-d      "gf"       "~/bigsrc/maxima/share/contrib/gf/")
# (code-pdf-page "gfmanual" "~/bigsrc/maxima/share/contrib/gf/gf_manual.pdf")
# (code-pdf-text "gfmanual" "~/bigsrc/maxima/share/contrib/gf/gf_manual.pdf")
# (find-gffile "")
# (find-gffile "gf.mac")
# (find-gfmanualpage)
# (find-gfmanualtext)
# (find-gffile "gf_manual.tex")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
F16 : gf_set_data(2, x^4+x+1);
gf_info()$

a : x^3+x;
b : x^3+x^2+1;
gf_add(a, b);
gf_mult(a, b);
gf_inv(b);
gf_div(a, b);
gf_mult(a, gf_inv(b));
gf_exp(a, 14);
gf_exp(a, 15);
makelist(gf_random(), i,1,3);
gf_primitive();
a : x^3+x$
gf_index(a);
is(a = gf_exp(x, 9));


* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
modulus : 5;
m(o) := mod(o, modulus);
m(-4);
:lisp (get '$+ 'lbp)
:lisp (get '$+ 'rbp)
:lisp (get '$* 'lbp)
:lisp (get '$* 'rbp)
infix ("_+", 101, 101);
infix ("_-", 101, 101);
infix ("_*", 121, 121);
infix ("_^", 131, 131);
"_+"(a, b) := m(a+b);
"_-"(a, b) := m(a-b);
"_*"(a, b) := m(a*b);
"_^"(a, b) := m(a^b);

2 _+ 4;
2 _- 4;
2 _* 4;
4 _^ 2;

# This takes ages (to scroll):
# (find-gffile "aes.mac")

# (find-maximagitfile "share/contrib/gf/gf.mac")
# (find-maximagitfile "src/numth.lisp")



#####
#
# chaosgame
# 2023oct26
#
#####

# «chaosgame»  (to ".chaosgame")
# (find-maximanode "fractals-pkg")
# (find-maximanode "chaosgame")
# (find-maximagitfile "share/dynamics/")
# (find-maximagitfile "share/dynamics/dynamics.mac" "chaosgame")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
chaosgame([[0, 0], [1, 0], [0.5, sqrt(3)/2]], [0.1, 0.1], 1/2,
           3000, [style, dots]);




#####
#
# radcan
# 2023oct28
#
#####

# «radcan»  (to ".radcan")
# (find-maximamsg "49227967 202310 28" "Edrx: is(somefunction((a*b)^k=a^k*b^k)) -> true")
# (find-maximamsg "49227995 202310 28" "BWillis: assume(a>0,b>0)")
# (find-maximamsg "49228000 202310 28" "RFateman: assumptions about branches")
# (find-maximamsg "49228016 202310 29" "RDodier: is(foo = bar) and is(equal(foo, bar))")
# (find-maximamsg "49385023 202310 29" "Edrx: thanks")
# (find-maximanode "ratsimp")
# (find-maximanode "ratexpand")
# (find-maximanode "radcan")

Hi list,

is there a function that simplifies, or expands, (a*b)^k to a^k*b^k?
I've tried this,

  o1 : a^k*b^k = (a*b)^k;
  o2 : a^k*b^k + a^k*c^k = a^k*(b^k+c^k);
  is(o1);             /* false */
  is(o2);             /* false */
  is(ratsimp(o1));    /* false */
  is(ratsimp(o2));    /* true */
  is(ratexpand(o1));  /* false */
  is(ratexpand(o2));  /* true */

I've also tried "is(somefunction(o1))" for all somefunctions in:

(info "(maxima)Functions and Variables for Polynomials")
https://maxima.sourceforge.io/docs/manual/maxima_80.html#Functions-and-Variables-for-Polynomials-1

and I couldn't find anything that makes is(somefunction(o1)) return
true...

  Thanks in advance - and I hope I haven't committed any typos in my
  tests...
    Eduardo Ochs
    http://anggtwu.net/eev-maxima.html


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

  o1 : a^k*b^k = (a*b)^k;
  o2 : a^k*b^k + a^k*c^k = a^k*(b^k+c^k);
  is(o1);             /* false */
  is(o2);             /* false */
  is(ratsimp(o1));    /* false */
  is(ratsimp(o2));    /* true */
  is(ratexpand(o1));  /* false */
  is(ratexpand(o2));  /* true */
  is(radcan(o1));     /* true */
  is(radcan(o2));     /* true */
  radcan(o1);
  radcan(o2);
  is(lhs(o1) = rhs(o1))



#####
#
# radcan-homogeneous
# 2023oct28
#
#####

# «radcan-homogeneous»  (to ".radcan-homogeneous")
# (to "qdraw-homogeneous")
# (c3m232fhp 10 "maxima")
# (c3m232fha   "maxima")

** (find-Maxima2-links "contas1")
* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
  load("/usr/share/emacs/site-lisp/maxima/emaxima.lisp")$
  display2d:'emaxima$
texput(x0,"x_0");
texput(y0,"y_0");
  linenum:0;
/* f:R->R, homogeneous of degree k */
f(x) := a * x^k;
f(x0);
f(m*x0);
o  : f(m*x0) = m^k * f(x0);
o2 : radcan(o);
is(o);    /* false because "is" is dumb */
is(o2);   /* true */

  /* f:R->R, homogeneous of degree 2 */
     f(   x,   y) := a*x^2 + b*x*y + c*y^2;
     f(  x0,  y0);
     f(m*x0,m*y0);
o  : f(m*x0,m*y0) = m^2 * f(x0,y0);
o2 : radcan(o);
is(o);    /* false because "is" is dumb */
is(o2);   /* true */

  /* f:R->R, homogeneous of degree 3 */
     f(   x,   y) := a*x^3 + b*x^2*y + c*x*y^2 + d*y^3;
     f(  x0,  y0);
     f(m*x0,m*y0);
o  : f(m*x0,m*y0) = m^3 * f(x0,y0);
o2 : radcan(o);
is(o);    /* false because "is" is dumb */
is(o2);   /* true */

a^k * (b * c)^k; 




#####
#
# graphs
# 2023oct29
#
#####

# «graphs»  (to ".graphs")
# (find-maximanode "graphs-pkg")
# (find-maximanode "Introduction to graphs")
# (find-maximanode "Functions and Variables for graphs")
# (find-maximanode "draw_graph")
# (find-maximagitfile "share/graphs/")
# (find-maximagitfile "share/graphs/graphs.mac")
# (find-maximagitfile "share/graphs/graphs.system")
# https://mail.google.com/mail/u/0/#inbox/FMfcgzGwHVHXWSDFNLCHplZXQMFKSgSG

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load(graphs);
draw_graph(cycle_graph(10));
draw_graph(flower_snark(5));
draw_graph(cube_graph(3));
draw_graph(cube_graph(3), program=planar_embedding);
draw_graph(cube_graph(4));
draw_graph(cube_graph(4), show_id=true);
draw_graph(cube_graph(5));

load("graphs")$
g: petersen_graph(20, 2);
draw_graph(g, redraw=true, program=planar_embedding);
load("graphs")$
t: tutte_graph();
draw_graph(t, redraw=true, fixed_vertices=[1,2,3,4,5,6,7,8,9]);



#####
#
# package_graph
# 2023nov17
#
#####

# «package_graph»  (to ".package_graph")
# (find-maximamsg "51785058 202311 16" "Stavros: Which could be `good' graph properties of a package?")
# (find-maximamsg "51784571 202311 15" "ElObs: Which could be `good' graph properties of a package?")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load("absimp.mac");
package_graph():=block(
   A:map(op,functions),
   len:length(A),
   B:map(lambda([x],rhs(apply(fundef,[x]))),A),
   C:makelist([i,A[i]],i,len),
   D:unique(map(sort,delete(false,map(lambda([x],if x[1]#x[2] and
     ssearch(string(A[x[1]]),string(B[x[2]]))#false then
     x),create_list([i,j],i,1,len,j,1,len))))),
   load(graphs),
   create_graph(C,D)
)$
package_graph();
(draw_graph(%,show_label=true));

file_search(nusum)$
load(%)$
package_graph();
(draw_graph(%,show_label=true));

file_search(sarag)$
load(%)$
package_graph();
(draw_graph(%,show_label=true));




#####
#
# finite_model_theory
# 2023oct29
#
#####

# «finite_model_theory»  (to ".finite_model_theory")
# https://github.com/austinlorenz/finite_model_theory
# (find-git-links "https://github.com/austinlorenz/finite_model_theory" "finitemt")
# (code-c-d "finitemt" "~/usrc/finite_model_theory/")
# (find-finitemtfile "")
# (find-finitemtfile "README.md")
# (find-finitemtfile "MaximaLogic")
# (find-finitemtfile "MaximaLogic2")
# (find-finitemtfile "MaximaLogic.mac")
# (find-finitemtfile "MaximaLogic2.mac")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
rm -Rfv ~/usrc/finite_model_theory/
cd      ~/usrc/
git clone https://github.com/austinlorenz/finite_model_theory
cd      ~/usrc/finite_model_theory/
cp -v MaximaLogic  MaximaLogic.mac
cp -v MaximaLogic2 MaximaLogic2.mac

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
file_search_maxima : append (file_search_maxima,
  ["/home/edrx/usrc/finite_model_theory/###.mac"])$

/* batch(MaximaLogic); */
load("MaximaLogic.mac")$
load("MaximaLogic2.mac")$

G : complete_graph(10);
fa(x, fa(y, x != y implies E(x,y)));

G : cycle_graph(10);
fa(x, fa(y, x != y implies E(x,y)));

phi : '(exz(y, exz(z, E(x,y) and E(x,z) and y!=z)));
B   : petersen_graph();
phi : '(exz(y, exz(z, E(x,y) and E(x,z) and y!=z)));
LFP(B,phi);

draw_graph(B);





#####
#
# maxima-bezier
# 2023nov01
#
#####

# «maxima-bezier»  (to ".maxima-bezier")
# https://github.com/t-o-k/Maxima-bezier
# (find-git-links "https://github.com/t-o-k/Maxima-bezier" "maximabezier")
# (code-c-d "maximabezier" "~/usrc/Maxima-bezier/")
# (find-maximabezierfile "")



#####
#
# simplify_sum
# 2023nov06
#
#####

# «simplify_sum»  (to ".simplify_sum")
# (find-maximamsg "51780404 202311 06" "RDodier: simplify_sum")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
o2 : sum (binomial (k + i, i)*binomial (n - 1, n - k), k, 0, n);
o3 : sum (binomial (n - 1, n - i) * %o2, i, 0, n);
load (simplify_sum)$
simplify_sum (o3);
simplify_sum (o2);




#####
#
# getenv
# 2023nov08
#
#####

# «getenv»  (to ".getenv")
# (find-angg ".maxima/maxima-init.mac" "HOME")
# (find-maximanode "Environment operations")
# (find-maximanode "getenv")
# (find-sh "locate operatingsystem")
# (find-maximagitfile "share/contrib/operatingsystem/")
# (find-maximagitfile "share/contrib/operatingsystem/operatingsystem.mac")
# (find-maximagitfile "share/contrib/operatingsystem/operatingsystem.lisp")





#####
#
# Strang p.1: 1*x+2*y=3 and 4*x+5*y=6
# 2024jan30
#
#####

# «strang-p1»  (to ".strang-p1")
# (find-books "__alg/__alg.el" "strang")
# (find-books "__alg/__alg.el" "strang" "(+ 10   1)")
# (find-strang4page (+ 10   1) "1 Matrices and Gaussian Elimination")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
eq1 : 1*x + 2*y = 3;
eq2 : 4*x + 5*y = 6;
eq3 :         4*eq1;
eq4 :  expand(4*eq1);
eq5 : eq2 - eq4;
eq6 : eq5 / -3;
            eq6;
                 eq1;
eq7 : subst(eq6, eq1);
eq8 : eq7 - 4;
             [eq8,eq6];
                        eq1;
                             eq2;
eq9  : subst([eq8,eq6], eq1);
eq10 : subst([eq8,eq6],      eq2);

matrix(['eq1, ":", eq1],
       ['eq2, ":", eq2],
       ['eq3, ":", eq3],
       ['eq4, ":", eq4],
       ['eq5, ":", eq5],
       ['eq6, ":", eq6],
       ['eq7, ":", eq7],
       ['eq8, ":", eq8],
       ['eq9, ":", eq9],
       ['eq10, ":", eq10]);





#####
#
# Strang p.3: 1*x+2*y=3 and 4*x+8*y=6
# 2024jan30
#
#####

# «strang-p3»  (to ".strang-p3")
# (find-books "__alg/__alg.el" "strang")
# (find-books "__alg/__alg.el" "strang" "(+ 10   3)")
# (find-strang4page (+ 10   3)       "That singular case")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
eq1 : 1*x + 2*y = 3;
eq2 : 4*x + 8*y = 6;
             4*eq1;
      expand(4*eq1);
eq3 : expand(4*eq1);
eq4 : eq2 - eq3;

matrix(['eq1, ":", eq1],
       ['eq2, ":", eq2],
       ['eq3, ":", eq3],
       ['eq4, ":", eq4]);




#####
#
# pontos-mais-faceis-1
# 2024mar21
#
#####

# «pontos-mais-faceis-1»  (to ".pontos-mais-faceis-1")
# (c3m241introp 3 "pontos-mais-faceis")
# (c3m241introa   "pontos-mais-faceis")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
ex0 : f(t) = a + ((t-b)/(c-d))*e;
ex1 : subst([f(t)=45,    t=23], ex0);
ex2 : subst([f(t)=45+56, t=34], ex0);
expand([ex1, ex2]);

ex1 : 45    = a  + ((23-b) /(c-d))*e;
ex2 : 45+56 = a  + ((34-b) /(c-d))*e;
expand  ([ex1, ex2]);
linsolve([ex1, ex2], [a, e]);

ex1 : 45    = a  + ((23-b) /(c-d))*e;
      45    = 45 + ((23-23)/(c-d))*e;
ex2 : 45+56 = a  + ((34-b) /(c-d))*e;
      45+56 = 45 + ((34-23)/(c-d))*e;
      45+56 = 45 + ((34-23)/(34-23))*e;
      45+56 = 45 + ((34-23)/(34-23))*56;

ex3 : f(t)  = _45 + ((t-_23)/(_34-_23))*_56;
ex4 : subst([_45=f(t0), _23=t0], ex3);
ex4 : subst([_45=f(t0), _23=t0, _34=t1], ex3);
ex4 : subst([_45=f(t0), _23=t0, _34=t1, _56=f(t1)-f(t0)], ex3);
subst([t=t0], ex4);
subst([t=t1], ex4);




#####
#
# log-constants-anim
# 2024apr07
#
#####

# «log-constants-anim»  (to ".log-constants-anim")
# (find-fline "~/2024.1-C2/")
# (find-fline "~/2024.1-C2/" "log-constants-anim.gif")
# http://anggtwu.net/2024.1-C2/log-constants-anim.gif

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
# (find-fline "/tmp/qdraw/")
rm -Rv /tmp/qdraw/
mkdir  /tmp/qdraw/
cd     /tmp/qdraw/

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load_qdraw();
myqdraw0([lists]) := apply('qdraw, flatten([lists]));
myqdraw ([lists]) := block([], myqdraw_body : lists, apply('myqdraw0, [lists]));
g(a,b,x) := if is(x<0) then log(-x)+a else log(x)+b;
h(a,b)   := buildq([a,b], lambda([x], g(a,b,x)));

h(2,3);
h(2,3)(4);
h(2,3)(-4);

mycurve(a,b)    := ex1(h(a,b), x, -4,4, lc(red))$
myfilename(n)   := format("/tmp/qdraw/a_~3,'0d", n)$
myqdraw_n(n)    := more(terminal=pdf, file_name=myfilename(n))$
myqdraw_fixed() := [xr(-4,4),yr(-4,4)]$

myqdraw_abn(a,b,n) := myqdraw(myqdraw_fixed(), mycurve(a,b), myqdraw_n(n))$
myqdraw_ab (a,b)   := myqdraw(myqdraw_fixed(), mycurve(a,b))$

** myqdraw_ab (0,0);
** myqdraw_ab (0,1);
myqdraw_abn(0,   0  , 0);
myqdraw_abn(0,   0.5, 1);
myqdraw_abn(0,   1.0, 2);
myqdraw_abn(0,   1.5, 3);
myqdraw_abn(0.5, 1.5, 4);
myqdraw_abn(1.0, 1.5, 5);
myqdraw_abn(1.5, 1.5, 6);
myqdraw_abn(1.5, 1.0, 7);
myqdraw_abn(1.5, 0.5, 8);
myqdraw_abn(1.5, 0.0, 9);
myqdraw_abn(1.0, 0.0, 10);
myqdraw_abn(0.5, 0.0, 11);

** (find-pdfanim-links "/tmp/qdraw/" "a_" "all")




#####
#
# freeof
# 2024apr15
#
#####

# «freeof»      (to ".freeof")
# «listofvars»  (to ".listofvars")
# (find-maximanode "freeof")
# (find-maximanode "lfreeof")
# (find-maximanode "listofvars")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
expr: z^3 * cos(a[1]) * b^(c+d);
freeof (z, expr);
freeof (cos, expr);
freeof (a[1], expr);
freeof (cos (a[1]), expr);
freeof (b^(c+d), expr);
freeof ("^", expr);
freeof (w, sin, a[2], sin (a[2]), b*(c+d), expr);

expr: (a+b)^5$
c: a$
freeof (c, expr);

expr: (a+b)^5$
expand (expr);
freeof (a+b, %);
freeof (a+b, expr);
exp (x);
freeof (exp, exp (x));
freeof (i, 'sum (f(i), i, 0, n));
freeof (x, 'integrate (x^2, x, 0, 1));
freeof (x, 'integrate (x^2, x));




#####
#
# Exercícios da p.374 do Stewart em português
# 2024apr14
#
#####

# «stewart-pt-p374»  (to ".stewart-pt-p374")
# (find-books "__analysis/__analysis.el" "stewart-pt" "374" "Exercícios")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
myintegrate3(label,f,var) := [label, 'integrate(f,var), "=", integrate(f,var)];
myintegrate1(item)        := apply('myintegrate3, item);
myintegrates([items])     := apply('matrix, map('myintegrate1, items));

i5(label,f,oldvar,newvar,chvar) :=
  [label, 'integrate(f,oldvar), "=", integrate(f,oldvar)]$

i3(label,f,chvar) := block(
  [newvar,oldvar,intf,intg],
   newvar : lhs(chvar),
   oldvar : listofvars(rhs(chvar))[1],
   intf   : 'integrate(f,oldvar),
   intg   : changevar(intf, chvar, newvar, oldvar),
   [intf, "=", intg, chvar])$

  i3("3.", x^2*sqrt(x^3+1), u=x^3);




   [label, 'integrate(f,oldvar), "=", newvar, integrate(f,oldvar)])$

changevar(x^2*sqrt(x^3+1), u=x^3, u, x);


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);




  ["3.", x^2*sqrt(x^3+1),   x],


myintegrate3( "1.", cos(3*x), x);
myintegrate1(["1.", cos(3*x), x]);
myintegrates(
  ["1.", cos(3*x),          x],
  ["2.", x*(4+x^2)^10,      x],
  ["3.", x^2*sqrt(x^3+1),   x],
  ["4.", 1/(1-6*t)^4,       t],
  ["5.", cos(th)^3*sin(th), th],
  ["6.", sec(1/x)^2/x^2,    x]
);



#####
#
# Exercícios da p.302 do Leithold em português
# 2024apr14
#
#####

# «leithold-pt-p302»  (to ".leithold-pt-p302")
# (find-books "__analysis/__analysis.el" "leithold" "302" "Exercícios 5.2")
# (find-maximanode "while")
# (find-maximanode "return")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
** (find-angg "MAXIMA/gabmv1.mac")
load       ("~/MAXIMA/gabmv1.mac")$
assume(n>1)$
items : [
  ["1.", sqrt(1-4*y),         u=1-4*y],
  ["2.", (3*x - 1/4)^(1/3),   u=3*x-1/4],
  ["3.", (6   - 2*x)^(1/3),   u=6-2*x],
  ["4.", sqrt(5*r + 1),       u=5*r+1],
  ["5.", x*sqrt(x^2 - 9),     u=x^2-9],
  ["6.", 3*x*sqrt(4 - x^2),   u=4-x^2],
  ["7.", x^2*(x^3-1)^10,      u=x^3-1],
  ["8.", x*(2*x^2+1)^6,       u=2*x^2+1],
  ["9.", 5*x*(9-4*x^2)^(2/3), u=9-4*x^2],
  ["10.", x/(x^2+1)^3,        u=x^2+1]
  ]$
lfc_solve_m (items);
lfc_change_m(items);

myintegrates1(items);




#####
#
# miranda-p191
# 2024apr14
#
#####

# «miranda-p191»  (to ".miranda-p191")
# (find-books "__analysis/__analysis.el" "miranda" "191" "Exercícios")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
** (find-fline "~/MAXIMA/gabmv1.mac")
load          ("~/MAXIMA/gabmv1.mac")$
assume(n>1)$
items : [
  ["1.", x,       x],
  ["2.", 3*x+1,   x],
  ["3.", x^n,     x],
  ["4.", x^2+x+1, x],
  ["5.", 1/x^2,   x],
  ["6.", x+1/x^3, x],
  ["7.", x^(1/3), x],
  ["8.", 3*x^(2/7)+cos(x), x]
  ]$
lfv_solve_m(items);




#####
#
# miranda-p196
# 2024apr15
#
#####

# «miranda-p196»  (to ".miranda-p196")
# (find-books "__analysis/__analysis.el" "miranda" "196" "Exercícios")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
** (find-fline "~/MAXIMA/gabmv1.mac")
load          ("~/MAXIMA/gabmv1.mac")$
assume(n>1)$
items : [
  ["1.", 3*x^2*(x^3-5)^7,         u=x^3-5],
  ["2.", (2*x-5)*(x^2-5*x+7)^3,   u=x^2-5*x+7],
  ["3.", x*(x^2+1)^8,             u=x^2+1],
  ["4.", (12*x+14)*(3*x^2+7*x-1), u=3*x^2+7*x-1]
  ]$
lfc_change_m(items);
lfc_solve_m (items);




#####
#
# linel
# 2024apr15
#
#####

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

     'linel' is the assumed width (in characters) of the console display
     for the purpose of displaying expressions.  'linel' may be assigned
     any value by the user, although very small or very large values may
     be impractical.  Text printed by built-in Maxima functions, such as
     error messages and the output of 'describe', is not affected by
     'linel'.




#####
#
# integral-calculator
# 2024apr17
#
#####

# «integral-calculator»  (to ".integral-calculator")
# https://www.integral-calculator.com/
# https://news.ycombinator.com/item?id=40034869 Integral Calculator (integral-calculator.com)




#####
#
# mixima
# 2024apr25
#
#####

# «mixima»  (to ".mixima")
# https://github.com/maxima-project-on-github/mixima
# (find-maximamsg "58764586 202404 25" "RDodier: see the fork")





#####
#
# joel-moses
# 2024apr25
#
#####

# «joel-moses»  (to ".joel-moses")
# https://www.softwarepreservation.org/projects/LISP/MIT/MIT-LCS-TR-047-corrected-ocr.pdf
# https://infinite.mit.edu/video/joel-moses-phd-%E2%80%9967
# https://en.wikipedia.org/wiki/Joel_Moses




#####
#
# cabs
# 2024apr25
#
#####

# «cabs»  (to ".cabs")
# (find-maximanode "cabs")
# (find-maxima-links "cabs")
# (find-maximamsg "58758284 202404 09" "Stavros: Maxima is not very smart about the *conjugate*")
# (find-maximamsg "58758329 202404 09" "Torsten: unfortunately cabs(f) only works if")
# (find-maximamsg "58758346 202404 09" "Stavros: You changed the problem")

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
depends([x,y],t);
o : cabs(x+%i*y);
diff(o,t);

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
declare(f, complex, t, real); /* to be as clear as possible */
depends(f, t);
diff(cabs(f), t);




#####
#
# scalarmatrixp
# 2024apr25
#
#####

# «scalarmatrixp»  (to ".scalarmatrixp")
# (find-maxima-links "scalarmatrixp")
# (find-maximanode "scalarmatrixp")
# (find-maximamsg "58753998 202403 27" "LButler: scalarmatrixp : false")









# (info "(maxima)Functions and Variables for Polynomials")
# (info "(maxima)Functions and Variables for Polynomials")




# (find-maximagitfile "interfaces/emacs/emaxima/maxima-font-lock.el")
# (find-maximagitfile "interfaces/emacs/emaxima/maxima.el")
# (find-maximagitfile "interfaces/emacs/emaxima/emaxima.el")

# (find-fline "~/bigsrc/maxima/interfaces/emacs/emaxima/maxima.el")

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





# 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")





# 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" "AZorine: Iterated at")
# (find-maximamsg "37750831 202212 19" "Stavros: *map* maps over the *constituents*")
# (find-maximamsg "37779735 202302 17" "RAbert: Unexpected result from Trig-sub integral")
# (find-maximamsg "37801210 202304 07" "MTalon: A determinant computation")

https://maxima.sourceforge.io/misc/Fateman-Salz_Simplifier_Paper.pdf

https://wxmaximafor.wordpress.com/
https://wxmaximafor.files.wordpress.com/2015/06/wxmaxima_for_calculus_i_cq.pdf

# Fun example of the adaptive plot routine
# (find-maximamsg "37855544 202306 08" "RDodier: Fun ... adaptive plot")
# (find-maximamsg "37855477 202306 08" "RToy")
# (find-maximamsg "37855467 202306 08" "GKoenigsmann")

# (find-maximamsg "37884015 202308 15" "RDodier: cbrt / matchdeclare")
# (find-maximamsg "37883630 202308 14" "RDodier: work in progress: reshape")
# (find-maximamsg "38268418 202309 23" "HBaker: Stupid question re '??'")
# (find-maximamsg "38268394 202309 23" "JVillate: plot2d: make 'lines' share same style")

# (find-maximamsg "58738797 202402 17" "RDodier: modes of use of nonlexical symbols illuminated by lexical symbol stuff")
# (find-maximamsg "58738780 202402 17" "RDodier: progress report on lexical symbols stuff")
# (find-maximamsg "58738963 202402 18" "MTalon:  Re: progress report on lexical symbols stuff")
# (find-maximamsg "58739478 202402 19" "RToy:    Re: progress report on lexical symbols stuff")
# (find-maximamsg "58739110 202402 19" "RDodier: Re: progress report on lexical symbols stuff")
# (find-maximamsg "58741521 202402 25" "RFateman: numerics, NaNs, etc")


* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
plot2d([sin,cos],[x,0,2*%pi],[style,[lines,2,1]]);
plot2d([sin,cos],[x,0,2*%pi],[style,[lines,2,1],[lines,2,1]]);



https://maxima.common-lisp.dev/
https://maxima.common-lisp.dev/docs/maxima.pdf
http://www.austromath.at/daten/maxima/zusatz/Graphics_with_Maxima.pdf
https://maxima.sourceforge.io/docs/tutorial/en/minimal-maxima.pdf
https://maxima.sourceforge.io/docs/tutorial/en/talon-pattern.pdf

https://www.youtube.com/watch?v=V0h_6qdfIUY

https://frinklang.org/ It tracks units of measure (feet, meters, kilograms, watts, etc.) through all calculations
https://news.ycombinator.com/item?id=38125256 Frink is a programming language designed to make physical calculations simple (frinklang.org)

https://aezarebski.github.io/notes/maxima-notes.html#org2d0976c

https://def.fe.up.pt/pipermail/maxima-discuss/2008/021771.html powerdisp
https://def.fe.up.pt/pipermail/maxima-discuss/2008/021800.html global modulus
https://def.fe.up.pt/pipermail/maxima-discuss/2008/021808.html ^^-1 and invert
https://def.fe.up.pt/pipermail/maxima-discuss/2008/021842.html multiadditive
https://def.fe.up.pt/pipermail/maxima-discuss/2008/021845.html multiadditive
https://def.fe.up.pt/pipermail/maxima-discuss/2008/021849.html multiadditive
https://def.fe.up.pt/pipermail/maxima-discuss/2008/021968.html piecewise
https://def.fe.up.pt/pipermail/maxima-discuss/2008/021982.html curried
https://def.fe.up.pt/pipermail/maxima-discuss/2008/022034.html defrule and tellsimpafter
https://dl.acm.org/doi/10.1145/355694.355696 Analysis of Algorithms, A Case Study: Determinants of Matrices with Polynomial Entries
https://sourceforge.net/p/maxima/bugs/365/ orderless

# (find-maximamsg "58748861 202403 14" "EMajzoub: fourie.mac")
# (find-maximamsg "58749337 202403 15" "")
# (find-maximamsg "58749351 202403 15" "")
# (find-maximamsg "58749358 202403 15" "")
# (find-maximamsg "58749389 202403 15" "")
# (find-maximamsg "58749434 202403 15" "")
# (find-maximamsg "58749762 202403 17" "EMajzoub: fourie.mac")

# (find-maximamsg "58767797 202405 03" "submatrix assignment ala Matlab")
# (find-maximamsg "58768057 202405 03" "submatrix assignment ala Matlab")
# (find-maximamsg "58767855 202405 03" "Correct Syntax for Greek Letters in Maxima Batch Files for LaTeX Export")
# (find-maximamsg "58767860 202405 03" "Correct Syntax for Greek Letters in Maxima Batch Files for LaTeX Export")
# (find-maximamsg "58767880 202405 03" "Correct Syntax for Greek Letters in Maxima Batch Files for LaTeX Export")
# (find-maximamsg "58767881 202405 03" "Correct Syntax for Greek Letters in Maxima Batch Files for LaTeX Export")
# (find-maximamsg "58767884 202405 03" "Correct Syntax for Greek Letters in Maxima Batch Files for LaTeX Export")
# (find-maximamsg "58768025 202405 03" "Correct Syntax for Greek Letters in Maxima Batch Files for LaTeX Export")
# (find-maximamsg "58768059 202405 03" "Correct Syntax for Greek Letters in Maxima Batch Files for LaTeX Export")
# (find-maximamsg "58768066 202405 03" "Correct Syntax for Greek Letters in Maxima Batch Files for LaTeX Export")
# (find-maximamsg "58768098 202405 03" "Correct Syntax for Greek Letters in Maxima Batch Files for LaTeX Export")

https://themaximalist.org/page/4/ ***
https://lindnerdrwg.github.io/
https://lindnerdrwg.github.io/LAi1-matrix-algebra.pdf
https://georgeweigt.github.io/manual/eigenmath.pdf
https://github.com/georgeweigt/eigenmath





#  Local Variables:
#  coding:               utf-8-unix
#  modes: (fundamental-mode maxima-mode)
#  End: