Mathematical Functions
The following list includes the built-in mathematical functions that you can use when defining parameters and 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. These functions do not have units for their input or output arguments (unless where noted for trigonometric functions).
Exponential function ex. That is, exp(1) is the mathematical constant e (Euler’s number)
Psi function and its derivatives (psi(0,x) is the digamma function)
range(start,step,end)
Round to closest integer or to closest number with specified precision p (number of decimal digits). For negative p, round to closest integer number divisible by 10^(-p).
legendre
The legendre(l,x) function evaluates a Legendre polynomial Pl(x) of integer degree l:
The legendre(l,m,x) function evaluates an associated Legendre polynomial of integer degree l and order m:
The degree l must be a nonnegative constant integer, and the order m must be a constant integer. For |m| > l, legendre(l,m,x) returns zero.
poweps and sqrteps
The special power and square root functions poweps and sqrteps, respectively, are needed when the derivatives of expressions need to be evaluated near zero. For example, when evaluating the results of a small-signal analysis and computing the differential during postprocessing. The functions themselves evaluate to the exact value of the or power (^) and square root (sqrt), respectively. Epsilon is only added into the expressions for their derivatives. For an expression poweps(x,n) = a^n, its derivative with respect to x is n·(x+eps)^(n-1). For an expression sqrteps(x) = sqrt(x), its derivative is 0.5/sqrt(x+eps).
sphericaly
The sphericaly(l,m,theta,phi) function evaluates the spherical harmonic function :
where Pl is the Legendre polynomial of degree l. The degree l must be a nonnegative constant integer, and the order m must be a constant integer. For |m| > l, sphericaly(l,m,theta,phi) returns zero.
sphericalyr
The sphericalyr(l,m,theta,phi) function evaluates the real spherical harmonic function :
The degree l must be a nonnegative constant integer, and the order m must be a constant integer. For |m| > l, sphericalyr(l,m,theta,phi) returns zero. The arguments θ and φ must be real.
zernike
The zernike(m,n,r,phi) function evaluates a Zernike polynomial defined in the following way:
where is the radial part:
and is the normalization factor. The n argument is required to be a nonnegative constant integer, and the m argument is required to be a constant integer satisfying |m| ≤ l. The r and φ arguments are required to be real.