Inconsistency when using previously defined variables as arguments to functions



With respect to multiple/nested sums, Stavros wrote for me a 
very nice function a while ago:


/*
    Sum(expr, [i, i1, i2], [j, j1, j2], ...)

    returns the multiple (iterated) sum

      i2     j2	   k2	
      ---    ---	   ---	
      \	    \	   \	
      /	    /	   /	... (expr)
      ---    ---	   ---	
      i=i1   j=j1   k=k1

*/


Why not make that an official part of Maxima?



On 01/28/11 10:58 AM, Stavros Macrakis wrote:
> I suspect the biggest problem isn't syntactic, but conceptual.  Can we
> really train users to write
>
>       sum( j ->  sum ( i ->  1/(i+j), 1:10 ), 1:10 )
>
> instead of
>
>       sum(sum(1/(i+j),i,1,10),j,1,10)
>
> And really, we should also support
>
>       sum( sum ( i ->  j->  1/(i+j), 1:10 ), 1:10 )
>
> where the inner sum would return the function
>
>      j ->  1/(1+j) + 1/(2+j) + ...
>
> That would of course be horribly inefficient if implemented in the
> straightforward way....
>
>               -s
>
>
>
> On Thu, Jan 27, 2011 at 05:49, Barton Willis<willisb at unk.edu>  wrote:
>> -----maxima-bounces at math.utexas.edu wrote: -----
>>
>>>>>   But the traditional lambda syntax is clumsy and obscure to
>>>>>   non-computer-scientists.
>>>>
>>>>   you could write  function[k]:k  if that would make people happier.
>>
>> Another possibility:
>>
>>   (%i12) (infix("->",50,50),  "->"(x,f) ::= (x : if listp(x) then x else [x], buildq([x,f], lambda(x,f))))$
>>
>>   (%i15) x ->  x;
>>   (%o15) lambda([x],x)
>>
>>   (%i16) [a,b] ->  a+b;
>>   (%o16) lambda([a,b],b+a)
>>
>> --Barton
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>