コード例 #1
0
  public Polynomial div(Polynomial poly) {
    if (!poly.isConstantPoly())
      throw new IllegalArgumentException(
          "Can currently only divide by numbers and not polynomials");

    int deg = coeffs.length - 1;
    Number lcoeffs[] = new Number[deg + 1];
    for (int i = 0; i < deg + 1; ++i)
      lcoeffs[i] = ((HasDivI) baseRing).div(coeffs[i], poly.getCoeff(0));

    return valueOf(lcoeffs);
  }
コード例 #2
0
 public boolean equalsPoly(Polynomial n) {
   if (this.getDegree() != n.getDegree()) return false;
   for (int i = 0; i <= this.getDegree(); ++i)
     if (!baseRing.equals(this.getCoeff(i), n.getCoeff(i))) return false;
   return true;
 }