### Summation over a Intervall

Posted:

**Tue Jul 09, 2019 4:33 pm**I want to do a summation over the intervall FE(i) to SE(i). My idea was to solve it like this (the whole code you can find at the end of the text):

TEST(i)=sum(t$(t ge FE(i) and t le SE(i)),1;

This returns errors. How can i code it whitout using card()? Since I want to make use of the value and not the postition of the set member.

Thank you in advance

-----------------------------------------------------------------------------------------------------------------------------------------------

set i /1*4/;

set t /1*100/;

parameter FE(i) /1 3

2 8

3 10

4 15/;

parameter SE(i) /1 5

2 11

3 14

4 20/;

parameter TEST(i);

TEST(i)=sum(t$(t ge FE(i) and t le SE(i)),1;

TEST(i)=sum(t$(t ge FE(i) and t le SE(i)),1;

This returns errors. How can i code it whitout using card()? Since I want to make use of the value and not the postition of the set member.

Thank you in advance

-----------------------------------------------------------------------------------------------------------------------------------------------

set i /1*4/;

set t /1*100/;

parameter FE(i) /1 3

2 8

3 10

4 15/;

parameter SE(i) /1 5

2 11

3 14

4 20/;

parameter TEST(i);

TEST(i)=sum(t$(t ge FE(i) and t le SE(i)),1;