Mathematical Functions
The following list includes the built-in mathematical functions that you can use when defining variables or directly in expressions in the physics interface or feature settings, for example. The function names are reserved names that cannot be used for user-defined functions, but they can be used for variable and parameter names.
Table 5-6:
Mathematical Functions
Name
Description
Syntax example
abs
Absolute value
abs(x)
acos
Inverse cosine (in radians)
acos(x)
acosh
Inverse hyperbolic cosine
acosh(x)
acot
Inverse cotangent (in radians)
acot(x)
acoth
Inverse hyperbolic cotangent
acoth(x)
acsc
Inverse cosecant (in radians)
acsc(x)
acsch
Inverse hyperbolic cosecant
acsch(x)
arg
Phase angle (in radians)
arg(x)
asec
Inverse secant (in radians)
asec(x)
asech
Inverse hyperbolic secant
asech(x)
asin
Inverse sine (in radians)
asin(x)
asinh
Inverse hyperbolic sine
asinh(x)
atan
Inverse tangent (in radians)
atan(x)
atan2
Four-quadrant inverse tangent (in radians)
atan2(y,x)
atanh
Inverse hyperbolic tangent
atanh(x)
besselj
Bessel function of the first kind
besselj(a,x)
bessely
Bessel function of the second kind
bessely(a,x)
besseli
Modified Bessel function of the first kind
besseli(a,x)
besselk
Modified Bessel function of the second kind
besselk(a,x)
ceil
Nearest following integer
ceil(x)
conj
Complex conjugate
conj(x)
cos
Cosine (argument in radians)
cos(x)
cosh
Hyperbolic cosine
cosh(x)
cot
Cotangent (argument in radians)
cot(x)
coth
Hyperbolic cotangent
coth(x)
csc
Cosecant (argument in radians)
csc(x)
csch
Hyperbolic cosecant
csch(x)
erf
Error function
erf(x)
erfinv
Inverse error function
erfinv(x)
exp
Exponential function
e
x
. That is,
exp(1)
is the mathematical constant
e
(Euler’s number).
exp(x)
floor
Nearest previous integer
floor(x)
gamma
Gamma function
gamma(x)
imag
Imaginary part
imag(u)
log
Natural logarithm
log(x)
log10
Common logarithm (base 10)
log10(x)
log2
Base-2 logarithm
log2(x)
max
Maximum of two arguments
max(a,b)
min
Minimum of two arguments
min(a,b)
mod
Modulo operator
mod(a,b)
psi
Psi function and its derivatives
psi(x,k)
random
Random function, uniform distribution
random(x,y)
randomnormal
Random function, normal (Gaussian) distribution
randomnormal(x,y)
range
Create a range of numbers
range(a,step,b)
real
Real part
real(u)
round
Round to closest integer
round(x)
sec
Secant (argument in radians)
sec(x)
sech
Hyperbolic secant
sech(x)
sign
Signum function
sign(u)
sin
Sine (argument in radians)
sin(x)
sinh
Hyperbolic sine
sinh(x)
sqrt
Square root
sqrt(x)
tan
Tangent (argument in radians)
tan(x)
tanh
Hyperbolic tangent
tanh(x)