x^y, where x<0 and y non-integer

Problems with syntax of GAMS
Post Reply
Loreno
User
User
Posts: 5
Joined: 6 years ago

x^y, where x<0 and y non-integer

Post by Loreno »

this seems silly, but i cant get it done:

i want to simply calculate

x^y, but neighter the **operator nor the power() function is working, because x<0 and y is non-integer.

example:

(-0.1)^(1/5)

how can i do this in gams?
Fred
Posts: 372
Joined: 7 years ago

Re: x^y, where x<0 and y non-integer

Post by Fred »

Loreno,

What you try to do is mathematically not defined.

Fred
Loreno
User
User
Posts: 5
Joined: 6 years ago

Re: x^y, where x<0 and y non-integer

Post by Loreno »

oh, i guess its been to long, that i have been to math class:) the reason i thought that it works, is that google actually gave me a result.

solution: (yes mathematicly not the same, but what i logicly wanted to do anyways)

-(abs(x)**y)
Fred
Posts: 372
Joined: 7 years ago

Re: x^y, where x<0 and y non-integer

Post by Fred »

Hi Loreno,

The signPower function may be what you are looking for: https://www.gams.com/latest/docs/UG_Par ... =signpower

I hope this helps!

Best,
Fred
Post Reply