How to compute sum with non consecutive indices in Maple?

160 Views Asked by At

Suppose we need to compute the sum in Maple,

$ \sum_{i = 0}^{10} 2^i $,

We can use the command,

sum(2^i, i = 0 .. 10)

Now, what if the indices are not consecutive like i = 0, 1, 2, 3, 4, [no 5], 6, 7, 8, 9, 10?

I tried sum(2^i, i = {0 .. 4, 6 .. 10}) but no luck.

2

There are 2 best solutions below

5
On BEST ANSWER

You should use the command "add" for instance

$$\rm {add}( 2^i, i=[0,1,2,5,6,9,10] )=1639.$$

Type in maple worksheet the following command $>?list$ to read about "list".

0
On

I think you can use

sum(2^i, i = 0 .. 10)-2^5