Documentation

### This is machine translation

Mouseover text to see original. Click the button below to return to the English version of the page.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

# Symbolic Math Toolbox Functions - By Category

## Symbolic Computations in MATLAB

### Symbolic Variables, Expressions, Functions, and Preferences

 `fold` Combine (fold) vector using function `piecewise` Conditionally defined expression or function `sym` Create symbolic variables, expressions, functions, matrices `str2sym` Evaluate string representing symbolic expression `symfun` Create symbolic functions `syms` Create symbolic variables and functions `symvar` Find symbolic variables in symbolic input `argnames` Input variables of symbolic function `children` Subexpressions or terms of symbolic expression `formula` Return body of symbolic function `has` Check if expression contains particular subexpression `pretty` Prettyprint symbolic expressions `isfinite` Check whether symbolic array elements are finite `isinf` Check whether symbolic array elements are infinite `isnan` Check whether symbolic array elements are NaNs `funtool` Function calculator `sympref` Set symbolic preferences

### Operators and Elementary Operations

 `minus` Symbolic subtraction `plus` Symbolic addition `times` Symbolic array multiplication `ldivide` Symbolic array left division `rdivide` Symbolic array right division `power` Symbolic array power `nthroot` Nth root of symbolic numbers `mtimes` Symbolic matrix multiplication `mldivide` Symbolic matrix left division `mrdivide` Symbolic matrix right division `mpower` Symbolic matrix power `transpose` Symbolic matrix transpose `ctranspose` Symbolic matrix complex conjugate transpose `eq` Define symbolic equation `ge` Define greater than or equal to condition `gt` Define greater than relation `le` Define less than or equal to condition `lt` Define less than relation `ne` Define inequality `has` Check if expression contains particular subexpression `in` Numeric type of symbolic input `isequal` Test equality of symbolic inputs `isequaln` Test symbolic objects for equality, treating NaN values as equal `piecewise` Conditionally defined expression or function `and` Logical AND for symbolic expressions `not` Logical NOT for symbolic expressions `or` Logical OR for symbolic expressions `xor` Logical XOR for symbolic expressions `all` Test whether all equations and inequalities represented as elements of symbolic array are valid `any` Test whether at least one of equations and inequalities represented as elements of symbolic array is valid `has` Check if expression contains particular subexpression `in` Numeric type of symbolic input `isequaln` Test symbolic objects for equality, treating NaN values as equal `isfinite` Check whether symbolic array elements are finite `isinf` Check whether symbolic array elements are infinite `isnan` Check whether symbolic array elements are NaNs `logical` Check validity of equation or inequality `mod` Symbolic modulus after division `quorem` Quotient and remainder `conj` Complex conjugate of symbolic input `imag` Imaginary part of complex number `real` Real part of complex number

### Conversion Between Symbolic and Numeric

 `cell2sym` Convert cell array to symbolic array `double` Convert symbolic values to MATLAB double precision `poly2sym` Create symbolic polynomial from vector of coefficients `sym` Create symbolic variables, expressions, functions, matrices `sym2cell` Convert symbolic array to cell array `sym2poly` Extract vector of all numeric coefficients, including zeros, from symbolic polynomial `symfun` Create symbolic functions `vpa` Variable-precision arithmetic (arbitrary-precision arithmetic)

### Units of Measurement

 `checkUnits` Check for compatible dimensions and consistent units `findUnits` Find units in input `isUnit` Determine if input is a symbolic unit `mixedUnits` Split unit into sum of units `newUnit` Define new unit `removeUnit` Remove unit `rewrite` Rewrite expression in terms of another function `separateUnits` Separate units from expression `simplify` Algebraic simplification `str2symunit` Convert character vector or string to unit `symunit` Units of measurement `symunit2str` Convert unit to character vector `unitConversionFactor` Conversion factor between units `unitConvert` Convert units to other units of measurement `unitInfo` Information on units of measurement `baseUnits` Base units of unit system `derivedUnits` Derived units of unit system `newUnitSystem` Define unit system `removeUnitSystem` Remove unit system `unitSystems` List available unit systems

## Mathematics

### Equation Solving

 `equationsToMatrix` Convert linear equations to matrix form `eliminate` Eliminate variables from polynomial equations `finverse` Functional inverse `linsolve` Solve linear equations in matrix form `poles` Poles of expression or function `solve` Equations and systems solver `vpasolve` Solve equations numerically `dsolve` Differential equations and systems solver `massMatrixForm` Extract mass matrix and right side of semilinear system of differential algebraic equations `odeFunction` Convert symbolic expressions to function handle for ODE solvers `odeToVectorField` Reduce order of differential equations to 1 `daeFunction` Convert system of differential algebraic equations to MATLAB function handle suitable for ode15i `decic` Find consistent initial conditions for first-order implicit ODE system with algebraic constraints `findDecoupledBlocks` Search for decoupled blocks in systems of equations `incidenceMatrix` Find incidence matrix of system of equations `isLowIndexDAE` Check if differential index of system of equations is lower than 2 `massMatrixForm` Extract mass matrix and right side of semilinear system of differential algebraic equations `odeFunction` Convert symbolic expressions to function handle for ODE solvers `reduceDAEIndex` Convert system of first-order differential algebraic equations to equivalent system of differential index 1 `reduceDAEToODE` Convert system of first-order semilinear differential algebraic equations to equivalent system of differential index 0 `reduceDifferentialOrder` Reduce system of higher-order differential equations to equivalent system of first-order differential equations `reduceRedundancies` Simplify system of first-order differential algebraic equations by eliminating redundant equations and variables

### Formula Manipulation and Simplification

 `simplify` Algebraic simplification `simplifyFraction` Simplify symbolic rational expressions `subexpr` Rewrite symbolic expression in terms of common subexpressions `coeffs` Coefficients of polynomial `expand` Expand expressions and simplify inputs of functions by using identities `horner` Horner nested polynomial representation `numden` Extract numerator and denominator `partfrac` Partial fraction decomposition `children` Subexpressions or terms of symbolic expression `collect` Collect coefficients `combine` Combine terms of identical algebraic structure `compose` Functional composition `divisors` Divisors of integer or expression `factor` Factorization `isolate` Isolate variable or expression in equation `lhs` Left side (LHS) of equation `rewrite` Rewrite expression in terms of another function `rhs` Right side (RHS) of equation `pretty` Prettyprint symbolic expressions `subexpr` Rewrite symbolic expression in terms of common subexpressions `subs` Symbolic substitution

### Calculus

 `diff` Differentiate symbolic expression or function `functionalDerivative` Functional derivative `int` Definite and indefinite integrals `rsums` Interactive evaluation of Riemann sums `vpaintegral` Numerical integration using variable precision `curl` Curl of vector field `divergence` Divergence of vector field `gradient` Gradient vector of scalar function `hessian` Hessian matrix of scalar function `jacobian` Jacobian matrix `laplacian` Laplacian of scalar function `potential` Potential of vector field `vectorPotential` Vector potential of vector field `pade` Pade approximant `rsums` Interactive evaluation of Riemann sums `series` Puiseux series `taylor` Taylor series `taylortool` Taylor series calculator `cumprod` Symbolic cumulative product `cumsum` Symbolic cumulative sum `symprod` Product of series `symsum` Sum of series `limit` Limit of symbolic expression `fourier` Fourier transform `ifourier` Inverse Fourier transform `ilaplace` Inverse Laplace transform `iztrans` Inverse Z-transform `laplace` Laplace transform `sympref` Set symbolic preferences `ztrans` Z-transform

### Linear Algebra

 `cat` Concatenate symbolic arrays along specified dimension `colon` Create symbolic vectors, array subscripting, and for-loop iterators `horzcat` Concatenate symbolic arrays horizontally `sort` Sort elements of symbolic vectors or matrices `vertcat` Concatenate symbolic arrays vertically `diag` Create diagonal matrix or get diagonals from symbolic matrices `reshape` Reshape symbolic array `tril` Return lower triangular part of symbolic matrix `triu` Return upper triangular part of symbolic matrix `adjoint` Classical adjoint (adjugate) of square matrix `cond` Condition number of matrix `det` Determinant of symbolic matrix `equationsToMatrix` Convert linear equations to matrix form `inv` Inverse of symbolic matrix `linsolve` Solve linear equations in matrix form `norm` Norm of matrix or vector `pinv` Moore-Penrose inverse (pseudoinverse) of symbolic matrix `rank` Find rank of symbolic matrix `rref` Reduced row echelon form of matrix (Gauss-Jordan elimination) `colspace` Basis for column space of matrix `null` Form basis for null space of matrix `orth` Orthonormal basis for range of symbolic matrix `chol` Cholesky factorization `lu` LU factorization `qr` QR factorization `svd` Singular value decomposition of symbolic matrix `charpoly` Characteristic polynomial of matrix `eig` Eigenvalues and eigenvectors of symbolic matrix `jordan` Jordan normal form (Jordan canonical form) `curl` Curl of vector field `divergence` Divergence of vector field `gradient` Gradient vector of scalar function `hessian` Hessian matrix of scalar function `jacobian` Jacobian matrix `laplacian` Laplacian of scalar function `potential` Potential of vector field `vectorPotential` Vector potential of vector field `hermiteForm` Hermite form of matrix `jordan` Jordan normal form (Jordan canonical form) `smithForm` Smith form of matrix `bernsteinMatrix` Bernstein matrix `toeplitz` Symbolic Toeplitz matrix `expm` Matrix exponential `funm` General matrix function `logm` Matrix logarithm `sqrtm` Matrix square root

### Assumptions

 `assume` Set assumption on symbolic object `assumeAlso` Add assumption on symbolic object `assumptions` Show assumptions affecting symbolic variable, expression, or function `in` Numeric type of symbolic input `piecewise` Conditionally defined expression or function `isAlways` Check whether equation or inequality holds for all values of its variables `logical` Check validity of equation or inequality

### Polynomials

 `coeffs` Coefficients of polynomial `gbasis` Reduced Groebner basis `poly2sym` Create symbolic polynomial from vector of coefficients `polynomialDegree` Degree of polynomial `polynomialReduce` Reduce polynomials by division `resultant` Resultant of two polynomials `root` Represent roots of polynomial `sym2poly` Extract vector of all numeric coefficients, including zeros, from symbolic polynomial `charpoly` Characteristic polynomial of matrix `minpoly` Minimal polynomial of matrix `bernstein` Bernstein polynomials `chebyshevT` Chebyshev polynomials of the first kind `chebyshevU` Chebyshev polynomials of the second kind `gegenbauerC` Gegenbauer polynomials `hermiteH` Hermite polynomials `jacobiP` Jacobi polynomials `laguerreL` Generalized Laguerre Function and Laguerre Polynomials `legendreP` Legendre polynomials

### Mathematical Functions

 `catalan` Catalan constant `eulergamma` Euler-Mascheroni constant `log` Natural logarithm of entries of symbolic matrix `log10` Log base 10 of symbolic input `log2` Log base 2 of symbolic input `dilog` Dilogarithm function `polylog` Polylogarithm `psi` Digamma function `zeta` Riemann zeta function `sin` Symbolic sine function `sinc` Normalized sinc function `cos` Symbolic cosine function `tan` Symbolic tangent function `cot` Symbolic cotangent function `sec` Symbolic secant function `csc` Symbolic cosecant function `asin` Symbolic inverse sine function `acos` Symbolic inverse cosine function `atan` Symbolic inverse tangent function `acot` Symbolic inverse cotangent function `asec` Symbolic inverse secant function `acsc` Symbolic inverse cosecant function `sinh` Symbolic hyperbolic sine function `cosh` Symbolic hyperbolic cosine function `tanh` Symbolic hyperbolic tangent function `coth` Symbolic hyperbolic cotangent function `sech` Symbolic hyperbolic secant function `csch` Symbolic hyperbolic cosecant function `asinh` Symbolic inverse hyperbolic sine function `acosh` Symbolic inverse hyperbolic cosine function `atanh` Symbolic inverse hyperbolic tangent function `acoth` Symbolic inverse hyperbolic cotangent function `asech` Symbolic inverse hyperbolic secant function `acsch` Symbolic inverse hyperbolic cosecant function `abs` Symbolic absolute value (complex modulus or magnitude) `angle` Symbolic polar angle `atan2` Symbolic four-quadrant inverse tangent `imag` Imaginary part of complex number `real` Real part of complex number `sign` Sign of real or complex value `signIm` Sign of the imaginary part of complex number `beta` Beta function `factorial` Factorial of symbolic input `gamma` Gamma function `gammaln` Logarithmic gamma function `igamma` Incomplete gamma function `nchoosek` Binomial coefficient `pochhammer` Pochhammer symbol `dawson` Dawson integral `erf` Error function `erfc` Complementary error function `erfcinv` Inverse complementary error function `erfi` Imaginary error function `erfinv` Inverse error function `fresnelc` Fresnel cosine integral function `fresnels` Fresnel sine integral function `coshint` Hyperbolic cosine integral function `cosint` Cosine integral function `ei` One-argument exponential integral function `expint` Exponential integral function `eulergamma` Euler-Mascheroni constant `logint` Logarithmic integral function `sinhint` Hyperbolic sine integral function `sinint` Sine integral function `ssinint` Shifted sine integral function `ellipke` Complete elliptic integrals of the first and second kinds `ellipticCE` Complementary complete elliptic integral of the second kind `ellipticCK` Complementary complete elliptic integral of the first kind `ellipticCPi` Complementary complete elliptic integral of the third kind `ellipticE` Complete and incomplete elliptic integrals of the second kind `ellipticF` Incomplete elliptic integral of the first kind `ellipticK` Complete elliptic integral of the first kind `ellipticNome` Elliptic nome function `ellipticPi` Complete and incomplete elliptic integrals of the third kind `jacobiAM` Jacobi amplitude function `jacobiCD` Jacobi CD elliptic function `jacobiCN` Jacobi CN elliptic function `jacobiCS` Jacobi CS elliptic function `jacobiDC` Jacobi DC elliptic function `jacobiDN` Jacobi DN elliptic function `jacobiDS` Jacobi DS elliptic function `jacobiNC` Jacobi NC elliptic function `jacobiND` Jacobi ND elliptic function `jacobiNS` Jacobi NS elliptic function `jacobiSC` Jacobi SC elliptic function `jacobiSD` Jacobi SD elliptic function `jacobiSN` Jacobi SN elliptic function `jacobiZeta` Jacobi zeta function `dirac` Dirac delta function `heaviside` Heaviside step function `kroneckerDelta` Kronecker delta function `rectangularPulse` Rectangular pulse function `triangularPulse` Triangular pulse function `airy` Airy function `besselh` Bessel function of third kind (Hankel function) for symbolic expressions `besseli` Modified Bessel function of the first kind for symbolic expressions `besselj` Bessel function of the first kind for symbolic expressions `besselk` Modified Bessel function of the second kind for symbolic expressions `bessely` Bessel function of the second kind for symbolic expressions `hypergeom` Hypergeometric function `kummerU` Confluent hypergeometric Kummer U function `meijerG` Meijer G-function `whittakerM` Whittaker M function `whittakerW` Whittaker W function `lambertw` Lambert W function `wrightOmega` Wright omega function

### Numbers and Precision

 `digits` Change variable precision used `double` Convert symbolic values to MATLAB double precision `vpa` Variable-precision arithmetic (arbitrary-precision arithmetic) `imag` Imaginary part of complex number `real` Real part of complex number

### Number Theory

 `divisors` Divisors of integer or expression `gcd` GCD of numbers and polynomials `factorIntegerPower` Perfect power factoring `lcm` Least common multiple `mod` Symbolic modulus after division `powermod` Modular power of number `quorem` Quotient and remainder `rem` Remainder after division `bernoulli` Bernoulli numbers and polynomials `euler` Euler numbers and polynomials `fibonacci` Fibonacci numbers `harmonic` Harmonic function (harmonic number) `nextprime` Next prime number `nthprime` nth prime number `prevprime` Previous prime number

## Graphics

 `fcontour` Plot contours `fimplicit` Plot implicit symbolic equation or function `fimplicit3` Plot 3-D implicit equation or function `fmesh` Plot 3-D mesh `fplot` Plot symbolic expression or function `fplot3` Plot 3-D parametric curve `fsurf` Plot 3-D surface `ezcontour` Contour plotter `ezcontourf` Filled contour plotter `ezmesh` 3-D mesh plotter `ezmeshc` Combined mesh and contour plotter `ezplot` Plot symbolic expression, equation, or function `ezplot3` 3-D parametric curve plotter `ezpolar` Polar coordinate plotter `ezsurf` Plot 3-D surface `ezsurfc` Combined surface and contour plotter

## Code Generation

 `matlabFunction` Convert symbolic expression to function handle or file `matlabFunctionBlock` Convert symbolic expression to MATLAB function block `simscapeEquation` Convert symbolic expressions to Simscape language equations `symReadSSCParameters` Load parameters from Simscape component `symReadSSCVariables` Load variables from Simscape component `symWriteSSC` Create new Simscape component `ccode` C code representation of symbolic expression `fortran` Fortran representation of symbolic expression `latex` LaTeX form of symbolic expression `mathml` Generate MathML from symbolic expression `texlabel` TeX representation of symbolic expression

## MATLAB and MuPAD Integration

### MuPAD Files and Interfaces

 `allMuPADNotebooks` All open notebooks `close` Close MuPAD notebook `evaluateMuPADNotebook` Evaluate MuPAD notebook `mupad` Start MuPAD notebook `mupadNotebookTitle` Window title of MuPAD notebook `mupadwelcome` Start MuPAD interfaces `openmn` Open MuPAD notebook `openmu` Open MuPAD program file `openxvc` Open MuPAD uncompressed graphics file (XVC) `openxvz` Open MuPAD compressed graphics file (XVZ)

### Variables and Expressions Exchange

 `getVar` Get variable from MuPAD notebook `setVar` Assign variable in MuPAD notebook

### MuPAD to MATLAB Code Conversion

 `convertMuPADNotebook` Convert MuPAD notebook to MATLAB live script

#### Mathematical Modeling with Symbolic Math Toolbox

Get examples and videos