# Symbolic Variables, Expressions, Functions, and Preferences

Create symbolic variables, expressions, functions, and set preferences

Symbolic Math Toolbox™ introduces a special data type — symbolic objects. This data type includes symbolic numbers, symbolic variables, symbolic expressions, and symbolic functions. It also includes vectors, matrices, and multidimensional arrays of symbolic numbers, variables, expressions, and functions. Using symbolic objects in computations indicates that MATLAB® must perform these computations analytically instead of numerically. Symbolic computations are exact and are not prone to round-off errors. For more details about symbolic objects, see Use Symbolic Objects to Represent Mathematical Objects. For a quick guide on creating symbolic variables, expressions, and functions, see Create Symbolic Numbers, Variables, and Expressions and Create Symbolic Functions.

## Functions

expand all

 `syms` Create symbolic scalar variables and functions, and matrix variables and functions `sym` Create symbolic variables, expressions, functions, matrices `symfun` Create symbolic functions `symmatrix` Create symbolic matrix variable (Since R2021a) `symmatrix2sym` Convert symbolic matrix variable to array of scalar variables (Since R2021a) `symfunmatrix` Create symbolic matrix function (Since R2022a) `symfunmatrix2symfun` Convert symbolic matrix function to symbolic function (Since R2022a) `str2sym` Evaluate string representing symbolic expression `fold` Combine (fold) vector using function `piecewise` Conditionally defined expression or function
 `symvar` Find symbolic variables in symbolic input `argnames` Input variables of symbolic function or matrix function `formula` Return body of symbolic function or matrix function `has` Check if expression contains particular subexpression `children` Subexpressions or terms of symbolic expression
 `symType` Determine type of symbolic object (Since R2019a) `symFunType` Determine functional type of symbolic object (Since R2019a) `isSymType` Determine whether symbolic object is specific type (Since R2019a) `hasSymType` Determine whether symbolic object contains specific type (Since R2019a) `findSymType` Find symbolic subobjects of specific type (Since R2019a) `mapSymType` Apply function to symbolic subobjects of specific type (Since R2019a)
 `isfinite` Check whether symbolic array elements are finite `isinf` Check whether symbolic array elements are infinite `isnan` Check whether symbolic array elements are `NaN`s
 `sympref` Set symbolic preferences