9.2 Using Arithmetic Functions

Arithmetic functions are available in MPL when specifying coefficient values. They can be used in the model wherever you use coefficients.

The available functions are listed on the following page:

Arithmetic functions:

    ABS(x)      Absolute value of x
    EXP(x)      Exponential of x
    LOG(x)      Natural logarithm of x
    LOG10(x)    10 logarithm of x
    PI()        The value of Pi
    POWER(x,n)  Raises a number x to a power of n
    RANDOM(n)   Random generated value
    SIGN(x)     Sign of x
    SQR(x)      Square of x
    SQRT(x)     Square root of x

Trigonometric functions:

    ACOS(x)     Inverse cosine of x, cos-1(x)
    ACOSH(x)    Inverse hyperbolic cosine of x, cosh-1(x)
    ASIN(x)     Inverse sine of x, sin-1(x)
    ASINH(x)    Inverse hyperbolic sine of x, sinh-1(x)
    ATAN(x)     Inverse tangent of x, tan-1(x)
    ATANH(x)    Inverse hyperbolic tangent, tanh-1(x)
    COS(x)      Cosine of x, cos(x)
    COSH        Hyperbolic cosine of x, cosh(x)
    SIN(x)      Sine of x, sin(x)
    SINH        Hyperbolic sine of x, sinh(x)
    TAN(x)      Tangent of x, tan(x)
    TANH(x)     Hyperbolic tangent, tanh(x)

Integer functions:

    CEIL(x)     Next higher integer value of x
    FLOOR(x)    Next lower integer value of x
    ROUND(x)    Rounding to the nearest integer value of x
    TRUNC(x)    Truncating to the nearest integer value of x

Data vector functions:

    MAX(A)      Maximum value of a data vector A
    MIN(A)      Minimum value of a data vector A
    AVG(A)      Average value of a data vector A

The arithmetic functions expect a constant value (which can be a coef-ficient formula)or a datavector as argument, and return a real number. The functions operate on real numbers, except SQRT, LOG and LOG10 that take only positive numbers, EXP that takes only values less than 40, PI that has no arguments, and RANDOM that takes either no argument (returns real number between 0 and 1) or whole numbers (returns a whole number less than argument). You can also set a new seed value for the RANDOM function by adding seed=number after the argument. The integer functions expect a constant value as argument and return a whole number which can be used in subscript formulas. The data vector functions expect a defined data vector as argument and return a real number.


Examples of functions:

    ARCTAN(3.1415);

    SQR(183/2);

    RANDOM(100,seed=42);

    AVG(Demand);

Back To Top | Maximal Home Page | Table of Contents | Previous Page | Next Page