I think there are two kinds of variables. Dummy variables and all the rest. In function definitions the parameters to
the function are dummy variables because they can be any valid Maxima symbol and in the function behavior it makes no
difference which one you use (or should not make any difference) as long as you are consistent. The same is true for
variables of integration, differentiation, summation, prod()'s and there are probably other examples which I don't have
at the tip of my fingers right now. Below there are two a's, one is a dummy variable the other is not. It's that
simple. I think I like it best when dummy variables are local to the expression (not local to the function, or a sum(),
prod() or integrate(). But non dummy variables should all be treated as having the one value. Dummy variables on the
other hand don't have a value, nor should they. So there is no confusion.
I think this is a bug.
(%i1) x:10;
(out1)
(%i2) diff(x^2,x);
diff: second argument must be a variable; found 10
-- an error. To debug this try: debugmode(true);
(%i3)
diff should hide the value of x at the top level, same for integrate and return 2*x or x^3/3 respectively.
I think the current behavior below is right.
(%i1) assume(a>0);
(out1) [a > 0]
(%i2) f(a):=if a<0 then -a else a;
(out2) f(a) := if a < 0 then - a else a
(%i3) f(a);
(out3) a
(%i4) f(u);
(out4) if u < 0 then - u else u
--------------------------------------------------
From: "Richard Fateman" <fateman at cs.berkeley.edu>
Sent: Tuesday, February 23, 2010 11:40 AM
To: "Stavros Macrakis" <macrakis at alum.mit.edu>; "Maxima List" <maxima at math.utexas.edu>
Subject: Re: [Maxima] $asksign might need its own context
>
> we could change the evaluation of a command on line %i10 to be something like evaluating
> block([],newcontext(%i10), ... result: whatever is on line 10 .... , revert context, return result),
>
> but this would not work if the command were, say, assume(a>0).
>
> We could allow assumptions to become "sticky" on command.
>
> I don't mind the current behavior, since it can be fixed by stating assumptions earlier, and it allows for
> the possibility that the two a's ARE different. Though how you would know which is which from the question...
> In particular, they are typically different in a case like this:
>
> f(a):= -a if a<0
> := a if a>=0
>
> (pick your own maxima syntax for expressing this).
>
> RJF
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>