Univariate Aberth Solver

This is a connection to the C-implementation mpsolve by D. Bini and G. Fiorentino for solving univariate polynomials. See [3] for more details.

The type of output of the method is specified by the parameter type of Aberth. If Aberth<CC> is used, it computes the complex solutions. If Aberth<RR> is used, only the real roots are output. The result is a sequence of numbers

Seq<CC> sc = solve(p, Aberth<CC>());
Seq<RR> sr = solve(p, Aberth<RR>());

Both methods accept as parameter the output precision for the roots and the input precision for the coefficients:

Aberth(16);     
   //Output precision of 16 digits on the roots. 
   //Input coefficients are supposed to be exact.
Aberth(16,32);  
  //Precision of 16 digits on the roots and 32 on the coefficients.

Implementation

See synaps/usolve/Aberth.h

Example

o+

#include <synaps/upol.h>
#include <synaps/usolve/Aberth.h>
typedef UPolDse<double> upol_t;

int main()
{
  using std::cout; using std::endl;

  upol_t p("x0^4-x0^3+3*x0-1");

  cout<<solve(p,SlvAberth<CC>())<<endl;
  //> (0.342114311791575032018e0, -0.308148791101957736489e-32), 
  //> (0.971760167528210372367e0, 0.115293848359257733449e1), 
  //> (-0.128563464684799555471e1, 0.e0), 
  //> (0.971760167528210150323e0, -0.115293848359257733449e1)

  cout<<solve(p,SlvAberth<RR>())<<endl;
  //> 0.342114, -1.28563

}

SYNAPS DOCUMENTATION
logo