// do not cut trailing zeros, since it may corrupt the outcom, if the array is of form 1 + x^-1 + x^-2 + x^-3
//a.CutTrailZeros();
//b.CutTrailZeros();
//a.TrimTrailingZeros();
//b.TrimTrailingZeros();
double[]ret=conv(a.Coeffs,b.Coeffs);
Polynomialret_p=newPolynomial(ret);
//ret_p.CutTrailZeros();
//ret_p.TrimTrailingZeros();
return(ret_p);
@ -310,7 +312,7 @@ namespace MathNet.Numerics
}
/// <summary>
/// Calculates the complex roots of the Polynomial in the same way as matlab does
/// Calculates the complex roots of the Polynomial by eigenvalue decomposition
/// </summary>
/// <returns>a vector of complex numbers with the roots</returns>
publicComplex[]GetRoots()
@ -337,13 +339,14 @@ namespace MathNet.Numerics
}
/// <summary>
/// get the eigenvalue matrix A of this Polynomial such that eig(A) = roots of this Polynomial
/// get the eigenvalue matrix A of this Polynomial such that eig(A) = roots of this Polynomial.
/// </summary>
/// <returns>Eigenvalue matrix A</returns>
/// <note>this matrix is similar to the companion matrix of this polynomial, in such a way, that it's transpose is the columnflip of the companion matrix</note>
publicDenseMatrixGetEigValMatrix()
{
PolynomialpLoc=newPolynomial(this.Coeffs);
pLoc.CutTrailZeros();
pLoc.TrimTrailingZeros();
intn=pLoc.Coeffs.Length-1;
if(n<2)
@ -459,6 +462,112 @@ namespace MathNet.Numerics
return(res_poly);
}
/// <summary>
/// Division of two polynomials returning the quotient-with-remainder of the two polynomials given
/// </summary>
/// <param name="a">left polynomial</param>
/// <param name="b">right polynomial</param>
/// <returns>a tuple holding quotient in first and remainder in second</returns>