Question: 2 small questions..

Hi dear Maple's gurus. I have the lists a and b: a:=[A, B, C] b:= [[K1,L1][K2,L2][K3,L3]] I want to add the each term of "a" in the intervals given in "b": sum(A from L1 to K1)+ ..+sum(C from L3 to K3). I tried with this procedure: > sums:= proc(a,b) local j,tot; tot:=0; for j from 1 to nops(a) do tot:=tot+sum(a[j], k=b[j,2]..b[j,1]); end do: end proc: >sums([a1,a2,a3],[[ku1,kl1],[ku2,kl2],[ku3,kl3]]); 1. Is there some more efficient way to do the same? 2. I would like also that the sums on a[j] under the following 2 join conditions: 2.1. assuming that a[j] is real and positive, and 2.2 that b[j,1]>=b[j,2] otherwise the terms became Zero: (a[j]=0). Thanks in advance, JJacques
Please Wait...