Getting error (rPower: FUNC DOMAIN: x**y, x < 0)

Hi,

When trying to run the below line, I’m getting “rPower: FUNC DOMAIN: xy, x < 0**

**al(i,j,k)$st(k) = (q.l(i,j,k)*((1/hh(i))+(1/hc(j))))/(dt.l(i,j,k)dt.l(i,j,k+1)(dt.l(i,j,k)+dt.l(i,j,k+1))/2)0.33333 ;

==

I follow this link (https://support.gams.com/gams:difference_between_the_-operator_and_the_power_function) and tried to replace the above line with the following below line but still not working, now getting (pow(x,i) is not integer)

al(i,j,k)$st(k) = power((q.l(i,j,k)*((1/hh(i))+(1/hc(j))))/(dt.l(i,j,k)dt.l(i,j,k+1)(dt.l(i,j,k)+dt.l(i,j,k+1))/2),0.33333) ;


Can you please help as I’m new to Gams?

First line of your linked support page:

The power function power(x,y) is an integer power and thus the exponent y must be an integer.

Looks to me like your exponent (0.3333) is not an integer…
This is the cause of your second error.

The first error is caused by the “base” (x) not being positive. This is a mathematical (ie not a programatical) error because, well… a negative number, raised to a non integer power is not a real number.

So, you should keep your original formulation (using **) and worry about how to handle negative cases.

Thanks.

Okay, I keep the original function.

How do I turn the base (x) to be positive please?

Hi, that is really a question you need to answer yourself, since it is your model and you know what values the variables appearing in that expression should take.

What do you think of this intrinsic function ?

signPower(x,Y)

It will get you the value of the real branch when it exists (which is your case).

Thank you.

Sorry Sir, can you be more explicit?
because first of all, I’m not a Mathematician, I’m just a programmer.
I also don’t know much of Gams as I just started, I’m busy on Gams Training session.

It’s an exercise which my teacher gave us in order to solve.

Can you please tell me exactly what to do in order to get it worked please, because I have to return it soon, Please.

Thanks in advance.