> 4. regarding Martin's bug reports; I have not looked through them all,
> and I suspect I am not receiving them now, but at least one of them
> I responded to and said I didn't think it was a bug. I checked and
> the semantics of f(x):=x::1 is the same as the common lisp
> (defun f(x)(eval '(set 'x 1)))) .
I did not say that they were bugs (in fact, I'm not quite sure which
reports you mean, the threads whose adresses I posted in the previous
post?
> > http://www.ma.utexas.edu/pipermail/maxima/2002/001179.html
> > http://www.ma.utexas.edu/pipermail/maxima/2002/001181.html
> >
> > http://www.ma.utexas.edu/pipermail/maxima/2002/001188.html
> > http://www.ma.utexas.edu/pipermail/maxima/2002/001190.html
> > http://www.ma.utexas.edu/pipermail/maxima/2002/001191.html
> >
> > http://www.ma.utexas.edu/pipermail/maxima/2002/001342.html
> > http://www.ma.utexas.edu/pipermail/maxima/2002/001343.html
> > http://www.ma.utexas.edu/pipermail/maxima/2002/001344.html
> > http://www.ma.utexas.edu/pipermail/maxima/2002/001345.html
NB: There are some bugs I filed, but except the simpsum bug (number
625278 or http://www.ma.utexas.edu/pipermail/maxima/2002/002979.html)
I can't remember anything very important just now...
In any case: I'm not qualified to argue in favor or against certain
semantics, I only felt that changes in semantics (or at least the
decision which semantics we want) should take place BEFORE 6.0, because
after this it might be difficult to change without disappointing too many
users.
> I am not sure what semantics Martin wishes, but my guess is that
> any use of the :: operator in Maxima is likely to be disappointing.
> In 35 years I can't recall ever using it, though there may be
> some occasion on which it was appropriate. The major question,
> unresolved, is that when you evaluate x before assigning 1 to
> it's value, WHERE do you evaluate x? What is the environment.
> Macsyma semantics, and indeed all computer algebra systems'
> semantics, are a little unusual with respect to evaluation of
> symbols. Sometimes x stands for x, sometimes x stands for its
> value. There are rules for different circumstances, but sometimes
> you want to break the rules.
> x:2
> sum(2^x,x,0,infinity). do you want to evaluate x in the
> expression 2^x? probably not.
>
> y:2
> sum(y^x,x,0,infinity); do you want to evaluate y ?
>
> z:y^k
> sum(z,k,0,infinity); do you wnat to evaluate z? yes.
I know that this issue is very tricky...
I believe it is like this at the moment:
the variable of summation is "local":
> x:2
> sum(2^x,x,0,infinity).
hence x should not be evaluated. But I wouldn't be surprised (as a user)
if it was.
> y:2
> sum(y^x,x,0,infinity); do you want to evaluate y ?
yes
> z:y^k
> sum(z,k,0,infinity); do you wnat to evaluate z? yes.
I'd say, that this is equal to
z:y^k;
sum(z,k1,0,infinity);
(hence: no) in contrast to
z(k):=y^k;
sum(z(n),n,0,infinity);
Again, I wouldn't be surprised if the answer was sum(y^k,k,0,infinity)...
But in this case, the answer to
> x:2
> sum(2^x,x,0,infinity).
should probably also be sum(2^2,x,0,infinity)...
Really, I think, that sum, integrate, diff, ... should take functions, not
"expressions" as arguments...
(this is maybe unachievable in maxima, maybe it would be possible to
provide a second set of procedures like lambdasum, lambdaintegrate,
lambdadiff, ... that does this...)
So the question remains, what semantics do we want? This should be made
very clear (I find your third example very instructive!)
An issue which I find easier is the following, as discussed in
http://www.ma.utexas.edu/pipermail/maxima/2002/001342.html
(C2) G(e,x) := block([z],
z : diff(e,x),
ev(z * e, ratsimp));
(D2) G(e,x):=BLOCK([z],z:DIFF(e,x),EV(z*e,RATSIMP))
I was very surprised to learn that the result of this function depends on
whether the argument e contains the symbol z or not...
(C3) G(x*a^8,x);
(D3) a^16*x /* this is what we want */
(C4) G(x*z^8,x);
(D4) x*z^128 /* yikes! this isn't what we want. */
I think, that z would be local to the block as the summation index is in
the sum... (although it's not a bug, I do find it rather inconvenient)
your reply was
> Another issue is "what environment does EV use" and
> that can be resolved in several ways, officially by
> using lexical or dynamic binding. Macsyma, along with
> its original host Lisp system, uses dynamic binding, a
> system that works pretty well for interactive programming
> but has problems with building of large static programs.
> Using warts helps. Lexical scope, used by Common Lisp
> and Scheme also helps.
so I would probably favor lexical scope... I am rather certain though that
helping to implement this is beyond my abilities!
Please notice that I certainly do not want to offend anybody, nor question
anybody's work on macsyma, maxima... I very much value your explanations
and comments! Without them I probably wouldn't understand lots of issues I
do (think I) understand now! Thus, often I ask just out of curiosity!
Martin