private static Expression DivideExponentiations_Body(Exponentiation x, Exponentiation y) { //If the bases are equal if (x.Base == y.Base) return x.Base ^ (x.Exponent - y.Exponent); //If the bases are not equal return new Quotient(x, y); }
/// <summary> /// Exponentiates an expression by a power given by another expression. /// </summary> /// <param name="Base">The base of the exponentiation</param> /// <param name="Exponent">The exponent of the exponentiation</param> public static Expression Exponentiate(Expression Base, Expression Exponent) { var O = new Exponentiation(Base, Exponent); if (O.CanTransform()) return O.Apply(true); else return O; }
private static Expression MultiplyExponentiations_Body(Exponentiation x, Exponentiation y) { //If the bases are equal if (x.Base == y.Base) return x.Base ^ (x.Exponent + y.Exponent); //If the bases are not equal return new Product(x, y); }