Symbolic Math Toolbox
 Go to function:
  Search    Help Desk 
solve ExamplesSee Also

Symbolic solution of algebraic equations.

Syntax

Description

Single Equation/Expression

The input to solve can be either symbolic expressions or strings. If eq is a symbolic expression (x^2-2*x+1) or a string that does not contain an equal sign ('x^2-2*x+1'), then solve(eq) solves the equation eq=0 for its default variable (as determined by findsym).

solve(eq,var) solves the equation eq (or eq=0 in the two cases cited above) for the variable var.

System of Equations

The inputs are either symbolic expressions or strings specifying equations. solve(eq1,eq2,...,eqn) solves the system of equations implied by eq1,eq2,...,eqn in the n variables determined by applying findsym to the system.

Three different types of output are possible. For one equation and one output, the resulting solution is returned with multiple solutions for a nonlinear equation. For a system of equations and an equal number of outputs, the results are sorted alphabetically and assigned to the outputs. For a system of equations and a single output, a structure containing the solutions is returned.

For both a single equation and a system of equations, numeric solutions are returned if symbolic solutions cannot be determined.

Examples

solve('a*x^2 + b*x + c') returns

solve('a*x^2 + b*x + c','b') returns

solve('x + y = 1','x - 11*y = 5') returns

A = solve('a*u^2 + v^2', 'u - v = 1', 'a^2 - 5*a + 6')

returns

where

See Also

arithmetic operators, dsolve, findsym



[ Previous | Help Desk | Next ]