vpasolve

Numerical solution of equations in variable-precision arithmetic.

Category: Mathematics > Equation Solving

Syntax

s = vpasolve(eqn, x)

Finds a numerical solution of one equation in x.

s = vpasolve(eqn, x, range)

Searches inside the interval [a b].

S = vpasolve(eqns, vars)

Solves a system, returning a struct with one field per variable.

Description

vpasolve uses a numerical search rather than algebra, so it handles equations that solve cannot put in closed form, such as cos(x) == x. For polynomials it returns all roots; for other equations it returns one root unless a range is given, and different ranges give different roots.

Input arguments

eqn
Equation or expression (taken equal to 0).
x
Variable to solve for.
range
Interval [a b] that steers the search.

Output arguments

s
Symbolic numbers with 32 significant digits by default.

Example

Polynomial and transcendental equations

syms x
vpasolve(x^2 - 2 == 0, x)
vpasolve(cos(x) == x, x)
Output
ans = 
-1.4142135623730950488016887242097
 1.4142135623730950488016887242097
ans = 0.73908513321516064165531208767387

See also

solve fzero vpa digits