Back to Symbolic Mathematics

solve

Solve symbolic equation

Syntax

S = solve(eqn, var)
S = solve(eqn)

Description

Solves a symbolic equation for the specified variable. The equation can be an expression (assumed equal to zero) or an equation created with ==. Returns an array of solutions. For polynomial equations, includes all roots (real and complex).

Parameters

NameDescription
eqnSymbolic equation or expression (assumed = 0)
var(optional)Variable to solve for

Returns

Array of symbolic solutions

Examples

Try It
>> syms x; solve(x^2 - 1, x)
[-1, 1]
Try It
>> syms x; solve(x^2 + x - 6, x)
[-3, 2]

See Also