Another fun one: integrate(sqrt(-1),%i). Does the context magically tell
the system that sqrt(-1) is different from %i? -- you seem to want some
sort of local context here where %i represents a variable within the
integrate expression. What is the return value? Is it %i*%i, where the
first %i=sqrt(-1) and the second %i is a variable? And should that
simplify to -1? -- presumably not. I don't see how we'd be serving the
user here.
Now, there is a *principled* way of handling all this. In the
*principled *approach,
we don't integrate/ antidifferentiate expressions, but functions, e.g. the
function lambda([%i],sqrt(-1)), and variables are really lexical, so we can
freely rewrite this <textually> as lambda([anyvariable345], sqrt(-1)). The
result is not an expression, but the function
lambda([anyvariable345],sqrt(-1)*anyvariable345). We could even say that
integrate(X,Y) is a *shorthand* for integrate(lambda([Y],X),1), where '1'
specifies integration w.r.t. the first argument of the function. And the
result is lambda([Y],...), where the actual variable names are arbitrary.
But what is the shorthand for the result? Can we sweep the functional
nature under the rug? Users seem to like the names of variables they
choose (which is of course an argument for letting them use %i and %pi if
they want). They also seem to like things like ''(xxx) and expr:<this and
so>; integrate(expr,x); where <this and so> is not explicitly a function,
and is not in a lexical environment where 'x' is defined as a function
argument.
One of the advantages of Maxima over more formal systems is that we don't
force the user to over-formalize and to think about subtle stuff like this.
-s
On Tue, Jul 30, 2013 at 12:59 AM, Richard Fateman <fateman at berkeley.edu>wrote:
> type
>
> block([%i:5],%i);
>
> It gives an error: assignment: cannot assign to %i.
>
> Try it with %pi instead of %i and you get a different error:
> cannot assign to %pi; it is a declared numeric quantity.
>
> I think this tends to set a tone ...by what Maxima already does.
> using a constant as a programming variable is a no-no.
>
> Note it is ok to ask
>
> solve(%pi*r^2=A,%pi)
>
> RJF
>
>
>
> On 7/29/13 9:40 PM, Stavros Macrakis wrote:
>
> So what is your proposed value for diff(%i^2,%i)? ... I could *imagine* a
> system where %i^2 would not simplify to -1 before 'diff' saw it, but that
> is a very different system from the existing Maxima.
>
> What is the value of integrate(sqrt(%i),%i,-1,0) in your system? Is it
> 2/3*%i? The "outer" %i denotes something different from the "inner" %i.
> That seems... confusing.
>
>
> On Mon, Jul 29, 2013 at 11:50 PM, Robert Dodier <robert.dodier at gmail.com>wrote:
>
>> On 2013-07-27, Stavros Macrakis <macrakis at alum.mit.edu> wrote:
>>
>> > I hope you're pulling my leg.
>>
>> Of course not.
>>
>> > 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.
>>
>> It isn't nonsense -- the sense of it is that the symbol is being used in
>> a limited context with some meaning other than the one that generally
>> prevails. I claim that plot2d, as do sum and integrate, establishes such
>> a context. The difficulty, of course, is that Maxima is pretty clumsy
>> about handling context in general. But it is still useful to daydream
>> about what Maxima could do in a perfect world.
>>
>> "Everybody" knows that %pi represents the ratio of circumference to
>> diameter, but what if you use a more obscure symbol?
>> What if one share package declares %foo as a constant and another
>> package uses it as a variable? Whose problem is it to change the symbol?
>>
>> > 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.
>>
>> That is precisely the reason to allow it -- the user is, in effect,
>> declaring that they don't care about the special properties of the symbol.
>>
>> best
>>
>> Robert Dodier
>>
>> _______________________________________________
>> Maxima mailing list
>> Maxima at math.utexas.edu
>> http://www.math.utexas.edu/mailman/listinfo/maxima
>>
>
>
>
> _______________________________________________
> Maxima mailing listMaxima at math.utexas.eduhttp://www.math.utexas.edu/mailman/listinfo/maxima
>
>
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>
>