Written and maintained by CASRAI Editorial Board
Last updated
Short answer: syms is the MATLAB command that creates symbolic variables (and symbolic functions) so you can work with exact algebra instead of numbers. It belongs to the Symbolic Math Toolbox. This guide is for researchers and analysts who have seen syms x y in a script and need to know what it does, how it differs from sym, and why it sometimes errors. After reading it you should be able to define symbolic variables and functions, set assumptions without surprises, solve a small system of equations and read the result. Documentation checked 2026-11-07.
What does syms mean in MATLAB?
In MATLAB, syms means “create symbolic variables”. The command syms x creates a symbolic scalar variable x and assigns it to a MATLAB variable of the same name, so x can appear in expressions that MATLAB keeps exact rather than evaluating to a floating-point number (MathWorks, syms reference). Searches for “syms in MATLAB”, “syms matlab” and “what does syms mean” all point at this one command.
The documented forms are:
syms var1 ... varNcreates several symbolic scalar variables at once, for examplesyms a b c.syms var1 ... varN [n1 ... nM]creates a symbolic array.syms a [1 3]creates the vectora = [a1 a2 a3]plus the scalarsa1,a2anda3in the workspace.syms f(var1,...,varN)creates a symbolic functionfand the input variables.syms var1 ... varN setcreates variables with an assumption, such asreal,positive,integerorrational; the assumptions can be combined with spaces.symswith no arguments lists the symbolic objects in the workspace.
What it is used for in research
Symbolic variables let you derive and check a result analytically before (or instead of) computing it numerically: rearranging a model equation, solving a small system for its unknowns, or defining a function f(x,y) whose form you want to keep exact. The Symbolic Math Toolbox documentation describes syms as a shortcut for the lower-level creation functions sym, symfun, symmatrix and symfunmatrix. For the numeric side of a MATLAB workflow, see our guide to what MATLAB is used for in research.
Install or access (official source only)
syms is documented in the Symbolic Math Toolbox section of the MathWorks help, so it is available where that toolbox is installed and licensed with your copy of MATLAB. There is no separate “syms download”: obtain MATLAB and its toolboxes only from MathWorks or through your institution’s MathWorks licence. To see what is installed, run ver in the Command Window; MathWorks documents that it lists the name, version and release of MATLAB and every other installed product. To check one product, MathWorks’ own example uses ver("symbolic") for the Symbolic Math Toolbox (ver reference).
How to use syms in MATLAB: step by step
- Create the variables. Run
syms x y. Both names now exist in the workspace as symbolic scalars. - Build an expression. Use ordinary MATLAB operators, for example
expr = x + 2*y. The result stays symbolic. - Define a symbolic function. Run
syms f(x,y), thenf(x,y) = x + 2*y. This creates the functionfand the variablesxandy. - Evaluate it. Call
f(1,2). The MathWorks example for this exact sequence returnsans = 5. - Solve equations. To solve for unknowns, define them with
symsand pass equations (written with==) tosolve:
syms u v
eqns = [2*u + v == 0, u - v == 1];
S = solve(eqns,[u v])
This is the example in the MathWorks solve reference. Its output is a structure: S = struct with fields: u: 1/3 v: -2/3.
syms real, syms positive and other assumptions
Writing syms x positive creates x with the assumption that it is positive. Two details cause most surprises, both stated in the MathWorks documentation:
- The assumption options (
real,positive,integer,rational) are combinable, and using thesetform sets the assumption that the variables belong to that set and clears other assumptions. - Calling
syms xagain clears all assumptions onx, whereasclear xremoves the workspace variable but leaves the assumptions in place. To remove assumptions explicitly, useassume(x,"clear").
syms vs sym: which should you use?
Use syms for quick interactive work where you want a variable named after itself; use sym when you need a different name, exact numbers, or you must keep existing assumptions. The comparison below is taken from the MathWorks page Choose syms or sym Function.
| Question | syms |
sym |
|---|---|---|
| Creating several variables on one line | Yes: syms a b c |
One variable per call |
| Name of the MATLAB variable | Same as the symbolic variable | Can differ: f1 = sym('x') |
| Existing assumptions on the variable | Cleared (syms x positive; syms x leaves no assumption) |
Reused (syms x positive; x = sym('x') keeps 0<x) |
| Exact numbers | Not its purpose | x = sym('1/33') stays class sym; assigning 1/33 directly gives a double |
Inside a function or parfor loop |
Avoid: the docs say not to use syms within functions or parallel for loops, and it cannot create a variable in a parfor loop |
Use it: x = sym('x') |
Output and how to read it
- A symbolic function call with numbers.
f(1,2)displaysans = 5: substituting numbers into the function gives an exact value. - A
solveresult for a system. You get a structure whose fields are the unknowns (u,v), each holding an exact fraction such as1/3. Read a value withS.u. - A warning from
solve. MathWorks documents thatsolvelooks for an exact answer first; when it cannot find one, it tries a numeric solution withvpasolveand MATLAB shows a warning. Treat that result as numeric, not exact.
Troubleshooting
| Situation | What the documentation says |
|---|---|
The error says syms requires Symbolic Math Toolbox |
syms is documented in that toolbox. Run ver (or ver("symbolic")) to see whether it is installed; if it is not, install or licence it through MathWorks. |
syms fails inside a function or parfor loop |
Use x = sym('x') instead. In functions the workspace is static, so syms cannot create the variable. |
You tried to name a variable integer, real, rational, positive or clear |
These names are reserved for syms. Create such a variable with sym. |
An old assumption keeps affecting results after clear x |
clear x leaves assumptions in place. Run syms x or assume(x,"clear"). |
1/33 loses precision |
Assigning 1/33 gives a double. Use sym('1/33') to keep it exact. |
Free alternatives (table)
If you do not have the Symbolic Math Toolbox, these open-source options provide symbolic computation. The syntax differs from MATLAB, so scripts need rewriting rather than renaming.
| Tool | What the official documentation says | Creating symbols |
|---|---|---|
| SymPy (Python) | Documented at docs.sympy.org (version 1.14.0 documentation checked 2026-11-07). | x, y, z = symbols('x y z'); the docs say symbols takes a string of names separated by spaces or commas. |
| GNU Octave “symbolic” package | Version 3.2.2, dated 2025-09-11, licensed GPL-3.0-or-later; provides symbolic calculation including algebra, calculus and equation solving, and requires Octave 6.1.0 or later (package page). | See the package documentation. |
For open-source statistical tools more broadly, see free statistical software for research. For a worked equation-solving contrast in another language, see solve in R. Other MATLAB how-tos on this site: MATLAB moving average and MATLAB normal distribution. If your symbolic derivations feed published results, keep the script with your data so others can rerun it; see computational reproducibility.
FAQ
What does syms mean?
In MATLAB it is short for “symbolic variables”: syms x declares x as a symbolic scalar variable in the Symbolic Math Toolbox.
What is sym in MATLAB, and how is it different?
sym creates a symbolic variable or number and lets you assign it to any MATLAB name, keep existing assumptions and create exact numbers. syms is a shortcut that names the variable after itself and clears assumptions. See the comparison table above.
How to solve syms in MATLAB?
Declare the unknowns with syms, write equations with ==, and call solve(eqns,vars). The worked example above returns u: 1/3 and v: -2/3.
Is MATLAB being phased out?
The MathWorks product-updates page checked on 2026-11-07 lists release R2026b of the MATLAB and Simulink product families, so the product is still being released. Whether it suits your field is a separate question; see the free alternatives above if licence access is the issue.
Can I use syms for free?
syms comes with the Symbolic Math Toolbox, so it depends on your MATLAB licence; for no-cost symbolic computation, use one of the alternatives in the table above.
Sources (official documentation, checked 2026-11-07)
- MathWorks, syms: Create symbolic scalar variables and functions
- MathWorks, Choose syms or sym Function
- MathWorks, solve: Equations and systems solver
- MathWorks, ver: Version information
- MathWorks, R2026b: Updates to the MATLAB and Simulink product families
- SymPy 1.14.0 documentation, Gotchas
- GNU Octave, The symbolic package







