# Sturm Subdivision Solver

Another criterion to detect the number of roots in an interval, can be used. It is based on Sturm's theorem. Here is the simplifed version, that we exploit:

 Theorem: Let and be the Sturm sequence of and (x). Let be the number of sign variation of for . Then, for any , is the number of roots in ]a,b[.

This leads to the following schema of algorithms, (which applies event to polynomials with multiple roots):

 Algorithm: Isolation of the roots of on the interval . INPUT: A polynomial . Compute the Sturm sequence of and . Compute the number of sign changes . If remove the interval. If and compute and apply recursively the algorithm to the two halves of the input interval. OUTPUT: a list of subintervals of containing exactly one real root of .

## Sturm Approximation Solver

Seq<O> solve(const UPOL& p, SlvSturm<O,C> mth);

• This solver computes an approximation of the roots, within the precision specified by the solver SlvSturm. The default value is . If we want a specific precision eps, we can use the following construction: solve(p, SlvSturm<O,C>(eps)).
• The solver outputs a sequence of numbers of type O, corresponding to the first parameter O of this class.
• The second parameter C is the type of coefficients used during the computation. The default type is the type QQ of rational numbers. \
• The univariate polynomial p of type UPOL, is supposed to be given with exact coefficients. It is converted to a polynomial of type UPolDse<C>, if needed.
• See synaps/usolve/sturm/SlvSturm.h.

## Sturm Isolation Solver

Seq< Interval<O> > solve(const UPOL& p, IslSturm<O,C> mth);

• This solver computes an isolation interval of the roots. It outputs a sequence of intervals of numbers of type O, containing one and only one root of p.
• The second parameter C is the type of coefficients used during the computation. The default type is the type QQ of rational numbers. \
• The univariate polynomial p of type UPOL, is supposed to be given with exact coefficients. It is converted to a polynomial of type UPolDse<C>, if needed.
• See synaps/usolve/sturm/IslSturm.h.

## Example

#include <synaps/upol.h>
#include <synaps/arithm/QQ.h>
#include <synaps/usolve/sturm/IslSturm.h>
int main()
{
using std::cout;  using std::endl;

UPolDse<QQ> P("2*x^7+3*x^6+2*x^5+x^4-x^3-2*x^2-3*x+1");
cout <<"Testing: "<<P<<endl;
//| Testing: 2*x^7+3*x^6+2*x^5+1*x^4-1*x^3-2*x^2-3*x+1

cout <<solve(P,IslSturm<QQ>())<<endl;
//| [ -5/2,0 ], [ 0,5/8 ], [ 5/8,5/4 ]

cout <<solve(P,IslSturm<QQ>(),0,1)<<endl;
//| [ 0,1/2 ], [ 1/2,1 ]

}

SYNAPS DOCUMENTATION