next up previous contents index
Next: Elliptic integrals Up: Expressions Previous: Expressions   Contents   Index

Functions

Arguments to math functions in gnuplot can be integer, real, or complex unless otherwise noted. Functions that accept or return angles (e.g. sin(x)) treat angle values as radians, but this may be changed to degrees using the command set angles.

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
airy(x) any Airy function Ai(x)
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
expint(n,x) int 34#34, real 35#35 36#36, exponential integral of 10#10
floor(x) any 37#37, largest integer not greater than 10#10 (real part)
gamma(x) any 38#38, gamma function of real(10#10)
ibeta(p,q,x) any 39#39, ibeta function of real(40#40,41#41,10#10)
inverf(x) any inverse error function of real(10#10)
igamma(a,x) any 42#42, igamma function of real(43#43,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 44#44, lgamma function of real(10#10)
log(x) any 45#45, natural logarithm (base 46#46) of 10#10
log10(x) any 47#47, logarithm (base 48#48) of 10#10
norm(x) any normal distribution (Gaussian) function of real(10#10)
rand(x) int pseudo random number in the interval [0:1]
real(x) any real part of 10#10
sgn(x) any 1 if 49#49, -1 if 50#50, 0 if 51#51. imag(10#10) ignored
sin(x) any 52#52, sine of 10#10
sinh(x) any 53#53, hyperbolic sine of 10#10 in radians
sqrt(x) any 54#54, square root of 10#10
tan(x) any 55#55, tangent of 10#10
tanh(x) any 56#56, hyperbolic tangent of 10#10 in radians
voigt(x,y) real Voigt/Faddeeva function 57#57
    Note: voigt58#58 = 59#59faddeeva60#60
     

Special functions from libcerf (only if available)
Function Arguments Returns
     
cerf(z) complex complex error function
cdawson(z) complex complex extension of Dawson's integral 61#61
faddeeva(z) complex rescaled complex error function 62#62
erfi(x) real imaginary error function 63#63
VP(x,64#64,65#65) real Voigt profile 66#66
     

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 in bytes
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 1970 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 or string column 10#10 during datafile manipulation.
columnhead(x) int string containing first entry of column 10#10 in datafile.
exists("X") string returns 1 if a variable named X is defined, 0 otherwise.
hsv2rgb(h,s,v) h,s,v 20#20 [0:1] 24bit RGB color value.
stringcolumn(x) int or string content of column 10#10 as a string.
timecolumn(N,"timeformat") int, string time data from column 67#67 during data input.
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
time(x) any the current system time
valid(x) int test validity of 68#68 during datafile manip.
value("name") string returns the value of the named variable.



Subsections
next up previous contents index
Next: Elliptic integrals Up: Expressions Previous: Expressions   Contents   Index
2015-04-14