Solve¶
Symbolic equation solver.
A negative leading coefficient still gives simplified, correctly ordered roots.
x^n == c is solved in radicals, the roots being the real root times the
n-th roots of unity:
For an odd degree and a negative right-hand side the generating root is the real one:
NSolve stays on the numeric root finder, so a conjugate pair agrees to the
last bit:
$ wo 'NSolve[x^3 == 8, x]'
{{x -> -1. - 1.7320508075688772*I}, {x -> -1. + 1.7320508075688772*I}, {x -> 2.}}
Inverting Abs splits the equation into a positive and a negative branch, and
over the complexes that leaves out the rest of the circle — Solve says so:
$ wo 'Solve[Abs[x] == 2, x]'
Solve::ifun: Inverse functions are being used by Solve, so some solutions may not be found; use Reduce for complete solution information.
{{x -> -2}, {x -> 2}}
Restricting the domain to the reals, or narrowing the split with a constraint, loses nothing and so reports nothing:
A list of constraints is the same system as the conjunction of them:
Modulus -> n solves over the integers modulo n, so the answers are residues
rather than radicals:
There may be none, and the modulus need not be prime:
MaxRoots -> n keeps only the first n solutions:
It has to be a positive integer, Infinity or Automatic:
$ wo 'Solve[x^3 == 1, x, MaxRoots -> 0]'
Solve::maxrts: The value 0 of the MaxRoots option is not a positive integer, Infinity or Automatic.
Solve[x^3 == 1, x, MaxRoots -> 0]
Machine-precision coefficients are solved numerically instead of in
radicals or as Root objects:
$ wo 'Solve[x^3 == 8., x]'
{{x -> -1. - 1.7320508075688772*I}, {x -> -1. + 1.7320508075688772*I}, {x -> 2.}}
$ wo 'Round[x /. Solve[x^3 + 1.5 x^2 - 3.2 x + 4.7 == 0, x], 1/10^6]'
{-19079/6250, 2426/3125 - (120997*I)/125000, 2426/3125 + (120997*I)/125000}
Every root is reported with its multiplicity:
An inequality alongside the equation keeps only the roots inside it — including roots with no radical form, which are decided on their value:
An equation with a list on one side threads over that list, so a scalar on the other side is compared against every element:
That makes Solve[Table[…] == 0] work, with the variable inferred from the
equations: