Page 1 of 1

### Loop

Posted: Thu May 02, 2019 9:02 pm
Hello everyone,

I'm bigginer on GAMS, and i'm trying to use if for a modeling problem, nevertheless, i can't make the true syntax for the following loop,
Can sameone help me doing it, thank you in advance,

### Re: Loop

Posted: Fri May 03, 2019 1:56 pm
Hi, do you need the loop to define a parameter or is it an equation?
No loops are used to define equations.
anyway, you don't need a loop for this definition.

as a equation:

Code: Select all

``````set
i /1*13/
;
alias(i,j,k)
eq(i).. log(gamma(i)) =e= - A*power(z(i),2) + 2*sum(j\$(ord(j) ne ord(i)),m(j)*(B_0(i,j) + B_1(i,j)/(2*I)))
+ power(z(i),2)*sum((j,k)\$(ord(j) ne ord(i) and ord(k) ne ord(i) and ord(j) ne ord(k)),m(j)*m(k)*B_1(j,k)/(4*power(I,2)));
``````

as a parameter:

Code: Select all

``````gamma(i) = exp(- A*power(z(i),2) + 2*sum(j\$(ord(j) ne ord(i)),m(j)*(B_0(i,j) + B_1(i,j)/(2*I)))
+ power(z(i),2)*sum((j,k)\$(ord(j) ne ord(i) and ord(k) ne ord(i) and ord(j) ne ord(k)),m(j)*m(k)*B_1(j,k)/(4*power(I,2))));
``````
I think this is fine but, I suggest you check it.
bye

### Re: Loop

Posted: Fri May 03, 2019 2:09 pm
O thank you very much, I thaught that i had to use a loop,

I use your expression in in my code and it works very good,

Thank you again,