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 , legendre(l,m,x) returns zero.
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 , 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 , 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 . The r and arguments are required to be real.