## GAMS Extrinsic function

Problems with syntax of GAMS
Haithamtaha
User
Posts: 6
Joined: 11 months ago

### GAMS Extrinsic function

I am using GAMS Extrinsic function "randweibull" to generate a random wind speed based on the shape and scale parameters and it works fine, the used statements are shown below:

\$FuncLibIn stolib stodclib
function randweibull /stolib.dweibull /
Set N / 1*24 /;
Set K / Weibull /;
Parameter randx(K,V) "distribution sample";
randx(N,"Weibull")= randweibull(2,6);

The problem that i can't call the random generated output randx in another table that used in some equations and functions. i tried to call them as below but it doesn't work

Table WD(t,*)
w d Duration
t1 randx(1) 0.684511335492475 1
t2 randx(2) 0.644122690036197 1
t3 randx(3) 0.6130691560297 1
t4 randx(4) 0.599733282530006 1
t5 randx(5) 0.588874071251667 1
t6 randx(6) 0.5980186702229 1
t7 randx(7) 0.626786054486569 1
t8 randx(8) 0.651743189178891 1
t9 randx(9) 0.706039245570585 1
t10 randx(10) 0.787007048961707 1
t11 randx(11) 0.839016955610593 1
t12 randx(12) 0.852733854067441 1
t13 randx(13) 0.870642027052772 1
t14 randx(14) 0.834254143646409 1
t15 randx(15) 0.816536483139646 1
t16 randx(16) 0.819394170318156 1
t17 randx(17) 0.874071251666984 1
t18 randx(18) 1 1
t19 randx(19) 0.983615926843208 1
t20 randx(20) 0.936368832158506 1
t21 randx(21) 0.887597637645266 1
t22 randx(22) 0.809297008954087 1
t23 randx(23) 0.74585635359116 1
t24 randx(24) 0.733473042484283 1;

i appreciate if anyone can help in this regard.

Renger
Posts: 496
Joined: 3 years ago

### Re: GAMS Extrinsic function

Hi
You can't put a function directly into a table.
Better to use it like in this example from the documentation:

Code: Select all

``````
set t /t1*t24/;

randx(t,"Weibull")= randweibull(2,6);

table WD(t,*) All values

table D(t,*) Duration values
/
Duration
t1 0.684511..
t2 ...
/;

WD(t,"Duration") =  randweibull(2,6);
display WD;
``````
Cheers
Renger
____________________________________
Enjoy modeling even more: Read my blog on modeling at The lazy economist