Esempio n. 1
0
 /**
  * Real algebraic number sign.
  *
  * @param iv root isolating interval for f, with f(left) * f(right) < 0.
  * @param f univariate polynomial, non-zero.
  * @param g univariate polynomial, gcd(f,g) == 1.
  * @return sign(g(v)), with v a new interval contained in iv such that g(v) != 0.
  */
 public int realSign(Interval<C> iv, GenPolynomial<C> f, GenPolynomial<C> g) {
   if (g == null || g.isZERO()) {
     return 0;
   }
   if (f == null || f.isZERO() || f.isConstant()) {
     return g.signum();
   }
   if (g.isConstant()) {
     return g.signum();
   }
   Interval<C> v = invariantSignInterval(iv, f, g);
   return realIntervalSign(v, f, g);
 }
Esempio n. 2
0
 /**
  * Real algebraic number sign.
  *
  * @param iv root isolating interval for f, with f(left) * f(right) &lt; 0, with iv such that
  *     g(iv) != 0.
  * @param f univariate polynomial, non-zero.
  * @param g univariate polynomial, gcd(f,g) == 1.
  * @return sign(g(iv)) .
  */
 public int realIntervalSign(Interval<C> iv, GenPolynomial<C> f, GenPolynomial<C> g) {
   if (g == null || g.isZERO()) {
     return 0;
   }
   if (f == null || f.isZERO() || f.isConstant()) {
     return g.signum();
   }
   if (g.isConstant()) {
     return g.signum();
   }
   RingFactory<C> cfac = f.ring.coFac;
   C c = iv.left.sum(iv.right);
   c = c.divide(cfac.fromInteger(2));
   C ev = PolyUtil.<C>evaluateMain(cfac, g, c);
   // System.out.println("ev = " + ev);
   return ev.signum();
 }