Symbolic Math Introduction

Symbolicintermediate~8 min

Create symbolic variables, differentiate, integrate, and solve equations.

Step 1 — Symbolic expressions

Declare symbolic variables with syms, build and expand expressions.

syms x;
f = (x + 1)^3;
result = expand(f);
disp(result)
▶ Run in SimLab

Expected output: x^3 + 3*x^2 + 3*x + 1

Step 2 — Calculus

diff() computes derivatives, integrate() computes antiderivatives.

syms x;
f = sin(x) * exp(x);
df = diff(f, x);
F = integrate(f, x);
disp(df)
▶ Run in SimLab

Expected output: Derivative expression

Step 3 — Solve equations

symsolve() finds symbolic solutions.

syms x;
solutions = symsolve(x^2 - 5*x + 6, x);
disp(solutions)
▶ Run in SimLab

Expected output: x = 2, x = 3

Related Tutorials

Try SimLab — MATLAB®-compatible, free, in your browser

466 functions. Runs in your browser. No install.

Open SimLab

MATLAB® is a registered trademark of The MathWorks, Inc. SimLab is an independent project by Simulations4All and is not affiliated with, endorsed by, or sponsored by The MathWorks, Inc.

Stay Updated

Get notified about new simulations and tools. We send 1-2 emails per month.