MaxRoots
Examples
open all close allBasic Examples (3)
Find three roots of a polynomial equation:
NSolve[x ^ 100 - x == 1, x, MaxRoots -> 3]With the default Automatic setting, all 100 roots are returned:
NSolve[x ^ 100 - x == 1, x]//LengthFind three roots of a transcendental equation:
NSolve[Sin[x] == x + 1, x, MaxRoots -> 3]With the default Automatic setting, 16 roots are returned:
NSolve[Sin[x] == x + 1, x]//LengthFind five exact roots of a transcendental equation:
Solve[Sin[Cos[x]] == Sin[x] + Cos[x], x, MaxRoots -> 5]Scope (6)
Find two roots of a system of polynomial equations:
NSolve[x ^ 3 + y ^ 3 == x y - 1 && x ^ 7 - y ^ 7 == x + y + 3, {x, y}, MaxRoots -> 2]With the default Automatic setting, all 21 roots are returned:
NSolve[x ^ 3 + y ^ 3 == x y - 1 && x ^ 7 - y ^ 7 == x + y + 3, {x, y}]//LengthFind five roots of a system of transcendental equations:
NSolve[x == Sin[x y] - 1 && y ^ 2 == Cos[x - y] + 2, {x, y}, MaxRoots -> 5]With the default Automatic setting, 16 roots are returned:
NSolve[x == Sin[x y] - 1 && y ^ 2 == Cos[x - y] + 2, {x, y}]//LengthNSolve[x == Sin[x y] - 1 && y ^ 2 == Cos[x - y] + 2, {x, y}, MaxRoots -> 100]//LengthFind five roots of a polynomial of a high degree:
Solve[x ^ 1234567 + 9x ^ 2 + 7x - 1 == 0, x, MaxRoots -> 5]Find three roots of an unrestricted complex transcendental equation:
SolveValues[Sin[FresnelS[x] + BesselJ[3, x ^ 3 - 2]] == 2 ^ Cos[x] - 5, x, MaxRoots -> 3]Find three out of a trillion roots of a polynomial system:
SolveValues[x ^ 10000 == y ^ 2 + 3y + 2 && y ^ 10000 == z ^ 2 + 3z + 2 && z ^ 10000 == x ^ 2 + 3x + 2, {x, y, z}, MaxRoots -> 3]Find five solutions of a transcendental system:
Solve[Sin[x + y] == x y + 1 && Cos[x - y] == AiryAi[x y] / 2, {x, y}, MaxRoots -> 5]Possible Issues (1)
The setting of MaxRoots is ignored when solutions depend on symbolic parameters:
NSolve[x ^ 2 == a x + 1 && Abs[x] < 2, x, Reals, MaxRoots -> 1]See Also
History
Text
Wolfram Research (2024), MaxRoots, Wolfram Language function, https://reference.wolfram.com/language/ref/MaxRoots.html.
CMS
Wolfram Language. 2024. "MaxRoots." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/MaxRoots.html.
APA
Wolfram Language. (2024). MaxRoots. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/MaxRoots.html
BibTeX
@misc{reference.wolfram_2026_maxroots, author="Wolfram Research", title="{MaxRoots}", year="2024", howpublished="\url{https://reference.wolfram.com/language/ref/MaxRoots.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_maxroots, organization={Wolfram Research}, title={MaxRoots}, year={2024}, url={https://reference.wolfram.com/language/ref/MaxRoots.html}, note=[Accessed: 12-June-2026]}