User Tools

Site Tools


gams:difference_between_the_-operator_and_the_power_function

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Last revision Both sides next revision
gams:difference_between_the_-operator_and_the_power_function [2008/04/02 17:55]
Franz Nelissen
gams:difference_between_the_-operator_and_the_power_function [2008/04/02 20:06]
support
Line 1: Line 1:
 ====== What is the difference between the ** operator and the power function? ====== ====== What is the difference between the ** operator and the power function? ======
    
-The power function ''​power(x,​y)''​ is an integer power and thus the exponent y must be an integer.+The power function ''​power(x,​y)''​ is an integer power and thus the exponent ​''​y'' ​must be an integer.
  
 This is not required for the %%**%% operator. ​ %%x**y%% is a real power and gets evaluated as ''​exp(y * log(x))''​. This is not required for the %%**%% operator. ​ %%x**y%% is a real power and gets evaluated as ''​exp(y * log(x))''​.
-However in that case x must be a positive number (or y >= 0, if  x = 0) to avoid an execution error. So: +However in that case ''​x'' ​must be a positive number (or ''​y >= 0''​, if  ​''​x = 0''​) to avoid an execution error. So: 
 <​code>​ <​code>​
 scalar test;  scalar test; 
Line 11: Line 11:
 display test;  display test; 
 </​code>​ </​code>​
-will give you an error: ​+will return ​an error: ​
 <​code>​ <​code>​
 **** Exec Error at line 2: rPower: FUNC DOMAIN: x**y, x < 0 **** Exec Error at line 2: rPower: FUNC DOMAIN: x**y, x < 0
IMPRESSUM / LEGAL NOTICEPRIVACY POLICY gams/difference_between_the_-operator_and_the_power_function.txt ยท Last modified: 2008/07/26 05:49 by support