GAMSでの累乗
http://www.listserv.dfn.de/cgi-bin/wa?A2=ind1405&L=gams-l&T=0&P=271で、GAMSで累乗(冪乗)()を計算するための命令について議論されています。私もルールについてよくわすれるのでメモしておきます。
[x**n ]
これがGAMSにおけるの一つの表現方法であるが、これは
が正であるときにしか使えない。
が負である
ときに
**** Exec Error at line 14: rPower: FUNC DOMAIN: x**y, x < 0
GAMS User Manualでは"**"というオペレータについて次のように説明されている。
x**n is equivalent to the function call rPower(x,y) and is calculated inside GAMS as exp[n*log(x)]. This operation is not defined if x has a negative value, and an error will result. If the possibility of negative values for x is to be admitted and the exponent is known to be an integer, then a function call, power(x,n), is available.
[power(x,n) ]
xが負の値をとるときには、