I have the following problem - I need to minimize the sum in the maple. For example, suppose I have this:
EXPESSION:=A[0]+A[1]+A[2]+A[3]+A[4]+A[5];
And I want to use some function
someFunction(EXPRESSION);
which will return a symbol of the Sum (like sum(A[i], i = 0 .. 5));
Is some function like that exists?
Okay, I guess that you need something to compress an existing expession. If you're willing to specify the summand, index, and index range, then someFunction could subtract the terms and add the (unevaluated) Sum of those terms.
convert_to_Sum:= (ex, summand, index)->
simplify(ex - sum(summand, index) + Sum(summand, index))
;
Example:
ex:= A[0]+A[1]+A[2]+A[3]+A[4]+A[5];
convert_to_Sum(ex, A[i], i= 0..5);