/** * <p> * Match <code>a_.*variable^n_+b_.*variable^m_</code> to * <code>E^(((-I)*Pi + Log(a) - Log(b))/(m - n)) /; FreeQ(a,x)&&FreeQ(b,x)&&FreeQ(n,x)&&FreeQ(m,x)</code> * </p> * * @param ast * @param x * @return */ private static IExpr matchSpecialExpressions(IAST ast, IExpr exprWithoutVariable, IExpr x) { if (exprWithoutVariable.isZero()) { final Matcher matcher = new Matcher(); // match a_.*variable^n_.+b_.*variable^m_ to E^(((-I)*Pi + Log(a) - Log(b))/(m - n)) matcher.caseOf( F.Plus(F.Times(F.b_DEFAULT, F.Power(x, F.m_)), F.Times(F.a_DEFAULT, F.Power(x, F.n_DEFAULT))), // F.Condition( F.Exp(F.Times(F.Power(F.Plus(F.m, F.Negate(F.n)), -1), F.Plus(F.Times(F.CNI, F.Pi), F.Log(F.a), F.Negate(F.Log(F.b))))), F.And(F.FreeQ(F.a, x), F.FreeQ(F.b, x), F.FreeQ(F.n, x), F.FreeQ(F.m, x)))); return matcher.replaceAll(ast); } return F.NIL; }