next up previous contents index
Next: Elliptic integrals 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 10#10, 11#11; same type
abs(x) complex length of 10#10, 12#12
acos(x) any 13#13 (inverse cosine)
acosh(x) any 14#14 (inverse hyperbolic cosine) in radians
arg(x) complex the phase of 10#10
asin(x) any 15#15 (inverse sin)
asinh(x) any 16#16 (inverse hyperbolic sin) in radians
atan(x) any 17#17 (inverse tangent)
atan2(y,x) int or real 18#18 (inverse tangent)
atanh(x) any 19#19 (inverse hyperbolic tangent) in radians
EllipticK(k) real k 20#20 (-1:1) 21#21 complete elliptic integral of the first kind
EllipticE(k) real k 20#20 [-1:1] 22#22 complete elliptic integral of the second kind
EllipticPi(n,k) real n4#41, real k 20#20 (-1:1) 23#23 complete elliptic integral of the third kind
besj0(x) int or real 24#24 Bessel function of 10#10, in radians
besj1(x) int or real 25#25 Bessel function of 10#10, in radians
besy0(x) int or real 26#26 Bessel function of 10#10, in radians
besy1(x) int or real 27#27 Bessel function of 10#10, in radians
ceil(x) any 28#28, smallest integer not less than 10#10 (real part)
cos(x) any 29#29, cosine of 10#10
cosh(x) any 30#30, hyperbolic cosine of 10#10 in radians
erf(x) any 31#31, error function of real(10#10)
erfc(x) any 32#32, 1.0 - error function of real(10#10)
exp(x) any 33#33, exponential function of 10#10
floor(x) any 34#34, largest integer not greater than 10#10 (real part)
gamma(x) any 35#35, gamma function of real(10#10)
ibeta(p,q,x) any 36#36, ibeta function of real(37#37,38#38,10#10)
inverf(x) any inverse error function of real(10#10)
igamma(a,x) any 39#39, igamma function of real(40#40,10#10)
imag(x) complex imaginary part of 10#10 as a real number
invnorm(x) any inverse normal distribution function of real(10#10)
int(x) real integer part of 10#10, truncated toward zero
lambertw(x) real Lambert W function
lgamma(x) any 41#41, lgamma function of real(10#10)
log(x) any 42#42, natural logarithm (base 43#43) of 10#10
log10(x) any 44#44, logarithm (base 45#45) of 10#10
norm(x) any normal distribution (Gaussian) function of real(10#10)
rand(x) any 46#46, pseudo random number generator
real(x) any real part of 10#10
sgn(x) any 1 if 47#47, -1 if 48#48, 0 if 49#49. imag(10#10) ignored
sin(x) any 50#50, sine of 10#10
sinh(x) any 51#51, hyperbolic sine of 10#10 in radians
sqrt(x) any 52#52, square root of 10#10
tan(x) any 53#53, tangent of 10#10
tanh(x) any 54#54, hyperbolic tangent of 10#10 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]
strftime("timeformat",t) any string result from applying gnuplot's time parser
strptime("timeformat",s) string seconds since year 2000 as given in string s
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 10#10 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 10#10 as a string.
timecolumn(x) int timecolumn 10#10 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 55#55 during datafile manip.



Subsections
next up previous contents index
Next: Elliptic integrals Up: Expressions Previous: Expressions   Contents   Index
2010-10-19