# Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English verison of the page.

# Symbolic Math Toolbox Functions

## 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 expression, matrix, or function argnames Input variables of symbolic function children Subexpressions or terms of symbolic expression formula Mathematical expression defining symbolic function has Check if expression contains particular subexpression disp Display symbolic input display Display symbolic input 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 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 equation ge Define greater than or equal to relation gt Define greater than relation le Define less than or equal to relation 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 nnz Number of nonzero elements nonzeros Nonzero elements ceil Round symbolic matrix toward positive infinity fix Round toward zero floor Round symbolic matrix toward negative infinity frac Symbolic matrix element-wise fractional parts mod Symbolic modulus after division quorem Quotient and remainder round Symbolic matrix element-wise round conj Symbolic complex conjugate imag Imaginary part of complex number real Real part of complex number

### Conversion Between Symbolic and Numeric

 char Convert symbolic objects to character vectors cell2sym Convert cell array to symbolic array double Convert symbolic values to MATLAB double precision int8, int16, int32, int64 Convert symbolic matrix to signed integers poly2sym Create symbolic polynomial from vector of coefficients single Convert symbolic matrix to single precision 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 uint8, uint16, uint32, uint64 Convert symbolic matrix to unsigned integers vpa Variable-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 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 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 set of linear equations to matrix form finverse Functional inverse linsolve Solve linear system of equations given 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 Symbolic simplification of fractions subexpr Rewrite symbolic expression in terms of common subexpressions pretty Prettyprint symbolic expressions coeffs Coefficients of polynomial expand Symbolic expansion of polynomials and elementary functions 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 numel Number of elements of symbolic array size Symbolic matrix dimensions sort Sort elements of symbolic vectors or matrices vertcat Concatenate symbolic arrays vertically diag Create or extract diagonals of symbolic matrices reshape Reshape symbolic array tril Return lower triangular part of symbolic matrix triu Return upper triangular part of symbolic matrix adjoint Adjoint of symbolic square matrix cond Condition number of matrix det Compute determinant of symbolic matrix equationsToMatrix Convert set of linear equations to matrix form inv Compute symbolic matrix inverse linsolve Solve linear system of equations given 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 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 form of matrix 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 form of matrix 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 clear all Remove items from MATLAB workspace and reset MuPAD engine in Numeric type of symbolic input piecewise Conditionally defined expression or function reset Close MuPAD engine 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 poly2sym Create symbolic polynomial from vector of coefficients 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 Logarithm base 10 of entries of symbolic matrix log2 Logarithm base 2 of entries of symbolic matrix dilog Dilogarithm function polylog Polylogarithm psi Digamma function zeta Riemann zeta function sin Symbolic sine 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 Absolute value of real or complex value 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 function 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 besseli Modified Bessel function of the first kind besselj Bessel function of the first kind besselk Modified Bessel function of the second kind bessely Bessel function of the second kind 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 ceil Round symbolic matrix toward positive infinity conj Symbolic complex conjugate fix Round toward zero floor Round symbolic matrix toward negative infinity frac Symbolic matrix element-wise fractional parts imag Imaginary part of complex number max Largest elements min Smallest elements real Real part of complex number round Symbolic matrix element-wise round

### Number Theory

 bernoulli Bernoulli numbers and polynomials divisors Divisors of integer or expression euler Euler numbers and polynomials fibonacci Fibonacci numbers gcd Greatest common divisor harmonic Harmonic function (harmonic number) lcm Least common multiple mod Symbolic modulus after division nextprime Next prime number prevprime Previous prime number quorem Quotient and remainder rem Remainder after division

## 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 texlabel TeX representation of symbolic expression

### Variables and Expressions Exchange

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

 clear all Remove items from MATLAB workspace and reset MuPAD engine reset Close MuPAD engine symengine Return symbolic engine