From stanly Sat Jan 8 11:19:21 1983 To: fateman Subject: comments on primer Status: R comments by Stanly Steinberg on MACSYMA Primer for VAX/UNIX by Richard Fateman The primer is excellent. I found chapter 1 much like what I do when I give demos or workshops on vaxima. For people who want to use vaxima on applied math problems, I include a lot of stuff on calculus before I start on programming. However, for programmers wanting to learn about symbol manipulation I would proceed as in the primer. The demos in my directory show how I introduce material for physics and applied math types. I found Chapter 2 especially interesting, helpful and, in fact, I learned a few new things. Some suggestions. On page 1-1 , near the bottom how about equivalent --> mathematically equivalent How about describing how to quit() right after how to start? The Rules 1.22 section is really good! Section 2.1 first line. f1 and f2 --> f1 and f2, defined below, I prefer the following program to compute n! to one containing an explicit loop. f(n) := block([temp], temp:1, while n > 1 do ( temp:n*temp, n:n-1, endwhile), temp)\$ The note in 2.4 on using an arbitrary number of parameters is very helpful. This is not in the old manual?? I would like to see the array convention removed from any future symbol manipulators. This could be replaced by some explicit convention for saving calculations! Serious Business (2.7) is excellent. In Section 2.9, I would have avoided the lambda notation (save this for much later) and would have included a call of the form: p[n](x) I find the use of functional notation much more natural for Newton's method. Thus I have a preference for a program of the following form: newton(f,x,x0,eps) := block([xnew,xtemp,numer], /* This is a program for estimating the zero of a function of a single variable. f is the name of a function of one variable x is the variable in which the zero is to be found x0 is an initial guess for the zero xnew is used to store the estimates of the zero xtemp is used to avoid a diff-subst confusion eps is the tolerance within which the zero is to be found numer is a flag */ numer:true, xnew:x0, fprime(x) := subst(x,xtemp,diff(f(xtemp),xtemp)), while abs(f(xnew)) > eps do ( xnew:xnew-f(xnew)/fprime(xnew)), return(xnew))\$ The use of the xtemp varible in the definition of fprime is, I believe, natural from the mathematical point of view. I don't remember this as always being true but, in fact, this program is broken! Thus if f(x) := (x-1)*(x-2) then all works. However, the call newton(sin,x,5,10^-5) will find a zero of the previously defined f! Try the program: test(f,x) := display(f(x)) ?Que pasa? On page 1-28, I don't understand the purpose of the declare construction of complex numbers. Section (Chapter) 3 page 1-29. This stuff is really important for my programs and cannot be over emphasized.