package org.matheclipse.core.integrate.rubi42;


import static org.matheclipse.core.expression.F.*;
import static org.matheclipse.core.integrate.rubi42.UtilityFunctionCtors.*;
import static org.matheclipse.core.integrate.rubi42.UtilityFunctions.*;

import org.matheclipse.core.interfaces.IAST;
import org.matheclipse.core.interfaces.IExpr;
import org.matheclipse.core.interfaces.ISymbol;
/** 
 * IntegrationRules rules from the Rubi -
 * rule-based integrator.
 *  
 */
public class IntegrationRulesForMiscellaneousExpressions4 { 
  public static IAST RULES = List( 
SetDelayed(FreeTerms($p(u),$p(x)),
    If(SumQ(u),Map(Function(If(FreeQ(Slot1,x),Slot1,C0)),u),If(FreeQ(u,x),u,C0))),
SetDelayed(NonfreeTerms($p(u),$p(x)),
    If(SumQ(u),Map(Function(If(FreeQ(Slot1,x),C0,Slot1)),u),If(FreeQ(u,x),C0,u))),
SetDelayed(LinearQ($p(u),$p(x,SymbolHead)),
    PolyQ(u,x,C1)),
SetDelayed(PowerOfLinearQ(Power($p(u),$p(m,true)),$p(x,SymbolHead)),
    And(And(FreeQ(m,x),PolynomialQ(u,x)),If(IntegerQ(m),MatchQ(FactorSquareFree(u),Condition(Power($p(w),$p(n,true)),And(FreeQ(n,x),LinearQ(w,x)))),LinearQ(u,x)))),
SetDelayed(QuadraticQ($p(u),$p(x,SymbolHead)),
    PolyQ(u,x,C2)),
SetDelayed(PolyQ($p(u),$p(x,SymbolHead),$p(n,IntegerHead)),
    If(ListQ(u),Catch(CompoundExpression(Scan(Function(If(Not(PolyQ(Slot1,x,n)),Throw(False))),u),True)),And(PolynomialQ(u,x),Equal(Exponent(u,x),n)))),
SetDelayed(LinearPairQ($p(u),$p(v),$p(x,SymbolHead)),
    And(And(And(LinearQ(u,x),LinearQ(v,x)),NonzeroQ(Plus(u,Times(CN1,x)))),ZeroQ(Plus(Times(Coefficient(u,x,C0),Coefficient(v,x,C1)),Times(CN1,Coefficient(u,x,C1),Coefficient(v,x,C0)))))),
SetDelayed(BinomialQ($p(u),$p(x,SymbolHead)),
    If(ListQ(u),Catch(CompoundExpression(Scan(Function(If(Not(BinomialQ(Slot1,x)),Throw(False))),u),True)),NotFalseQ(BinomialTest(u,x)))),
SetDelayed(BinomialQ($p(u),$p(x,SymbolHead),$p(n)),
    If(ListQ(u),Catch(CompoundExpression(Scan(Function(If(Not(BinomialQ(Slot1,x,n)),Throw(False))),u),True)),$(Function(And(NotFalseQ(Slot1),SameQ(Part(Slot1,C3),n))),BinomialTest(u,x)))),
SetDelayed(GeneralizedBinomialQ($p(u),$p(x,SymbolHead)),
    If(ListQ(u),Catch(CompoundExpression(Scan(Function(If(Not(GeneralizedBinomialQ(Slot1,x)),Throw(False))),u),True)),NotFalseQ(GeneralizedBinomialTest(u,x)))),
SetDelayed(TrinomialQ($p(u),$p(x,SymbolHead)),
    If(ListQ(u),Catch(CompoundExpression(Scan(Function(If(Not(TrinomialQ(Slot1,x)),Throw(False))),u),True)),And(And(NotFalseQ(TrinomialTest(u,x)),Not(QuadraticQ(u,x))),Not(MatchQ(u,Condition(Power($p(w),C2),BinomialQ(w,x))))))),
SetDelayed(GeneralizedTrinomialQ($p(u),$p(x,SymbolHead)),
    If(ListQ(u),Catch(CompoundExpression(Scan(Function(If(Not(GeneralizedTrinomialQ(Slot1,x)),Throw(False))),u),True)),NotFalseQ(GeneralizedTrinomialTest(u,x)))),
SetDelayed(MonomialQ($p(u),$p(x,SymbolHead)),
    If(ListQ(u),Catch(CompoundExpression(Scan(Function(If(MonomialQ(Slot1,x),Null,Throw(False))),u),True)),MatchQ(u,Condition(Times($p(a,true),Power(x,$p(n,true))),FreeQ(List(a,n),x))))),
SetDelayed(MonomialSumQ($p(u),$p(x,SymbolHead)),
    And(SumQ(u),Catch(CompoundExpression(Scan(Function(If(Or(FreeQ(Slot1,x),MonomialQ(Slot1,x)),Null,Throw(False))),u),True)))),
SetDelayed(MinimumMonomialExponent($p(u),$p(x,SymbolHead)),
    Module(List(Set(n,MonomialExponent(First(u),x))),CompoundExpression(Scan(Function(If(PosQ(Plus(n,Times(CN1,MonomialExponent(Slot1,x)))),Set(n,MonomialExponent(Slot1,x)))),u),n))),
SetDelayed(MonomialExponent(Times(Power($p(x),$p(n,true)),$p(a,true)),$p(x,SymbolHead)),
    Condition(n,FreeQ(List(a,n),x))),
SetDelayed(LinearMatchQ($p(u),$p(x,SymbolHead)),
    If(ListQ(u),Catch(CompoundExpression(Scan(Function(If(Not(LinearMatchQ(Slot1,x)),Throw(False))),u),True)),MatchQ(u,Condition(Plus($p(a,true),Times($p(b,true),x)),FreeQ(List(a,b),x))))),
SetDelayed(PowerOfLinearMatchQ($p(u),$p(x,SymbolHead)),
    If(ListQ(u),Catch(CompoundExpression(Scan(Function(If(Not(PowerOfLinearMatchQ(Slot1,x)),Throw(False))),u),True)),MatchQ(u,Condition(Power(Plus($p(a,true),Times($p(b,true),x)),$p(m,true)),FreeQ(List(a,b,m),x))))),
SetDelayed(QuadraticMatchQ($p(u),$p(x,SymbolHead)),
    If(ListQ(u),Catch(CompoundExpression(Scan(Function(If(Not(QuadraticMatchQ(Slot1,x)),Throw(False))),u),True)),Or(MatchQ(u,Condition(Plus($p(a,true),Times($p(b,true),x),Times($p(c,true),Power(x,C2))),FreeQ(List(a,b,c),x))),MatchQ(u,Condition(Plus($p(a,true),Times($p(c,true),Power(x,C2))),FreeQ(List(a,c),x)))))),
SetDelayed(CubicMatchQ($p(u),$p(x,SymbolHead)),
    If(ListQ(u),Catch(CompoundExpression(Scan(Function(If(Not(CubicMatchQ(Slot1,x)),Throw(False))),u),True)),Or(Or(Or(MatchQ(u,Condition(Plus($p(a,true),Times($p(b,true),x),Times($p(c,true),Power(x,C2)),Times($p(d,true),Power(x,C3))),FreeQ(List(a,b,c,d),x))),MatchQ(u,Condition(Plus($p(a,true),Times($p(b,true),x),Times($p(d,true),Power(x,C3))),FreeQ(List(a,b,d),x)))),MatchQ(u,Condition(Plus($p(a,true),Times($p(c,true),Power(x,C2)),Times($p(d,true),Power(x,C3))),FreeQ(List(a,c,d),x)))),MatchQ(u,Condition(Plus($p(a,true),Times($p(d,true),Power(x,C3))),FreeQ(List(a,d),x)))))),
SetDelayed(BinomialMatchQ($p(u),$p(x,SymbolHead)),
    If(ListQ(u),Catch(CompoundExpression(Scan(Function(If(Not(BinomialMatchQ(Slot1,x)),Throw(False))),u),True)),MatchQ(u,Condition(Plus($p(a,true),Times($p(b,true),Power(x,$p(n,true)))),FreeQ(List(a,b,n),x))))),
SetDelayed(GeneralizedBinomialMatchQ($p(u),$p(x,SymbolHead)),
    If(ListQ(u),Catch(CompoundExpression(Scan(Function(If(Not(GeneralizedBinomialMatchQ(Slot1,x)),Throw(False))),u),True)),MatchQ(u,Condition(Plus(Times($p(a,true),Power(x,$p(q,true))),Times($p(b,true),Power(x,$p(n,true)))),FreeQ(List(a,b,n,q),x))))),
SetDelayed(TrinomialMatchQ($p(u),$p(x,SymbolHead)),
    If(ListQ(u),Catch(CompoundExpression(Scan(Function(If(Not(TrinomialMatchQ(Slot1,x)),Throw(False))),u),True)),MatchQ(u,Condition(Plus($p(a,true),Times($p(b,true),Power(x,$p(n,true))),Times($p(c,true),Power(x,$p(j,true)))),And(FreeQ(List(a,b,c,n),x),ZeroQ(Plus(j,Times(CN1,C2,n)))))))),
SetDelayed(GeneralizedTrinomialMatchQ($p(u),$p(x,SymbolHead)),
    If(ListQ(u),Catch(CompoundExpression(Scan(Function(If(Not(GeneralizedTrinomialMatchQ(Slot1,x)),Throw(False))),u),True)),MatchQ(u,Condition(Plus(Times($p(a,true),Power(x,$p(q,true))),Times($p(b,true),Power(x,$p(n,true))),Times($p(c,true),Power(x,$p(r,true)))),And(FreeQ(List(a,b,c,n,q),x),ZeroQ(Plus(r,Times(CN1,Plus(Times(C2,n),Times(CN1,q)))))))))),
SetDelayed(QuotientOfLinearsMatchQ($p(u),$p(x,SymbolHead)),
    If(ListQ(u),Catch(CompoundExpression(Scan(Function(If(Not(QuotientOfLinearsMatchQ(Slot1,x)),Throw(False))),u),True)),MatchQ(u,Condition(Times($p(e,true),Plus($p(a,true),Times($p(b,true),x)),Power(Plus($p(c,true),Times($p(d,true),x)),CN1)),FreeQ(List(a,b,c,d,e),x))))),
SetDelayed(PolynomialTermQ($p(u),$p(x,SymbolHead)),
    Or(FreeQ(u,x),MatchQ(u,Condition(Times($p(a,true),Power(x,$p(n,true))),And(And(FreeQ(a,x),IntegerQ(n)),Greater(n,C0)))))),
SetDelayed(PolynomialTerms($p(u),$p(x,SymbolHead)),
    Map(Function(If(PolynomialTermQ(Slot1,x),Slot1,C0)),u)),
SetDelayed(NonpolynomialTerms($p(u),$p(x,SymbolHead)),
    Map(Function(If(PolynomialTermQ(Slot1,x),C0,Slot1)),u)),
SetDelayed(BinomialDegree($p(u),$p(x,SymbolHead)),
    Part(BinomialTest(u,x),C3)),
SetDelayed(BinomialTest($p(u),$p(x,SymbolHead)),
    If(PolynomialQ(u,x),If(Greater(Exponent(u,x),C0),Module(List(Set($s("lst"),Exponent(u,x,$s("List")))),If(Equal(Length($s("lst")),C1),List(C0,Coefficient(u,x,Exponent(u,x)),Exponent(u,x)),If(And(Equal(Length($s("lst")),C2),Equal(Part($s("lst"),C1),C0)),List(Coefficient(u,x,C0),Coefficient(u,x,Exponent(u,x)),Exponent(u,x)),False))),False),If(PowerQ(u),If(And(SameQ(Part(u,C1),x),FreeQ(Part(u,C2),x)),List(C0,C1,Part(u,C2)),False),Module(List($s("lst1"),$s("lst2")),If(ProductQ(u),If(FreeQ(First(u),x),CompoundExpression(Set($s("lst2"),BinomialTest(Rest(u),x)),If(FalseQ($s("lst2")),False,List(Times(First(u),Part($s("lst2"),C1)),Times(First(u),Part($s("lst2"),C2)),Part($s("lst2"),C3)))),If(FreeQ(Rest(u),x),CompoundExpression(Set($s("lst1"),BinomialTest(First(u),x)),If(FalseQ($s("lst1")),False,List(Times(Rest(u),Part($s("lst1"),C1)),Times(Rest(u),Part($s("lst1"),C2)),Part($s("lst1"),C3)))),CompoundExpression(CompoundExpression(Set($s("lst1"),BinomialTest(First(u),x)),Set($s("lst2"),BinomialTest(Rest(u),x))),If(Or(FalseQ($s("lst1")),FalseQ($s("lst2"))),False,Module(List(a,b,c,d,m,n),CompoundExpression(CompoundExpression(Set(List(a,b,m),$s("lst1")),Set(List(c,d,n),$s("lst2"))),If(ZeroQ(a),If(ZeroQ(c),List(C0,Times(b,d),Plus(m,n)),If(ZeroQ(Plus(m,n)),List(Times(b,d),Times(b,c),m),False)),If(ZeroQ(c),If(ZeroQ(Plus(m,n)),List(Times(b,d),Times(a,d),n),False),If(And(ZeroQ(Plus(m,Times(CN1,n))),ZeroQ(Plus(Times(a,d),Times(b,c)))),List(Times(a,c),Times(b,d),Times(C2,m)),False))))))))),If(SumQ(u),If(FreeQ(First(u),x),CompoundExpression(Set($s("lst2"),BinomialTest(Rest(u),x)),If(FalseQ($s("lst2")),False,List(Plus(First(u),Part($s("lst2"),C1)),Part($s("lst2"),C2),Part($s("lst2"),C3)))),If(FreeQ(Rest(u),x),CompoundExpression(Set($s("lst1"),BinomialTest(First(u),x)),If(FalseQ($s("lst1")),False,List(Plus(Rest(u),Part($s("lst1"),C1)),Part($s("lst1"),C2),Part($s("lst1"),C3)))),CompoundExpression(CompoundExpression(Set($s("lst1"),BinomialTest(First(u),x)),Set($s("lst2"),BinomialTest(Rest(u),x))),If(Or(FalseQ($s("lst1")),FalseQ($s("lst2"))),False,If(ZeroQ(Plus(Part($s("lst1"),C3),Times(CN1,Part($s("lst2"),C3)))),List(Plus(Part($s("lst1"),C1),Part($s("lst2"),C1)),Plus(Part($s("lst1"),C2),Part($s("lst2"),C2)),Part($s("lst1"),C3)),False))))),False)))))),
SetDelayed(GeneralizedBinomialDegree($p(u),$p(x,SymbolHead)),
    $(Function(Plus(Part(Slot1,C3),Times(CN1,Part(Slot1,C4)))),GeneralizedBinomialTest(u,x))),
SetDelayed(GeneralizedBinomialTest(Plus(Times(Power($p(x),$p(q,true)),$p(a,true)),Times(Power($p(x),$p(n,true)),$p(b,true))),$p(x,SymbolHead)),
    Condition(List(a,b,n,q),And(FreeQ(List(a,b,n,q),x),PosQ(Plus(n,Times(CN1,q)))))),
SetDelayed(GeneralizedBinomialTest(Times($p(a),$p(u)),$p(x,SymbolHead)),
    Condition(Module(List(Set($s("lst"),GeneralizedBinomialTest(u,x))),Condition(List(Times(a,Part($s("lst"),C1)),Times(a,Part($s("lst"),C2)),Part($s("lst"),C3),Part($s("lst"),C4)),NotFalseQ($s("lst")))),FreeQ(a,x))),
SetDelayed(GeneralizedBinomialTest(Times(Power($p(x),$p(m,true)),$p(u)),$p(x,SymbolHead)),
    Condition(Module(List(Set($s("lst"),GeneralizedBinomialTest(u,x))),Condition(List(Part($s("lst"),C1),Part($s("lst"),C2),Plus(m,Part($s("lst"),C3)),Plus(m,Part($s("lst"),C4))),And(And(NotFalseQ($s("lst")),NonzeroQ(Plus(m,Part($s("lst"),C3)))),NonzeroQ(Plus(m,Part($s("lst"),C4)))))),FreeQ(m,x))),
SetDelayed(GeneralizedBinomialTest(Times(Power($p(x),$p(m,true)),$p(u)),$p(x,SymbolHead)),
    Condition(Module(List(Set($s("lst"),BinomialTest(u,x))),Condition(List(Part($s("lst"),C1),Part($s("lst"),C2),Plus(m,Part($s("lst"),C3)),m),And(NotFalseQ($s("lst")),NonzeroQ(Plus(m,Part($s("lst"),C3)))))),FreeQ(m,x))),
SetDelayed(GeneralizedBinomialTest($p(u),$p(x,SymbolHead)),
    False),
SetDelayed(TrinomialDegree($p(u),$p(x,SymbolHead)),
    Part(TrinomialTest(u,x),C4)),
SetDelayed(TrinomialTest($p(u),$p(x,SymbolHead)),
    If(PolynomialQ(u,x),Module(List(Set($s("lst"),CoefficientList(u,x))),If(Or(Or(Less(Length($s("lst")),C3),EvenQ(Length($s("lst")))),ZeroQ(Part($s("lst"),Times(C1D2,Plus(Length($s("lst")),C1))))),False,Catch(CompoundExpression(Scan(Function(If(ZeroQ(Slot1),Null,Throw(False))),Drop(Drop(Drop($s("lst"),List(Times(C1D2,Plus(Length($s("lst")),C1)))),C1),CN1)),List(First($s("lst")),Part($s("lst"),Times(C1D2,Plus(Length($s("lst")),C1))),Last($s("lst")),Times(C1D2,Plus(Length($s("lst")),Times(CN1,C1)))))))),If(PowerQ(u),If(ZeroQ(Plus(Part(u,C2),Times(CN1,C2))),Module(List(Set($s("lst"),BinomialTest(Part(u,C1),x))),If(FalseQ($s("lst")),False,List(Power(Part($s("lst"),C1),C2),Times(C2,Part($s("lst"),C1),Part($s("lst"),C2)),Power(Part($s("lst"),C2),C2),Part($s("lst"),C3)))),False),Module(List($s("lst1"),$s("lst2")),If(ProductQ(u),If(FreeQ(First(u),x),CompoundExpression(Set($s("lst2"),TrinomialTest(Rest(u),x)),If(FalseQ($s("lst2")),False,List(Times(First(u),Part($s("lst2"),C1)),Times(First(u),Part($s("lst2"),C2)),Times(First(u),Part($s("lst2"),C3)),Part($s("lst2"),C4)))),If(FreeQ(Rest(u),x),CompoundExpression(Set($s("lst1"),TrinomialTest(First(u),x)),If(FalseQ($s("lst1")),False,List(Times(Rest(u),Part($s("lst1"),C1)),Times(Rest(u),Part($s("lst1"),C2)),Times(Rest(u),Part($s("lst1"),C3)),Part($s("lst1"),C4)))),CompoundExpression(CompoundExpression(Set($s("lst1"),BinomialTest(First(u),x)),Set($s("lst2"),BinomialTest(Rest(u),x))),If(Or(FalseQ($s("lst1")),FalseQ($s("lst2"))),False,Module(List(a,b,c,d,m,n),CompoundExpression(CompoundExpression(Set(List(a,b,m),$s("lst1")),Set(List(c,d,n),$s("lst2"))),If(And(ZeroQ(Plus(m,Times(CN1,n))),NonzeroQ(Plus(Times(a,d),Times(b,c)))),List(Times(a,c),Plus(Times(a,d),Times(b,c)),Times(b,d),m),False))))))),If(SumQ(u),If(FreeQ(First(u),x),CompoundExpression(Set($s("lst2"),TrinomialTest(Rest(u),x)),If(FalseQ($s("lst2")),False,List(Plus(First(u),Part($s("lst2"),C1)),Part($s("lst2"),C2),Part($s("lst2"),C3),Part($s("lst2"),C4)))),If(FreeQ(Rest(u),x),CompoundExpression(Set($s("lst1"),TrinomialTest(First(u),x)),If(FalseQ($s("lst1")),False,List(Plus(Rest(u),Part($s("lst1"),C1)),Part($s("lst1"),C2),Part($s("lst1"),C3),Part($s("lst1"),C4)))),CompoundExpression(Set($s("lst1"),TrinomialTest(First(u),x)),If(FalseQ($s("lst1")),CompoundExpression(Set($s("lst1"),BinomialTest(First(u),x)),If(FalseQ($s("lst1")),False,CompoundExpression(Set($s("lst2"),TrinomialTest(Rest(u),x)),If(FalseQ($s("lst2")),CompoundExpression(Set($s("lst2"),BinomialTest(Rest(u),x)),If(FalseQ($s("lst2")),False,If(ZeroQ(Plus(Part($s("lst1"),C3),Times(CN1,C2,Part($s("lst2"),C3)))),List(Plus(Part($s("lst1"),C1),Part($s("lst2"),C1)),Part($s("lst2"),C2),Part($s("lst1"),C2),Part($s("lst2"),C3)),If(ZeroQ(Plus(Part($s("lst2"),C3),Times(CN1,C2,Part($s("lst1"),C3)))),List(Plus(Part($s("lst1"),C1),Part($s("lst2"),C1)),Part($s("lst1"),C2),Part($s("lst2"),C2),Part($s("lst1"),C3)),False)))),If(And(ZeroQ(Plus(Part($s("lst1"),C3),Times(CN1,Part($s("lst2"),C4)))),NonzeroQ(Plus(Part($s("lst1"),C2),Part($s("lst2"),C2)))),List(Plus(Part($s("lst1"),C1),Part($s("lst2"),C1)),Plus(Part($s("lst1"),C2),Part($s("lst2"),C2)),Part($s("lst2"),C3),Part($s("lst2"),C4)),If(And(ZeroQ(Plus(Part($s("lst1"),C3),Times(CN1,C2,Part($s("lst2"),C4)))),NonzeroQ(Plus(Part($s("lst1"),C2),Part($s("lst2"),C3)))),List(Plus(Part($s("lst1"),C1),Part($s("lst2"),C1)),Part($s("lst2"),C2),Plus(Part($s("lst1"),C2),Part($s("lst2"),C3)),Part($s("lst2"),C4)),False)))))),CompoundExpression(Set($s("lst2"),TrinomialTest(Rest(u),x)),If(FalseQ($s("lst2")),CompoundExpression(Set($s("lst2"),BinomialTest(Rest(u),x)),If(FalseQ($s("lst2")),False,If(And(ZeroQ(Plus(Part($s("lst2"),C3),Times(CN1,Part($s("lst1"),C4)))),NonzeroQ(Plus(Part($s("lst1"),C2),Part($s("lst2"),C2)))),List(Plus(Part($s("lst1"),C1),Part($s("lst2"),C1)),Plus(Part($s("lst1"),C2),Part($s("lst2"),C2)),Part($s("lst1"),C3),Part($s("lst1"),C4)),If(And(ZeroQ(Plus(Part($s("lst2"),C3),Times(CN1,C2,Part($s("lst1"),C4)))),NonzeroQ(Plus(Part($s("lst1"),C3),Part($s("lst2"),C2)))),List(Plus(Part($s("lst1"),C1),Part($s("lst2"),C1)),Part($s("lst1"),C2),Plus(Part($s("lst1"),C3),Part($s("lst2"),C2)),Part($s("lst1"),C4)),False)))),If(And(And(ZeroQ(Plus(Part($s("lst1"),C4),Times(CN1,Part($s("lst2"),C4)))),NonzeroQ(Plus(Part($s("lst1"),C2),Part($s("lst2"),C2)))),NonzeroQ(Plus(Part($s("lst1"),C3),Part($s("lst2"),C3)))),List(Plus(Part($s("lst1"),C1),Part($s("lst2"),C1)),Plus(Part($s("lst1"),C2),Part($s("lst2"),C2)),Plus(Part($s("lst1"),C3),Part($s("lst2"),C3)),Part($s("lst1"),C4)),False))))))),False)))))),
SetDelayed(GeneralizedTrinomialDegree($p(u),$p(x,SymbolHead)),
    $(Function(Plus(Part(Slot1,C4),Times(CN1,Part(Slot1,C5)))),GeneralizedTrinomialTest(u,x))),
SetDelayed(GeneralizedTrinomialTest(Plus(Times(Power($p(x),$p(q,true)),$p(a,true)),Times(Power($p(x),$p(n,true)),$p(b,true)),Times(Power($p(x),$p(r,true)),$p(c,true))),$p(x,SymbolHead)),
    Condition(List(a,b,c,n,q),And(FreeQ(List(a,b,c,n,q),x),ZeroQ(Plus(r,Times(CN1,Plus(Times(C2,n),Times(CN1,q)))))))),
SetDelayed(GeneralizedTrinomialTest(Times($p(a),$p(u)),$p(x,SymbolHead)),
    Condition(Module(List(Set($s("lst"),GeneralizedTrinomialTest(u,x))),Condition(List(Times(a,Part($s("lst"),C1)),Times(a,Part($s("lst"),C2)),Times(a,Part($s("lst"),C3)),Part($s("lst"),C4),Part($s("lst"),C5)),NotFalseQ($s("lst")))),FreeQ(a,x))),
SetDelayed(GeneralizedTrinomialTest(Times(Power($p(x),$p(m,true)),$p(u)),$p(x,SymbolHead)),
    Condition(Module(List(Set($s("lst"),GeneralizedTrinomialTest(u,x))),Condition(List(Part($s("lst"),C1),Part($s("lst"),C2),Part($s("lst"),C3),Plus(m,Part($s("lst"),C4)),Plus(m,Part($s("lst"),C5))),And(And(NotFalseQ($s("lst")),NonzeroQ(Plus(m,Part($s("lst"),C4)))),NonzeroQ(Plus(m,Part($s("lst"),C5)))))),FreeQ(m,x))),
SetDelayed(GeneralizedTrinomialTest(Times(Power($p(x),$p(m,true)),$p(u)),$p(x,SymbolHead)),
    Condition(Module(List(Set($s("lst"),TrinomialTest(u,x))),Condition(List(Part($s("lst"),C1),Part($s("lst"),C2),Part($s("lst"),C3),Plus(m,Part($s("lst"),C4)),m),And(NotFalseQ($s("lst")),NonzeroQ(Plus(m,Part($s("lst"),C4)))))),FreeQ(m,x))),
SetDelayed(GeneralizedTrinomialTest($p(u),$p(x,SymbolHead)),
    False),
SetDelayed(PerfectPowerTest($p(u),$p(x,SymbolHead)),
    If(PolynomialQ(u,x),Module(List(Set($s("lst"),FactorSquareFreeList(u)),Set($s("gcd"),C0),Set(v,C1)),CompoundExpression(CompoundExpression(If(SameQ(Part($s("lst"),C1),List(C1,C1)),Set($s("lst"),Rest($s("lst")))),Scan(Function(Set($s("gcd"),GCD($s("gcd"),Part(Slot1,C2)))),$s("lst"))),If(Greater($s("gcd"),C1),CompoundExpression(Scan(Function(Set(v,Times(v,Power(Part(Slot1,C1),Times(Part(Slot1,C2),Power($s("gcd"),CN1)))))),$s("lst")),Power(Expand(v),$s("gcd"))),False))),False)),
SetDelayed(RationalFunctionQ($p(u),$p(x,SymbolHead)),
    If(Or(AtomQ(u),FreeQ(u,x)),True,If(IntegerPowerQ(u),RationalFunctionQ(Part(u,C1),x),If(Or(ProductQ(u),SumQ(u)),Catch(CompoundExpression(Scan(Function(If(Not(RationalFunctionQ(Slot1,x)),Throw(False))),u),True)),False)))),
SetDelayed(RationalFunctionFactors($p(u),$p(x,SymbolHead)),
    If(ProductQ(u),Map(Function(If(RationalFunctionQ(Slot1,x),Slot1,C1)),u),If(RationalFunctionQ(u,x),u,C1))),
SetDelayed(NonrationalFunctionFactors($p(u),$p(x,SymbolHead)),
    If(ProductQ(u),Map(Function(If(RationalFunctionQ(Slot1,x),C1,Slot1)),u),If(RationalFunctionQ(u,x),C1,u))),
SetDelayed(RationalFunctionExponents($p(u),$p(x,SymbolHead)),
    If(PolynomialQ(u,x),List(Exponent(u,x),C0),If(IntegerPowerQ(u),If(Greater(Part(u,C2),C0),Times(Part(u,C2),RationalFunctionExponents(Part(u,C1),x)),Times(CN1,Part(u,C2),Reverse(RationalFunctionExponents(Part(u,C1),x)))),If(ProductQ(u),Plus(RationalFunctionExponents(First(u),x),RationalFunctionExponents(Rest(u),x)),If(SumQ(u),Module(List(Set(v,Together(u))),If(SumQ(v),Module(List($s("lst1"),$s("lst2")),CompoundExpression(CompoundExpression(Set($s("lst1"),RationalFunctionExponents(First(u),x)),Set($s("lst2"),RationalFunctionExponents(Rest(u),x))),List(Max(Plus(Part($s("lst1"),C1),Part($s("lst2"),C2)),Plus(Part($s("lst2"),C1),Part($s("lst1"),C2))),Plus(Part($s("lst1"),C2),Part($s("lst2"),C2))))),RationalFunctionExponents(v,x))),List(C0,C0)))))),
SetDelayed(RationalFunctionExpand(Times(Power($p(v),$p(n)),$p(u)),$p(x,SymbolHead)),
    Condition(Module(List(Set(w,RationalFunctionExpand(u,x))),If(SumQ(w),Map(Function(Times(Slot1,Power(v,n))),w),Times(w,Power(v,n)))),And(FractionQ(n),UnsameQ(v,x))))
  );
}

 

Ads help maintain this website.