realroot_doc 0.1.1
|
# include <realroot/ring.hpp> # include <realroot/polynomial_tensor.hpp> # include <realroot/tensor_monomials.hpp> # include <realroot/GMP.hpp> # include <realroot/solver_mv_monomial.hpp> using namespace mmx; using namespace realroot; template<class coef_t, class sol_t> void test() { typedef polynomial< coef_t, with<MonomialTensor> > POL; double eps(1e-1); Seq<POL> S ; S << (POL("x^2 - 8*x +23 + y^2 -6 *y")); S << (POL("x^2 -12*x +68 +4*y^2 -24*y")); Seq< Interval<coef_t> > dom; dom << Interval<coef_t>(0,10); dom << Interval<coef_t>(0,10); Seq< Seq<Interval<coef_t> > > sols; solver_mv_monomial<sol_t,POL> slv(eps); std::cout<<"* Isolate." << std::endl; std::cout<< slv.isolate(S, dom) <<std::endl; std::cout<< "* Approximate." << std::endl; std::cout<< slv.approximate(S, dom) <<std::endl; // std::cout<< "* Root isolation:" << std::endl; // std::cout << solver<coef_t,MCFisolate>::solve<sol_t>(S,dom ) << std::endl; }; int main(int argc, char** argv) { std::cout<< "\n---Using double coefs." << std::endl; test<double, double> () ; // std::cout<< "\n---Using Rational coefs." << std::endl; // test<QQ, QQ>() ; // std::cout<< "\n---Using Integer coefs." << std::endl; // test<ZZ, QQ >() ; // test<ZZ, double >() ; return 0; }