Exemple #1
0
        /// <summary>
        /// Determines whether the polynomial is equal.
        /// </summary>
        /// <param name="polynomial"></param>
        /// <returns>bool</returns>
        public bool Equal(PolynomialRoots polynomial)
        {
            int count = this.RootAndExponents.Count;

            return((count == polynomial.RootAndExponents.Count) &&
                   (this.RootAndExponents.Count(pair => polynomial.RootAndExponents.Contains(pair)) == count));
        }
Exemple #2
0
        /// <summary>
        /// Gets the polynomial defined by its roots
        /// </summary>
        /// <returns>
        /// PolynomialRoots
        /// </returns>
        public PolynomialRoots GetRootsPolynomial()
        {
            var polynomialRoots = new PolynomialRoots();

            var polynomicEquation = new PolynomicEquation(this);

            foreach (double root in polynomicEquation.GetSolutions())
            {
                polynomialRoots.InsertRoot(root);
            }

            return(polynomialRoots);
        }
Exemple #3
0
 /// <summary>
 /// Determines whether the polynomal is equal to the one represent by its roots.
 /// </summary>
 /// <param name="polynomial"></param>
 /// <returns>bool</returns>
 public bool Equals(PolynomialRoots polynomial)
 {
     return(this.Equals(polynomial.GetExplicitPolynomial()));
 }
Exemple #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PolynomicEquation"/> class.
 /// </summary>
 /// <param name="polynomial"></param>
 public PolynomicEquation(PolynomialRoots polynomial)
     : this(polynomial.GetExplicitPolynomial())
 {
 }