public PolynomialFunction add(final PolynomialFunction p){
  final int lowLength=FastMath.min(coefficients.length,p.coefficients.length);
  final int highLength=FastMath.max(coefficients.length,p.coefficients.length);
  double[] newCoefficients=new double[highLength];
  for (int i=0; i < lowLength; ++i) {
    newCoefficients[i]=coefficients[i] + p.coefficients[i];
  }
  System.arraycopy((coefficients.length < p.coefficients.length) ? p.coefficients : coefficients,lowLength,newCoefficients,lowLength,highLength - lowLength);
  return new PolynomialFunction(newCoefficients);
}

public PolynomialFunction add ( final PolynomialFunction p ) { final int lowLength = FastMath . min ( coefficients . length , p . coefficients . length ) ; final int highLength = FastMath . max ( coefficients . length , p . coefficients . length ) ; double [ ] newCoefficients = new double [ highLength ] ; for ( int i = 0 ; i < lowLength ; ++ i ) { newCoefficients [ i ] = coefficients [ i ] + p . coefficients [ i ] ; } System . arraycopy ( ( coefficients . length < p . coefficients . length ) ? p . coefficients : coefficients , lowLength , newCoefficients , lowLength , highLength - lowLength ) ; return new PolynomialFunction ( newCoefficients ) ; }
add a polynomial to the instance .
