In general, any mathematical expression accepted by C, FORTRAN, Pascal, or BASIC is valid. The precedence of these operators is determined by the specifications of the C programming language. White space (spaces and tabs) is ignored inside expressions.
Complex constants may be expressed as the {<real>,<imag>}, where <real>
and <imag> must be numerical constants. For example, {3,2}
represents 3 + 2i; {0,1} represents i itself. The curly braces
are explicitly required here.
The functions in GNUPLOT are the same as the corresponding functions
in the Unix math library, except that all functions accept integer,
real, and complex arguments, unless otherwise noted. The sgn
function is also supported, as in BASIC.
The abs function returns the absolute value of its argument. The
returned value is of the same type as the argument.
For complex arguments, abs(x) is defined as the length of x in the complex plane [i.e., sqrt(real(x)**2 + imag(x)**2) ].
The acos function returns the arc cosine (inverse cosine) of its
argument. acos returns its argument in radians.
The arg function returns the phase of a complex number, in radians.
The asin function returns the arc sin (inverse sin) of its argument.
asin returns its argument in radians.
The atan function returns the arc tangent (inverse tangent) of its
argument. atan returns its argument in radians.
The besj0 function returns the j0th Bessel function of its argument.
besj0 expects its argument to be in radians.
The besj1 function returns the j1st Bessel function of its argument.
besj1 expects its argument to be in radians.
The besy0 function returns the y0th Bessel function of its argument.
besy0 expects its argument to be in radians.
The besy1 function returns the y1st Bessel function of its argument.
besy1 expects its argument to be in radians.
The ceil function returns the smallest integer that is not less than its
argument. For complex numbers, ceil returns the smallest integer
not less than the real part of its argument.
The cos function returns the cosine of its argument. cos expects its
argument to be in radians.
The cosh function returns the hyperbolic cosine of its argument.
cosh expects its argument to be in radians.
The erf function returns the error function of the real part of
its argument.
If the argument is a complex value, the imaginary component is ignored.
The erfc function returns 1.0 - the error function of the
real part of its argument.
If the argument is a complex value, the imaginary component is ignored.
The exp function returns the exponential function of its argument
(e raised to the power of its argument).
The floor function returns the largest integer not greater than its
argument. For complex numbers, floor returns the largest
integer not greater than the real part of its argument.
The gamma function returns the gamma function of the real part of
its argument. For integer n, gamma(n+1) = n! .
If the argument is a complex value, the imaginary component is ignored.
The ibeta function returns the incomplete beta function of the real
parts of its arguments. p, q > 0 and x in [0:1]
If the arguments are complex, the imaginary components are ignored.
The inverf function returns the inverse error function of the real
part of its argument.
The igamma function returns the incomplete gamma function of the real
parts of its arguments. a > 0 and x >= 0
If the arguments are complex, the imaginary components are ignored.
The imag function returns the imaginary part of its argument as a
real number.
The invnorm function returns the inverse normal distribution function
of the real part of its argument.
The int function returns the integer part of its argument, truncated
toward zero.
The lgamma function returns the natural logarithm of the gamma
function of the real part of its argument.
If the argument is a complex value, the imaginary component is ignored.
The log function returns the natural logarithm (base e) of its
argument.
The log10 function returns the logarithm (base 10) of its argument.
The norm function returns the normal distribution function
(or Gaussian) of the real part of its argument.
The rand function returns a pseudo random number in the interval [0:1]
using the real part of its argument as a seed. If seed < 0 the sequence
is (re)initialized.
If the argument is a complex value, the imaginary component is ignored.
The real function returns the real part of its argument.
The sgn function returns 1 if its argument is positive, -1 if its
argument is negative, and 0 if its argument is 0. If the argument
is a complex value, the imaginary component is ignored.
The sin function returns the sine of its argument. sin expects its
argument to be in radians.
The sinh function returns the hyperbolic sine of its argument. sinh
expects its argument to be in radians.
The sqrt function returns the square root of its argument.
The tan function returns the tangent of its argument. tan expects
its argument to be in radians.
The tanh function returns the hyperbolic tangent of its argument.
tanh expects its argument to be in radians.
The operators in GNUPLOT are the same as the corresponding operators in the C programming language, except that all operators accept integer, real, and complex arguments, unless otherwise noted. The ** operator (exponentiation) is supported, as in FORTRAN.
Parentheses may be used to change order of evaluation.
The following is a list of all the binary operators and their usages:
Symbol Example Explanation ** a**b exponentiation * a*b multiplication / a/b division % a%b * modulo + a+b addition - a-b subtraction == a==b equality != a!=b inequality & a&b * bitwise AND ^ a^b * bitwise exclusive OR | a|b * bitwise inclusive OR && a&&b * logical AND || a||b * logical OR ?: a?b:c * ternary operation
(*) Starred explanations indicate that the operator requires integer arguments.
Logical AND (&&) and OR (||) short-circuit the way they do in C. That is, the second && operand is not evaluated if the first is false; the second || operand is not evaluated if the first is true.
The ternary operator evaluates its first argument (a). If it is true (non-zero) the second argument (b) is evaluated and returned, otherwise the third argument (c) is evaluated and returned.
The following is a list of all the unary operators and their usages:
Symbol Example Explanation - -a unary minus ~ ~a * one's complement ! !a * logical negation ! a! * factorial
(*) Starred explanations indicate that the operator requires an integer argument.
The factorial operator returns a real number to allow a greater range.
Go to the first, previous, next, last section, table of contents.