Question: sum with 'safe' dummy parameter design

In connection with this thread about annihilation/creation operators, the issue of a "sum with 'safe' dummy parameter" was presented. In brief, what is the expected output for the following?

> a := 1; b := 2; j := 3

> sum(f(j), j=a..b)

sum interrupts with an error but one can say, with good reason, that the expected output is f(1) + f(2). But then what is the expected output of

> a := 1; b := 2; j := k

> sum(f(j, k), j=a..b)

Say we are happy with f(1, k) + f(2, k), so not f(1, 1) + f(2, 2). Then what is the expeced output of

> a := 1; b := 2; k := j;

> sum(f(j, k), j=a..b)

Say we are happy with f(1, 1), + f(2, 2).

If this is the case then I think we have a design to handle the dummy parameter. In brief: the summation index is not a local variable and use the standard full evaluation rule for everything but for the summation index (note the full evaluation rule would be applied to all of the summand but for occurrences of the summation index - it is tricky to implement but doable).

If we agree with this design, I am anyway mostly sure this would not be implemented within the standard Maple sum (backwards compatibility issues may appear) but, for instance, it could be implemented within Physics, either overloading the standard sum when Physics is loaded, or as a separate Physics:-Library:-sum command, that one could make it to the surface with ease entering with(Physics:-Library, sum).

Edgardo S. Cheb-Terrab
Physics, Maplesoft

Please Wait...