Skip to main content
v2026.11,858 entries · CC-BY 4.0
LAC HealthMedical & Research SuppliesReagents, PPE & instruments — chain-of-custody documented.Fast, traceable sourcing built for regulated research environments, from bench consumables to instrumentation.Shop lac.us CodeCASRAIlac.us

MATLAB syms: What It Means, syms vs sym and How to Use It

MATLAB syms creates symbolic variables and functions. Syntax, syms vs sym, assumptions, a worked solve example and troubleshooting.

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 ... varN creates several symbolic scalar variables at once, for example syms a b c.
  • syms var1 ... varN [n1 ... nM] creates a symbolic array. syms a [1 3] creates the vector a = [a1 a2 a3] plus the scalars a1, a2 and a3 in the workspace.
  • syms f(var1,...,varN) creates a symbolic function f and the input variables.
  • syms var1 ... varN set creates variables with an assumption, such as real, positive, integer or rational; the assumptions can be combined with spaces.
  • syms with 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

  1. Create the variables. Run syms x y. Both names now exist in the workspace as symbolic scalars.
  2. Build an expression. Use ordinary MATLAB operators, for example expr = x + 2*y. The result stays symbolic.
  3. Define a symbolic function. Run syms f(x,y), then f(x,y) = x + 2*y. This creates the function f and the variables x and y.
  4. Evaluate it. Call f(1,2). The MathWorks example for this exact sequence returns ans = 5.
  5. Solve equations. To solve for unknowns, define them with syms and pass equations (written with ==) to solve:
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 the set form sets the assumption that the variables belong to that set and clears other assumptions.
  • Calling syms x again clears all assumptions on x, whereas clear x removes the workspace variable but leaves the assumptions in place. To remove assumptions explicitly, use assume(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) displays ans = 5: substituting numbers into the function gives an exact value.
  • A solve result for a system. You get a structure whose fields are the unknowns (u, v), each holding an exact fraction such as 1/3. Read a value with S.u.
  • A warning from solve. MathWorks documents that solve looks for an exact answer first; when it cannot find one, it tries a numeric solution with vpasolve and 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)

Follow CASRAI

Research-administration guidance, standards updates and independent tool reviews.

Ask CASRAI · free to try

Ask about MATLAB syms: What It Means, syms vs sym and How to Use It

Ask your first 2 questions free below. Subscribers get 150 a day for $29 a month.

An AI assistant specialized in research administration. It cites the sources behind every answer, labels web answers and says when it can't answer.

Answers draw on CASRAI's guides and dictionary plus the federal and funder documents we index: Federal Register, Grants.gov, Regulations.gov and UKRI.

Works on this site and inside Claude, Cursor and the AI tools you already use.

Everything CASRAI publishes — this page, the dictionary, the guides and the news — stays free to read, with no account and no card.

Referenced across the research world

University of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logoUniversity of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logo
  • University of Cambridge logo
  • Columbia University logo
  • Crossref logo
  • University of Edinburgh logo
  • Harvard University logo
  • University of Oxford logo
  • Princeton University logo
  • Stanford School of Medicine logo
  • University College London logo
  • ORCID logo

View CASRAI adoption →