From: David B. <dbm...@gm...> - 2022-01-11 03:47:02
|
I can help with some simple stuff. See if chapter 36. Function Definition in the manual makes more sense after you have tried a few examples. (%i1) display2d:false$ (%i2) f:x^2$ (%i3) g(x):=x^2; (%o3) g(x):=x^2 (%i4) functions; (%o4) [g(x)] (%i5) fundef(g); (%o5) g(x):=x^2 f is an expression, not a function. That is why it is not on the list functions. g is a function. You can find the function definition using the fundef() and dispfun() functions. ::= is the macro function definition. We can come back to macros later. On 11/01/2022 13:58, Eduardo Ochs wrote: > 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... > > > > _______________________________________________ > Maxima-discuss mailing list > Max...@li... > https://lists.sourceforge.net/lists/listinfo/maxima-discuss |