Toolboxes
Symbolic Math Toolbox → sympy
Symbolic algebra — solve equations, simplify expressions, compute derivatives and integrals. sympy is a nearly-complete functional superset of MATLAB's Symbolic Math Toolbox, including LaTeX rendering in Jupyter. Most one-liners port directly.
Install
pip install sympy| MATLAB | Python | Note |
|---|---|---|
| syms x y | x, y = sp.symbols('x y') | Explicit 'import sympy as sp' first |
| f = x^2 + 3*x + 2 | f = x**2 + 3*x + 2 | sympy uses Python ** not ^ |
| diff(f, x) | sp.diff(f, x) | |
| diff(f, x, 2) | sp.diff(f, x, 2) | Second derivative |
| int(f, x) | sp.integrate(f, x) | Indefinite integral |
| int(f, x, 0, 1) | sp.integrate(f, (x, 0, 1)) | Definite integral — tuple form |
| solve(f == 0, x) | sp.solve(f, x) | Implicitly solves for zeros |
| solve([f1; f2], [x; y]) | sp.solve([f1, f2], [x, y]) | System of equations |
| simplify(f) | sp.simplify(f) | |
| expand(f) | sp.expand(f) | |
| factor(f) | sp.factor(f) | |
| collect(f, x) | sp.collect(f, x) | |
| subs(f, x, 2) | f.subs(x, 2) | |
| subs(f, [x, y], [1, 2]) | f.subs([(x, 1), (y, 2)]) | |
| limit(f, x, 0) | sp.limit(f, x, 0) | |
| taylor(f, x, Order=5) | sp.series(f, x, 0, 5).removeO() | |
| jacobian([f1; f2], [x; y]) | sp.Matrix([f1, f2]).jacobian([x, y]) | |
| latex(f) | sp.latex(f) | |
| vpa(pi, 50) | sp.N(sp.pi, 50) | Arbitrary-precision numeric |
| double(f) | float(f) # or sp.N(f) |
The converter automatically detects Symbolic Math functions and adds the correct imports.
Try the converter