Robert,
I hope you're pulling my leg.
Although Maxima is a permissive system in many ways -- and that is a good
thing -- allowing nonsensical operations without warning is bound to cause
problems. If the user really wants to use the symbol %pi for a variable,
they can subst something else for it.
How far do you want to take this? What about diff(2,2)? Should that be 0
because 2 is a constant, or 1 because 2 should be treated as a variable?
How about diff(2,1) -- do we treat 2 as = 2*1? Should we allow
block([%pi:22/7], ...)? How do we explain to a user that diff(%i^2,%i) is
0, but diff(%i,%i) is 1?
Besides the question of inconsistent results, there is the simple pragmatic
issue that I'm pretty confident that in the vast majority of cases where
users try to use %i, etc. as variables, that is not actually their intent.
Heck, if we're going to allow binding constants, why don't we allow %pi:
22/7, assert(equal(%pi,22/7)), and for that matter assert(-1 > 1)? After
all, "whether it makes sense is the user's problem, not ours".
-s
On Sat, Jul 27, 2013 at 7:25 PM, Robert Dodier <robert.dodier at gmail.com>wrote:
> On 2013-07-27, Stavros Macrakis <macrakis at alum.mit.edu> wrote:
>
> > I don't understand the gensym proposal -- under what circumstances would
> it
> > be useful to carry out plot2d(%pi,[%pi,0,1]) rather than giving an error?
> > (Currently, it plots 3.14 for x=0..1!)
> >
> > Every command that requires a symbolic variable argument should give an
> > error when called with a symbolic constant. I see that we are doing a
> poor
> > job of this: shockingly, none of *diff, integrate, plot2d, taylor, at,
> > allroots* perform this common-sense check, though some other functions
> do.
>
> Well, it doesn't seem so obvious to me. In general I am inclined to
> allow Maxima to do things which don't make much sense, as long as it
> is consistent and therefore predictable and comprehensible. I don't
> know why someone would want plot2d(%pi, [%pi, 0, 1]) but if they want
> it, by gum, let them have it. (Incidentally, the right answer is this
> case is a diagonal line from (0,0) to (1,1) -- a constant 3.14 is
> incorrect.)
>
> I recall there is the age-old trick of differentiating with respect to
> %pi in order to solve some integral. I'm not inclined to prohibit that --
> whether it makes sense is the user's problem, not ours.
>
> At this point I'm not 100% in favor of one proposal or the other,
> although I am leaning toward gensym substitution. But I might change
> my mind.
>
> best
>
> Robert Dodier
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>