Standard mathematical and matrix functions are listed in this page. Users have also the option to define their own custom functions using user defined functions
Trigonometric and complex
Command 
Description 
Trigonometric sin function. 

Trigonometric cos function. 

Trigonometric tan function. 

Inverse trigonometric sin function. 

Inverse trigonometric cos function. 

Inverse trigonometric tan function. 

Same as atan, but returns angle in correct quadrant. 

Returns the real part of variable 

Returns the imaginary part of variable 

Complex conjugate 

Absolute value 

Phase of a complex number. 

Removes phase difference of more than 2\(\pi\). 
Logarithmic, exponential and power
Command 
Description 
The natural logarithm. Input can be complex or negative. 

The log, base 10. Input can be complex or negative. 

The square root. 

The exponential. 
Matrix functions
Command 
Description 
Returns the dimensions of a matrix. 

Returns the total number of elements in a matrix. 

Remove singleton dimensions from a matrix. 

The sum of a matrix. 

The product of elements in a matrix. 

The max value in a matrix. 

The min value in a matrix. 

The maximum value in a specified dimension of a matrix. 

The minimum value in a specified dimension of a matrix. 

The dot product of two vectors. 

The cross product of two vectors. 

Flip a matrix in one dimension. 

Linear interpolation function. 

Cubic spline interpolation. 

Polynomial fit. 

Evaluate the normal (Gaussian) probability density function (PDF) 

Evaluate the Pearson IV probability density function (PDF) 

Fit to the normal (Gaussian) probability density function (PDF) 

Fit to the Pearson IV probability density function (PDF) 

Integrate a matrix. 

Integrate a matrix, ignore singleton dimensions. 

Find values that satisfy a condition in a matrix. 

Find peaks in a matrix. 

Find the frequency, decay constant and Qfactor of resonances extracted from the time trace of a signal. 

Transpose a matrix. 

Transpose a matrix, and do complex conjugate. 

Perform matrix multiplication of two or more matrices. 

Reshape the matrix to have different dimensions conserving the overall product of the dimensions. 

Calculate the eigenvalues and/or eigenvectors of a matrix. 

Rearrange the dimensions of a matrix. 

Calculate the inverse of a matrix. 

Return the mean value of a matrix. 

Returns the variance. 

Returns the standard deviance. 

Returns a string value associated to specified point, given a file containing a map of values to a string. 

Returns a 3cell array for the decomposition. 

Returns the lower triangular matrix. 

Returns the matrix y to the L2norm. 

Calculates the covariance matrix. 

Calculates the correlation matrix. 

Generates a spatial correlation matrix. 

Calculates the transformation matrix. 

Samples function on a Chebyshev grid. 

Returns Chebyshev interpolation of a sampled function. 

Chebpol is similar to chebin command, but it offers additional control over the interpolation process as it allows to specify the polynomial order. 

Returns the first derivative of Chebyshev polynomials of a function sampled on the Chebyshev grid. 

Sorts a matrix in ascending or descending order. 

Sorts matrices in more complex ways than simply ascending or descending order of the array. 

Convolves two 2dimensional arrays. 
See also
String functions
Command 
Description 
Convert number to a string. 

Convert a string into a floating point number. 

Execute string containing Lumerical scripting language. 

Run a Lumerical script file. 

Returns the total length of the string. 

Returns a substring of a string, as a specified position and length. 

Returns the position of a substring in a string. 

Replaces a part of a string with another, at a specified position. 

Replaces all instances of a substring with another string. 

Split a single long string into a cell (string) array based on a delimiting character. 

Convert a string to upper case. 

Convert a string to lower case. 

Returns a string containing the equivalent script of a generate variable. 
Frequency and timedomain
Command 
Description 
Fast Fourier transform. 

Returns the angular frequency vector. 

Returns the spatial wavevector kx. 

Inverse fft. 

Chirped ztransform. 

Returns a matrix containing a rough surface characterized by an RMS amplitude. 
Line and polygon functions
Command 
Description 
Returns the area of a polygon. 

Returns the center of mass of a polygon. 

Determines if two polygons intersect. 

Determines if a series of points are inside our outside a polygon. 

Grows or shrinks a polygon by a specified amount. 

Combines two polygons into one with an and operation. 

Combines two polygons into one with an or operation. 

Combines two polygons into one by taking the difference. 

Combines two polygons into one with a xor operation. 

Returns the intersection of line segments. 

Determines if line segments cross each other. 
Colorimetry
Command 
Description 
Returns a set of color matching functions. 

Calculates the X, Y, Z tristimulus values for a set of color matching functions. 

Calculates the x, y chromaticity values for a set of color matching functions. 

Calculates the u, v chromaticity values for a set of color matching functions. 
Multilayer stack calculations
Command 
Description 
Calculates the reflection and transmission of a plane wave through a multilayer stack using the analytic transfer matrix method. 

Calculates the fields within a multilayer stack illuminated from below by a plane wave using the analytic transfer matrix method. 

Analytically calculates the dipole emission for a multilayer stack. 
Multiquantum well calculations
Command 
Description 
Calculates gain and spontaneous emission in multiple quantum well structures 

Returns material properties of the type and format required by mqwgain 
Ion implant doping calculations
Command 
Description 
Calculates the range of the doping profile from ion implant. 

Calculates the straggle of the doping profile from ion implant. 

Calculates the skewness of the doping profile from ion implant. 

Calculates the kurtosis of the doping profile from ion implant. 

Calculates the lateral scatter of the doping profile from ion implant. 
Miscellaneous
Command 
Description 
Round up. 

Round down. 

Modulus after division. 

Rounds to the nearest integer. 

Returns a uniformly distributed random number between 0 and 1. 

Returns a lognormal distributed random number. 

Returns a normally distributed random number. 

Resets the random number seed. 

Determines if a number is finite or NaN. 

Returns the solar power spectrum 

Returns 1 if all of the specified matrix entries are nonzero and returns 0 otherwise. 

Returns 1 if any of the specified matrix entries are nonzero and returns 0 otherwise. 

Interpolates a data set from a triangular to a rectilinear grid. 

Interpolates a data set in 3D from a tetrahedral to a rectangular grid. 

Returns approximated integration (first order quadrature) of data on a 2D finite element mesh. 

Returns approximated integration of data on a 3D finite element mesh. 

Returns truncated value to a user specified precision. 

Returns the error function. 

Returns the complementary error function. 

Returns the inverse error function. 

Returns the inverse complementary error function. 

Returns an array containing all unique values in a given matrix. 

Given a matrix of vertices, returns a matrix of unique vertices with differences in values larger than a specified tolerance. 

Takes the Chebyshev interpolation coefficients and returns the corresponding function samples 

Returns the Chebyshev interpolation coefficients 

Bessel function of the first kind 

Bessel function of the second kind 

Modified Bessel function of the first kind 

Modified Bessel function of the second kind 

Analytically calculates scattering, absorption, and extinction coefficients of a spherical particle. 

Analytically calculates scattered farfield functions of a spherical particle. 
