Search in sources :

Example 1 with Matcher

use of org.matheclipse.core.patternmatching.Matcher in project symja_android_library by axkr.

the class EliminateRules method init1.

public static Matcher init1() {
    // eliminv(a_^x_*x_*z_.,x_):=ProductLog((x*Log(a))/z)/Log(a)/;FreeQ({a,z},x)
    Matcher matcher = new Matcher();
    matcher.caseOf($(eliminv, Times(Power(a_, x_), x_, z_DEFAULT), x_), Condition(Times(Power(Log(a), CN1), ProductLog(Times(x, Power(z, CN1), Log(a)))), FreeQ(list(a, z), x)));
    return matcher;
}
Also used : Matcher(org.matheclipse.core.patternmatching.Matcher)

Example 2 with Matcher

use of org.matheclipse.core.patternmatching.Matcher in project symja_android_library by axkr.

the class MatcherExample method main.

public static void main(String[] args) {
    final Matcher matcher = new Matcher();
    // I/(2*E^(I*x))-1/2*I*E^(I*x)
    // 
    matcher.caseOf(// 
    Sin(x_), x -> Subtract(Times(C1D2, CI, Power(E, Times(CNI, x))), Times(C1D2, CI, Power(E, Times(CI, x)))));
    // 1/(2*E^(I*x))+E^(I*x)/2
    // 
    matcher.caseOf(// 
    Cos(x_), x -> Plus(Times(C1D2, Power(E, Times(CNI, x))), Times(C1D2, Power(E, Times(CI, x)))));
    // (I*(E^(-I*x)-E^(I*x)))/(E^(-I*x)+E^(I*x))
    // 
    matcher.caseOf(// 
    Tan(x_), x -> Times(CI, Subtract(Power(E, Times(CNI, x)), Power(E, Times(CI, x))), Power(Plus(Power(E, Times(CNI, x)), Power(E, Times(CI, x))), CN1)));
    // -I*Log(I*x+Sqrt(1-x^2))
    // 
    matcher.caseOf(// 
    ArcSin(x_), x -> Times(CNI, Log(Plus(Sqrt(Subtract(C1, Sqr(x))), Times(CI, x)))));
    // Pi/2+I*Log(I*x+Sqrt(1-x^2))
    // 
    matcher.caseOf(// 
    ArcCos(x_), x -> Plus(Times(C1D2, Pi), Times(CI, Log(Plus(Sqrt(Subtract(C1, Sqr(x))), Times(CI, x))))));
    // 1/2*I*Log(1-I*x)-1/2*I*Log(1+I*x)
    // 
    matcher.caseOf(// 
    ArcTan(x_), x -> Subtract(Times(C1D2, CI, Log(Plus(C1, Times(CNI, x)))), Times(C1D2, CI, Log(Plus(C1, Times(CI, x))))));
    // (E^x+E^(-x))/2
    // 
    matcher.caseOf(// 
    Cosh(x_), x -> Times(C1D2, Plus(Power(E, x), Power(E, Times(CN1, x)))));
    // 2/(E^x-E^(-x))
    // 
    matcher.caseOf(// 
    Csch(x_), x -> Times(C2, Power(Plus(Power(E, x), Times(CN1, Power(E, Times(CN1, x)))), CN1)));
    // ((E^(-x))+E^x)/((-E^(-x))+E^x)
    // 
    matcher.caseOf(// 
    Coth(x_), x -> Times(Plus(Power(E, x), Power(E, Times(CN1, x))), Power(Plus(Power(E, x), Times(CN1, Power(E, Times(CN1, x)))), CN1)));
    // 2/(E^x+E^(-x))
    // 
    matcher.caseOf(// 
    Sech(x_), x -> Times(C2, Power(Plus(Power(E, x), Power(E, Times(CN1, x))), CN1)));
    // (E^x-E^(-x))/2
    // 
    matcher.caseOf(// 
    Sinh(x_), x -> Times(C1D2, Plus(Power(E, x), Times(CN1, Power(E, Times(CN1, x))))));
    // ((-E^(-x))+E^x)/((E^(-x))+E^x)
    // 
    matcher.caseOf(// 
    Tanh(x_), x -> Times(Plus(Times(CN1, Power(E, Times(CN1, x))), Power(E, x)), Power(Plus(Power(E, Times(CN1, x)), Power(E, x)), CN1)));
    try {
        ExprEvaluator util = new ExprEvaluator();
        IExpr input = util.eval("Sin(a)");
        IExpr result = matcher.apply(input);
        if (result.isPresent()) {
            // print: I/(2*E^(I*a))-1/2*I*E^(I*a)
            System.out.println(result.toString());
        }
        input = util.eval("Cos(x)^2+Sinh(x)^3");
        result = matcher.replaceAll(input);
        if (result.isPresent()) {
            // print: I/(2*E^(I*a))-1/2*I*E^(I*a)
            System.out.println(result.toString());
        }
    } catch (SyntaxError e) {
        // catch Symja parser errors here
        System.out.println(e.getMessage());
    } catch (MathException me) {
        // catch Symja math errors here
        System.out.println(me.getMessage());
    } catch (Exception e) {
        e.printStackTrace();
    } catch (final StackOverflowError soe) {
        System.out.println(soe.getMessage());
    } catch (final OutOfMemoryError oome) {
        System.out.println(oome.getMessage());
    }
}
Also used : ExprEvaluator(org.matheclipse.core.eval.ExprEvaluator) Matcher(org.matheclipse.core.patternmatching.Matcher) SyntaxError(org.matheclipse.parser.client.SyntaxError) MathException(org.matheclipse.parser.client.math.MathException) IExpr(org.matheclipse.core.interfaces.IExpr) MathException(org.matheclipse.parser.client.math.MathException)

Example 3 with Matcher

use of org.matheclipse.core.patternmatching.Matcher in project symja_android_library by axkr.

the class EliminateRules method init2.

public static Matcher init2() {
    // elimzeroplus(b_.*x_^m_+a_.*x_^n_.,x_):=E^((-I*Pi+Log(a)-Log(b))/(m-n))/;FreeQ(a,x)&&FreeQ(b,x)&&FreeQ(n,x)&&FreeQ(m,x)
    Matcher matcher = new Matcher();
    matcher.caseOf($(elimzeroplus, Plus(Times(b_DEFAULT, Power(x_, m_)), Times(a_DEFAULT, Power(x_, n_DEFAULT))), x_), Condition(Exp(Times(Power(Subtract(m, n), CN1), Plus(Times(CNI, Pi), Log(a), Negate(Log(b))))), And(FreeQ(a, x), FreeQ(b, x), FreeQ(n, x), FreeQ(m, x))));
    // elimzeroplus(b_.*m_^x_+a_.*x_^n_,x_):={(-n*ProductLog((-(-b/a)^(1/n)*Log(m))/n))/Log(m),(-n*ProductLog(((-b/a)^(1/n)*Log(m))/n))/Log(m)}/;FreeQ(a,x)&&FreeQ(b,x)&&FreeQ(n,x)&&FreeQ(m,x)
    matcher.caseOf($(elimzeroplus, Plus(Times(b_DEFAULT, Power(m_, x_)), Times(a_DEFAULT, Power(x_, n_))), x_), Condition(list(Times(CN1, n, Power(Log(m), CN1), ProductLog(Times(CN1, Power(Times(CN1, Power(a, CN1), b), Power(n, CN1)), Power(n, CN1), Log(m)))), Times(CN1, n, Power(Log(m), CN1), ProductLog(Times(Power(Times(CN1, Power(a, CN1), b), Power(n, CN1)), Power(n, CN1), Log(m))))), And(FreeQ(a, x), FreeQ(b, x), FreeQ(n, x), FreeQ(m, x))));
    // elimzeroplus(w_.*Sqrt(a_.+b_.*x_)+z_.,x_):=Expand(-a*w^2+z^2)/(b*w^2)/;FreeQ({a,b,w,z},x)
    matcher.caseOf($(elimzeroplus, Plus(Times(w_DEFAULT, Sqrt(Plus(a_DEFAULT, Times(b_DEFAULT, x_)))), z_DEFAULT), x_), Condition(Times(Power(Times(b, Sqr(w)), CN1), Expand(Plus(Times(CN1, a, Sqr(w)), Sqr(z)))), FreeQ(List(a, b, w, z), x)));
    // elimzeroplus(w_.*Sqrt(a_.+b_.*x_)+x_*y_.+z_.,x_):={(b*w^2-2*y*z-w*Sqrt(b^2*w^2+4*a*y^2-4*b*y*z))/(2*y^2),(b*w^2-2*y*z+w*Sqrt(b^2*w^2+4*a*y^2-4*b*y*z))/(2*y^2)}/;FreeQ({a,b,w,y,z},x)&&!PossibleZeroQ(y)
    matcher.caseOf($(elimzeroplus, Plus(Times(w_DEFAULT, Sqrt(Plus(a_DEFAULT, Times(b_DEFAULT, x_)))), Times(x_, y_DEFAULT), z_DEFAULT), x_), Condition(list(Times(Power(Times(C2, Sqr(y)), CN1), Plus(Times(b, Sqr(w)), Times(CN2, y, z), Times(CN1, w, Sqrt(Plus(Times(Sqr(b), Sqr(w)), Times(C4, a, Sqr(y)), Times(CN4, b, y, z)))))), Times(Power(Times(C2, Sqr(y)), CN1), Plus(Times(b, Sqr(w)), Times(CN2, y, z), Times(w, Sqrt(Plus(Times(Sqr(b), Sqr(w)), Times(C4, a, Sqr(y)), Times(CN4, b, y, z))))))), And(FreeQ(List(a, b, w, y, z), x), Not(PossibleZeroQ(y)))));
    // elimzeroplus(w_.*Sqrt(a_.+b_.*x_+c_.*x_^2)+x_*y_.+z_.,x_):=If(PossibleZeroQ(c*w^2-y^2),Expand(-w^2*a+z^2)/(w^2*b-2*y*z),{(-b*w^2+2*y*z-Sqrt(b^2*w^4-4*a*c*w^4+4*a*w^2*y^2-4*b*w^2*y*z+4*c*w^2*z^2))/(2*(c*w^2-y^2)),(-b*w^2+2*y*z+Sqrt(b^2*w^4-4*a*c*w^4+4*a*w^2*y^2-4*b*w^2*y*z+4*c*w^2*z^2))/(2*(c*w^2-y^2))})/;FreeQ({a,b,c,w,y,z},x)
    matcher.caseOf($(elimzeroplus, Plus(Times(w_DEFAULT, Sqrt(Plus(a_DEFAULT, Times(b_DEFAULT, x_), Times(c_DEFAULT, Sqr(x_))))), Times(x_, y_DEFAULT), z_DEFAULT), x_), Condition(If(PossibleZeroQ(Subtract(Times(c, Sqr(w)), Sqr(y))), Times(Power(Plus(Times(Sqr(w), b), Times(CN2, y, z)), CN1), Expand(Plus(Times(CN1, Sqr(w), a), Sqr(z)))), list(Times(Power(Times(C2, Subtract(Times(c, Sqr(w)), Sqr(y))), CN1), Plus(Times(CN1, b, Sqr(w)), Times(C2, y, z), Negate(Sqrt(Plus(Times(Sqr(b), Power(w, C4)), Times(CN4, a, c, Power(w, C4)), Times(C4, a, Sqr(w), Sqr(y)), Times(CN4, b, Sqr(w), y, z), Times(C4, c, Sqr(w), Sqr(z))))))), Times(Power(Times(C2, Subtract(Times(c, Sqr(w)), Sqr(y))), CN1), Plus(Times(CN1, b, Sqr(w)), Times(C2, y, z), Sqrt(Plus(Times(Sqr(b), Power(w, C4)), Times(CN4, a, c, Power(w, C4)), Times(C4, a, Sqr(w), Sqr(y)), Times(CN4, b, Sqr(w), y, z), Times(C4, c, Sqr(w), Sqr(z)))))))), FreeQ(List(a, b, c, w, y, z), x)));
    return matcher;
}
Also used : Matcher(org.matheclipse.core.patternmatching.Matcher)

Example 4 with Matcher

use of org.matheclipse.core.patternmatching.Matcher in project symja_android_library by axkr.

the class SumRules method init1.

public static Matcher init1() {
    // Sum(i_,{i_Symbol,a_Integer,n_Integer}):=If(a<=n,-1/2*(-1+a-n)*(a+n),0)
    Matcher matcher = new Matcher();
    matcher.caseOf(Sum(i_, list(i_Symbol, $p(a, Integer), $p(n, Integer))), If(LessEqual(a, n), Times(CN1D2, Plus(CN1, a, Negate(n)), Plus(a, n)), C0));
    // Sum(c_^i_,{i_Symbol,1,Infinity}):=-c/(-1+c)/;FreeQ(c,i)&&(!NumberQ(c)||(c>-1&&c<1))
    matcher.caseOf(Sum(Power(c_, i_), list(i_Symbol, C1, oo)), Condition(Times(CN1, c, Power(Plus(CN1, c), CN1)), And(FreeQ(c, i), Or(Not(NumberQ(c)), And(Greater(c, CN1), Less(c, C1))))));
    // Sum(i_^k_,{i_Symbol,1,Infinity}):=Zeta(-k)/;FreeQ(k,i)
    matcher.caseOf(Sum(Power(i_, k_), list(i_Symbol, C1, oo)), Condition(Zeta(Negate(k)), FreeQ(k, i)));
    // Sum(1/i_^k_,{i_Symbol,1,Infinity}):=Zeta(k)/;FreeQ(k,i)
    matcher.caseOf(Sum(Power(Power(i_, k_), CN1), list(i_Symbol, C1, oo)), Condition(Zeta(k), FreeQ(k, i)));
    // Sum(k_^(a_.*i_),{i_Symbol,1,Infinity}):=-k^a/(-1+k^a)/;FreeQ(k,i)&&a<0&&(k>1||k<-1)
    matcher.caseOf(Sum(Power(k_, Times(a_DEFAULT, i_)), list(i_Symbol, C1, oo)), Condition(Times(CN1, Power(k, a), Power(Plus(CN1, Power(k, a)), CN1)), And(FreeQ(k, i), Less(a, C0), Or(Greater(k, C1), Less(k, CN1)))));
    // Sum(x_^(2*i_+1)/(2*i_+1)!,{i_Symbol,0,Infinity}):=Sinh(x)/;FreeQ(x,i)
    matcher.caseOf(Sum(Times(Power(Factorial(Plus(Times(C2, i_), C1)), CN1), Power(x_, Plus(Times(C2, i_), C1))), list(i_Symbol, C0, oo)), Condition(Sinh(x), FreeQ(x, i)));
    // Sum((-1)^i_*x_^(2*i_+1)/(2*i_+1)!,{i_Symbol,0,Infinity}):=Sin(x)/;FreeQ(x,i)
    matcher.caseOf(Sum(Times(Power(CN1, i_), Power(Factorial(Plus(Times(C2, i_), C1)), CN1), Power(x_, Plus(Times(C2, i_), C1))), list(i_Symbol, C0, oo)), Condition(Sin(x), FreeQ(x, i)));
    // Sum(x_^(2*i_)/(2*i_)!,{i_Symbol,0,Infinity}):=Cosh(x)/;FreeQ(x,i)
    matcher.caseOf(Sum(Times(Power(Factorial(Times(C2, i_)), CN1), Power(x_, Times(C2, i_))), list(i_Symbol, C0, oo)), Condition(Cosh(x), FreeQ(x, i)));
    // Sum((-1)^i_*x_^(2*i_)/(2*i_)!,{i_Symbol,0,Infinity}):=Cos(x)/;FreeQ(x,i)
    matcher.caseOf(Sum(Times(Power(CN1, i_), Power(Factorial(Times(C2, i_)), CN1), Power(x_, Times(C2, i_))), list(i_Symbol, C0, oo)), Condition(Cos(x), FreeQ(x, i)));
    // Sum((-1)^i_*x_^(2*i_+1)/(2*i_+1),{i_Symbol,0,Infinity}):=ArcTanh(x)/;FreeQ(x,i)
    matcher.caseOf(Sum(Times(Power(CN1, i_), Power(Plus(Times(C2, i_), C1), CN1), Power(x_, Plus(Times(C2, i_), C1))), list(i_Symbol, C0, oo)), Condition(ArcTanh(x), FreeQ(x, i)));
    // Sum(1/i_!,{i_Symbol,0,Infinity}):=E/;FreeQ(x,i)
    matcher.caseOf(Sum(Power(Factorial(i_), CN1), list(i_Symbol, C0, oo)), Condition(E, FreeQ(x, i)));
    // Sum(x_^i_/i_!,{i_Symbol,0,Infinity}):=E^x/;FreeQ(x,i)
    matcher.caseOf(Sum(Times(Power(Factorial(i_), CN1), Power(x_, i_)), list(i_Symbol, C0, oo)), Condition(Exp(x), FreeQ(x, i)));
    // Sum(1/((-1)^i_*(2*i_+1)),{i_Symbol,1,Infinity}):=1/4*(-4+Pi)
    matcher.caseOf(Sum(Times(Power(CN1, Negate(i_)), Power(Plus(Times(C2, i_), C1), CN1)), list(i_Symbol, C1, oo)), Times(C1D4, Plus(CN4, Pi)));
    // Sum(i_^k_Symbol,{i_Symbol,1,n_Symbol}):=HarmonicNumber(n,-k)/;FreeQ(k,i)&&FreeQ(n,i)
    matcher.caseOf(Sum(Power(i_, k_Symbol), list(i_Symbol, C1, n_Symbol)), Condition(HarmonicNumber(n, Negate(k)), And(FreeQ(k, i), FreeQ(n, i))));
    // Sum(i_^c_,{i_Symbol,0,n_Symbol}):=0^c+HarmonicNumber(n,-c)/;FreeQ({c,n},i)
    matcher.caseOf(Sum(Power(i_, c_), list(i_Symbol, C0, n_Symbol)), Condition(Plus(Power(C0, c), HarmonicNumber(n, Negate(c))), FreeQ(list(c, n), i)));
    // Sum(i_^c_,{i_Symbol,1,n_Symbol}):=HarmonicNumber(n,-c)/;FreeQ({c,n},i)
    matcher.caseOf(Sum(Power(i_, c_), list(i_Symbol, C1, n_Symbol)), Condition(HarmonicNumber(n, Negate(c)), FreeQ(list(c, n), i)));
    // Sum(a_.*b_^i_,{i_Symbol,1,n_Symbol}):=(a*b*(-1+b^k))/(-1+b)/;FreeQ({a,b,n},i)
    matcher.caseOf(Sum(Times(a_DEFAULT, Power(b_, i_)), list(i_Symbol, C1, n_Symbol)), Condition(Times(a, Power(Plus(CN1, b), CN1), b, Plus(CN1, Power(b, k))), FreeQ(list(a, b, n), i)));
    // Sum(Ceiling(Log(i_)),{i_Symbol,1,n_Symbol}):=(Floor(Log(n))*E^(Floor(Log(n))+1)-(Floor(Log(n))+1)*E^Floor(Log(n))+1)/(-1+E)+(-E^Floor(Log(n))+n)*Ceiling(Log(n))/;FreeQ(n,i)
    matcher.caseOf(Sum(Ceiling(Log(i_)), list(i_Symbol, C1, n_Symbol)), Condition(Plus(Times(Plus(Times(Floor(Log(n)), Exp(Plus(Floor(Log(n)), C1))), Times(CN1, Plus(Floor(Log(n)), C1), Exp(Floor(Log(n)))), C1), Power(Plus(CN1, E), CN1)), Times(Plus(Negate(Exp(Floor(Log(n)))), n), Ceiling(Log(n)))), FreeQ(n, i)));
    // Sum(Ceiling(Log(i_)/Log(a_)),{i_Symbol,1,n_Symbol}):=(Floor(Log(a,n))*a^(Floor(Log(a,n))+1)-(Floor(Log(a,n))+1)*a^Floor(Log(a,n))+1)/(-1+a)+(-a^Floor(Log(a,n))+n)*Ceiling(Log(a,n))/;FreeQ(a,i)&&FreeQ(n,i)
    matcher.caseOf(Sum(Ceiling(Times(Power(Log(a_), CN1), Log(i_))), list(i_Symbol, C1, n_Symbol)), Condition(Plus(Times(Plus(Times(Floor(Log(a, n)), Power(a, Plus(Floor(Log(a, n)), C1))), Times(CN1, Plus(Floor(Log(a, n)), C1), Power(a, Floor(Log(a, n)))), C1), Power(Plus(CN1, a), CN1)), Times(Plus(Negate(Power(a, Floor(Log(a, n)))), n), Ceiling(Log(a, n)))), And(FreeQ(a, i), FreeQ(n, i))));
    // Sum(1/Binomial(2*i_,i_),{i_Symbol,1,Infinity}):=1/27*(2*Pi*Sqrt(3)+9)
    matcher.caseOf(Sum(Power(Binomial(Times(C2, i_), i_), CN1), list(i_Symbol, C1, oo)), Times(QQ(1L, 27L), Plus(Times(C2, Pi, CSqrt3), C9)));
    // Sum(1/(i_*Binomial(2*i_,i_)),{i_Symbol,1,Infinity}):=1/9*Sqrt(3)*Pi
    matcher.caseOf(Sum(Times(Power(i_, CN1), Power(Binomial(Times(C2, i_), i_), CN1)), list(i_Symbol, C1, oo)), Times(QQ(1L, 9L), CSqrt3, Pi));
    // Sum(1/(i_^2*Binomial(2*i_,i_)),{i_Symbol,1,Infinity}):=Zeta(2)/3
    matcher.caseOf(Sum(Times(Power(i_, CN2), Power(Binomial(Times(C2, i_), i_), CN1)), list(i_Symbol, C1, oo)), Times(C1D3, Zeta(C2)));
    // Sum(1/((-1)^(1-i_)*i_),{i_Symbol,1,Infinity}):=Log(2)
    matcher.caseOf(Sum(Times(Power(CN1, Plus(CN1, i_)), Power(i_, CN1)), list(i_Symbol, C1, oo)), Log(C2));
    // Sum(z_^i_/i_^n_,{i_Symbol,1,Infinity}):=PolyLog(n,z)/;FreeQ({z,n},i)
    matcher.caseOf(Sum(Times(Power(z_, i_), Power(i_, Negate(n_))), list(i_Symbol, C1, oo)), Condition(PolyLog(n, z), FreeQ(list(z, n), i)));
    // Sum(c_^i_,{i_Symbol,0,n_Symbol}):=(-1+c^(1+n))/(-1+c)/;FreeQ({c,n},i)
    matcher.caseOf(Sum(Power(c_, i_), list(i_Symbol, C0, n_Symbol)), Condition(Times(Power(Plus(CN1, c), CN1), Plus(CN1, Power(c, Plus(C1, n)))), FreeQ(list(c, n), i)));
    // Sum(i_*c_^i_,{i_Symbol,0,n_Symbol}):=(c+c^(1+n)*(-1-n+c*n))/(1-c)^2/;FreeQ({c,n},i)
    matcher.caseOf(Sum(Times(i_, Power(c_, i_)), list(i_Symbol, C0, n_Symbol)), Condition(Times(Power(Subtract(C1, c), CN2), Plus(c, Times(Power(c, Plus(C1, n)), Plus(CN1, Negate(n), Times(c, n))))), FreeQ(list(c, n), i)));
    // Sum(Binomial(n_,i_),{i_Symbol,0,n_Symbol}):=2^n/;FreeQ(n,i)
    matcher.caseOf(Sum(Binomial(n_, i_), list(i_Symbol, C0, n_Symbol)), Condition(Power(C2, n), FreeQ(n, i)));
    // Sum(i_*Binomial(n_,i_),{i_Symbol,0,n_Symbol}):=n/2^(1-n)/;FreeQ(n,i)
    matcher.caseOf(Sum(Times(i_, Binomial(n_, i_)), list(i_Symbol, C0, n_Symbol)), Condition(Times(n, Power(C2, Plus(CN1, n))), FreeQ(n, i)));
    // Sum(i_!,{i_Symbol,0,n_Symbol}):=-Subfactorial(-1)+Gamma(n+2)*(-1)^(n+1)*Subfactorial(-2-n)/;FreeQ(n,i)
    matcher.caseOf(Sum(Factorial(i_), list(i_Symbol, C0, n_Symbol)), Condition(Plus(Negate(Subfactorial(CN1)), Times(Gamma(Plus(n, C2)), Power(CN1, Plus(n, C1)), Subfactorial(Subtract(CN2, n)))), FreeQ(n, i)));
    return matcher;
}
Also used : Matcher(org.matheclipse.core.patternmatching.Matcher)

Example 5 with Matcher

use of org.matheclipse.core.patternmatching.Matcher in project symja_android_library by axkr.

the class ProductRules method init1.

public static Matcher init1() {
    // Product(x_Symbol,{x_,0,m_}):=0
    Matcher matcher = new Matcher();
    matcher.caseOf(Product(x_Symbol, list(x_, C0, m_)), C0);
    // Product(x_Symbol,{x_,0,m_,s_}):=0/;0<m
    matcher.caseOf(Product(x_Symbol, List(x_, C0, m_, s_)), Condition(C0, Less(C0, m)));
    // Product(x_Symbol,{x_,m_,n_}):=Pochhammer(m,1-m+n)/;FreeQ({m,n},x)
    matcher.caseOf(Product(x_Symbol, list(x_, m_, n_)), Condition(Pochhammer(m, Plus(C1, Negate(m), n)), FreeQ(list(m, n), x)));
    // Product(x_Symbol,{y_,m_,n_}):=x^(1-m+n)/;FreeQ({y,m,n},x)
    matcher.caseOf(Product(x_Symbol, list(y_, m_, n_)), Condition(Power(x, Plus(C1, Negate(m), n)), FreeQ(list(y, m, n), x)));
    return matcher;
}
Also used : Matcher(org.matheclipse.core.patternmatching.Matcher)

Aggregations

Matcher (org.matheclipse.core.patternmatching.Matcher)5 ExprEvaluator (org.matheclipse.core.eval.ExprEvaluator)1 IExpr (org.matheclipse.core.interfaces.IExpr)1 SyntaxError (org.matheclipse.parser.client.SyntaxError)1 MathException (org.matheclipse.parser.client.math.MathException)1