next up previous contents index
Next: Random number generator Up: Expressions Previous: Expressions   Contents   Index


Functions

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.

For those functions that accept or return angles that may be given in either degrees or radians (sin(x), cos(x), tan(x), asin(x), acos(x), atan(x), atan2(x) and arg(z)), the unit may be selected by set angles, which defaults to radians.

Math library functions
Function Arguments Returns
abs(x) any absolute value of 7#7, 8#8; same type
abs(x) complex length of 7#7, 9#9
acos(x) any 10#10 (inverse cosine)
acosh(x) any 11#11 (inverse hyperbolic cosine) in radians
arg(x) complex the phase of 7#7
asin(x) any 12#12 (inverse sin)
asinh(x) any 13#13 (inverse hyperbolic sin) in radians
atan(x) any 14#14 (inverse tangent)
atan2(y,x) int or real 15#15 (inverse tangent)
atanh(x) any 16#16 (inverse hyperbolic tangent) in radians
besj0(x) int or real 17#17 Bessel function of 7#7, in radians
besj1(x) int or real 18#18 Bessel function of 7#7, in radians
besy0(x) int or real 19#19 Bessel function of 7#7, in radians
besy1(x) int or real 20#20 Bessel function of 7#7, in radians
ceil(x) any 21#21, smallest integer not less than 7#7 (real part)
cos(x) any 22#22, cosine of 7#7
cosh(x) any 23#23, hyperbolic cosine of 7#7 in radians
erf(x) any 24#24, error function of real(7#7)
erfc(x) any 25#25, 1.0 - error function of real(7#7)
exp(x) any 26#26, exponential function of 7#7
floor(x) any 27#27, largest integer not greater than 7#7 (real part)
gamma(x) any 28#28, gamma function of real(7#7)
ibeta(p,q,x) any 29#29, ibeta function of real(30#30,31#31,7#7)
inverf(x) any inverse error function of real(7#7)
igamma(a,x) any 32#32, igamma function of real(33#33,7#7)
imag(x) complex imaginary part of 7#7 as a real number
invnorm(x) any inverse normal distribution function of real(7#7)
int(x) real integer part of 7#7, truncated toward zero
lambertw(x) real Lambert W function
lgamma(x) any 34#34, lgamma function of real(7#7)
log(x) any 35#35, natural logarithm (base 36#36) of 7#7
log10(x) any 37#37, logarithm (base 38#38) of 7#7
norm(x) any normal distribution (Gaussian) function of real(7#7)
rand(x) any 39#39, pseudo random number generator
real(x) any real part of 7#7
sgn(x) any 1 if 40#40, -1 if 41#41, 0 if 42#42. imag(7#7) ignored
sin(x) any 43#43, sine of 7#7
sinh(x) any 44#44, hyperbolic sine of 7#7 in radians
sqrt(x) any 45#45, square root of 7#7
tan(x) any 46#46, tangent of 7#7
tanh(x) any 47#47, hyperbolic tangent of 7#7 in radians

String functions
Function Arguments Returns
gprintf("format",x) any string result from applying gnuplot's format parser
sprintf("format",x,...) multiple string result from C-language sprintf
strlen("string") string int length of string
strstrt("string","key") strings int index of first character of substring "key"
substr("string",beg,end) multiple string "string"[beg:end]
system("command") string string containing output stream of shell command
word("string",n) string, int returns the nth word in "string"
words("string") string returns the number of words in "string"

other gnuplot functions
Function Arguments Returns
column(x) int column 7#7 during datafile manipulation.
defined(X) variable name [DEPRECATED] returns 1 if X is defined, 0 otherwise.
exists("X") "variable name" returns 1 if a variable named X is defined, 0 otherwise.
stringcolumn(x) int content of column 7#7 as a string.
timecolumn(x) int timecolumn 7#7 during datafile manipulation.
tm_hour(x) int the hour
tm_mday(x) int the day of the month
tm_min(x) int the minute
tm_mon(x) int the month
tm_sec(x) int the second
tm_wday(x) int the day of the week
tm_yday(x) int the day of the year
tm_year(x) int the year
valid(x) int test validity of 48#48 during datafile manip.
See also

http://www.gnuplot.info/demo/airfoil.htmlairfoil.dem: use of functions and complex variables for airfoils demo.



Subsections
next up previous contents index
Next: Random number generator Up: Expressions Previous: Expressions   Contents   Index
Ethan Merritt 2007-03-03