示例#1
0
        Add(
            Rational rational
            )
        {
            if (denominator.Equals(rational.denominator))
            {
                return(new Rational(
                           numerator + rational.numerator,
                           denominator.Clone()
                           ));
            }

            Polynomial num   = numerator * rational.denominator + rational.numerator * denominator;
            Polynomial denom = denominator * rational.denominator;

            return(new Rational(num, denom));
        }
示例#2
0
 Rational(
     Polynomial numerator,
     Polynomial denominator
     )
 {
     this.numerator   = numerator.Clone();
     this.denominator = denominator.Clone();
 }
示例#3
0
 Divide(
     Polynomial polynomial
     )
 {
     return(new Rational(
                numerator.Clone(),
                denominator * polynomial
                ));
 }
 Divide(
     Polynomial polynomial
     )
 {
     return(new Rational(Clone(), polynomial.Clone()));
 }
 /// <summary>
 /// Divides this polynomial with anoter polynomial.
 /// </summary>
 public Rational Divide(
     Polynomial polynomial
     )
 {
     return new Rational(Clone(), polynomial.Clone());
 }