CountRoots
Details

Examples
open allclose allBasic Examples (4)Summary of the most common use cases
Count the number of polynomial roots between 0 and 10:

https://wolfram.com/xid/0rsvljevs-urwrv

Count roots of a polynomial in a closed rectangle:

https://wolfram.com/xid/0rsvljevs-f0tuao

Count roots of a real elementary function in a real interval:

https://wolfram.com/xid/0rsvljevs-lj00ta

Count roots of a holomorphic function in a closed rectangle:

https://wolfram.com/xid/0rsvljevs-hj1i1g


https://wolfram.com/xid/0rsvljevs-py4ed6

Scope (20)Survey of the scope of standard use cases
Basic Uses (8)
Find the number of the real roots:

https://wolfram.com/xid/0rsvljevs-c5pbvt

Count roots in a real interval:

https://wolfram.com/xid/0rsvljevs-ezfwzq


https://wolfram.com/xid/0rsvljevs-k7tj8d

Count roots in a closed rectangle:

https://wolfram.com/xid/0rsvljevs-7zfgj


https://wolfram.com/xid/0rsvljevs-be1mdc

Count roots in a vertical line segment:

https://wolfram.com/xid/0rsvljevs-n07feg

Count roots in a horizontal line segment:

https://wolfram.com/xid/0rsvljevs-jnyd2r

Multiple roots are counted with their multiplicities:

https://wolfram.com/xid/0rsvljevs-fg12d2

For a root of multiplicity , all the derivatives
for
also vanish:

https://wolfram.com/xid/0rsvljevs-7s0wh

Roots at the endpoints of the interval are included:

https://wolfram.com/xid/0rsvljevs-bbzws8

Roots on the boundary of the rectangle are included:

https://wolfram.com/xid/0rsvljevs-bc6ceg

Real Elementary Functions (6)
Count the real roots of a high-degree polynomial:

https://wolfram.com/xid/0rsvljevs-cn1327

Find the number of non-negative roots of an algebraic function involving high-degree radicals:

https://wolfram.com/xid/0rsvljevs-la4q9l

Count the non-negative roots of a function involving irrational real powers:

https://wolfram.com/xid/0rsvljevs-5w2o6

Count the real roots of a real exp-log function:

https://wolfram.com/xid/0rsvljevs-d677m

Count the real roots of a tame real elementary function:

https://wolfram.com/xid/0rsvljevs-bldk5k

This shows the plot of the function:

https://wolfram.com/xid/0rsvljevs-cp84ux

Count roots of a real elementary function in a bounded interval:

https://wolfram.com/xid/0rsvljevs-7ln0q

This shows the plot of the function:

https://wolfram.com/xid/0rsvljevs-l58mq8

Holomorphic Functions (3)
Count roots of a holomorphic elementary function in a closed rectangle:

https://wolfram.com/xid/0rsvljevs-33znu

Count roots of a holomorphic special function in a closed rectangle:

https://wolfram.com/xid/0rsvljevs-c21823

Find the number of roots of an analytic function in a bounded real interval:

https://wolfram.com/xid/0rsvljevs-7okn

The double root at zero is counted with multiplicity:

https://wolfram.com/xid/0rsvljevs-12img

Meromorphic Functions (3)
Count roots of a meromorphic elementary function in a closed rectangle:

https://wolfram.com/xid/0rsvljevs-h45o7n

Visualize roots and poles of the function:

https://wolfram.com/xid/0rsvljevs-gbds66

Count roots of a meromorphic special function in a closed rectangle:

https://wolfram.com/xid/0rsvljevs-d1cqwz

Visualize roots and poles of the function:

https://wolfram.com/xid/0rsvljevs-rqp9g

Find the number of roots of a meromorphic function in a bounded real interval:

https://wolfram.com/xid/0rsvljevs-bwchn8


https://wolfram.com/xid/0rsvljevs-erjprt

Applications (4)Sample problems that can be solved with this function
The number of 17 roots of unity in the closed unit square in the first quadrant:

https://wolfram.com/xid/0rsvljevs-cpvagv

Roots on the boundary are counted:

https://wolfram.com/xid/0rsvljevs-f9rv3z

Check that a function has exactly one root in an interval:

https://wolfram.com/xid/0rsvljevs-gqxe9q

Use FindRoot to approximate the root:

https://wolfram.com/xid/0rsvljevs-hx6a65

Compute a contour integral of logarithmic derivative of a function using the formula , where
is the number of roots for a holomorphic function
:

https://wolfram.com/xid/0rsvljevs-h6oa9p

Compare with the result of numeric integration:

https://wolfram.com/xid/0rsvljevs-g8j4pr

Test stability of equilibria at 0 of linear dynamical systems by counting the roots of the CharacteristicPolynomial[m,x] in the right half-plane:

https://wolfram.com/xid/0rsvljevs-sqk4w

https://wolfram.com/xid/0rsvljevs-bsnrcc
Use a bound for max absolute value of the roots:

https://wolfram.com/xid/0rsvljevs-b0j2hx

Count the roots in the right half-plane:

https://wolfram.com/xid/0rsvljevs-umqcv

Since all eigenvalues of m have negative real parts, the equilibrium is asymptotically stable:

https://wolfram.com/xid/0rsvljevs-drgcjd


https://wolfram.com/xid/0rsvljevs-bz5p5f
This time there are roots with non-negative real parts:

https://wolfram.com/xid/0rsvljevs-jd43si

The equilibrium is not asymptotically stable:

https://wolfram.com/xid/0rsvljevs-jnsq66

Properties & Relations (5)Properties of the function, and connections to other functions
The number of complex roots of a polynomial is equal to its degree:

https://wolfram.com/xid/0rsvljevs-xtqs
This gives a bound on absolute values of roots of a polynomial:

https://wolfram.com/xid/0rsvljevs-h5yn4e

https://wolfram.com/xid/0rsvljevs-bcvpmz

The polynomial indeed has 10 roots within the Cauchy bounded region:

https://wolfram.com/xid/0rsvljevs-erbu1

The number of real roots of a polynomial with nonzero terms is at most
:

https://wolfram.com/xid/0rsvljevs-dgov4s

This polynomial has the maximal possible number of real roots:

https://wolfram.com/xid/0rsvljevs-iicn2c

Use Reduce to find polynomial roots:

https://wolfram.com/xid/0rsvljevs-9o38o

https://wolfram.com/xid/0rsvljevs-tl6u


https://wolfram.com/xid/0rsvljevs-ddyrvf

Use RootIntervals to find isolating intervals for roots:

https://wolfram.com/xid/0rsvljevs-gou3i4

https://wolfram.com/xid/0rsvljevs-bsjwhh


https://wolfram.com/xid/0rsvljevs-bcgo0s

Use NumberFieldSignature to count the real roots and the pairs of complex roots of a polynomial:

https://wolfram.com/xid/0rsvljevs-6wlsk

https://wolfram.com/xid/0rsvljevs-cufel


https://wolfram.com/xid/0rsvljevs-itd11g

Possible Issues (1)Common pitfalls and unexpected behavior
Wolfram Research (2007), CountRoots, Wolfram Language function, https://reference.wolfram.com/language/ref/CountRoots.html (updated 2017).
Text
Wolfram Research (2007), CountRoots, Wolfram Language function, https://reference.wolfram.com/language/ref/CountRoots.html (updated 2017).
Wolfram Research (2007), CountRoots, Wolfram Language function, https://reference.wolfram.com/language/ref/CountRoots.html (updated 2017).
CMS
Wolfram Language. 2007. "CountRoots." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2017. https://reference.wolfram.com/language/ref/CountRoots.html.
Wolfram Language. 2007. "CountRoots." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2017. https://reference.wolfram.com/language/ref/CountRoots.html.
APA
Wolfram Language. (2007). CountRoots. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/CountRoots.html
Wolfram Language. (2007). CountRoots. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/CountRoots.html
BibTeX
@misc{reference.wolfram_2025_countroots, author="Wolfram Research", title="{CountRoots}", year="2017", howpublished="\url{https://reference.wolfram.com/language/ref/CountRoots.html}", note=[Accessed: 09-May-2025
]}
BibLaTeX
@online{reference.wolfram_2025_countroots, organization={Wolfram Research}, title={CountRoots}, year={2017}, url={https://reference.wolfram.com/language/ref/CountRoots.html}, note=[Accessed: 09-May-2025
]}