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;
/** 
 * UtilityFunctions rules from the Rubi -
 * rule-based integrator.
 *  
 */
public class UtilityFunctions4 { 
  public static IAST RULES = List( 
SetDelayed(Dist($p(u),Dist($p(v),$p(w),$p(x)),$p(x)),
    Dist(Times(u,v),w,x)),
SetDelayed(Dist($p(u),Times($p(v),$p(w)),$p(x)),
    Condition(Dist(Times(u,v),w,x),And(And(SameQ($s("ShowSteps"),True),FreeQ(v,$s("Int"))),Not(FreeQ(w,$s("Int")))))),
SetDelayed(Dist($p(u),$p(v),$p(x)),
    If(SameQ(u,C1),v,If(SameQ(u,C0),CompoundExpression(Print(stringx("*** Warning ***:  Dist[0,"),v,stringx(" "),x,stringx("]")),C0),If(And(Less(NumericFactor(u),C0),Greater(NumericFactor(Times(CN1,u)),C0)),Times(CN1,Dist(Times(CN1,u),v,x)),If(SumQ(v),Map(Function(Dist(u,Slot1,x)),v),If(FreeQ(v,$s("Int")),Simp(Times(u,v),x),Module(List(Set(w,Times(Simp(Times(u,Power(x,C2)),x),Power(Power(x,C2),CN1)))),If(And(And(UnsameQ(w,u),FreeQ(w,x)),SameQ(w,Simp(w,x))),Dist(w,v,x),If(UnsameQ($s("ShowSteps"),True),Simp(Times(u,v),x),$(Defer($s("Integrate::Dist")),u,v,x)))))))))),
SetDelayed(FunctionOfLinear($p(u),$p(x,SymbolHead)),
    Module(List(Set($s("lst"),FunctionOfLinear(u,False,False,x,False))),If(Or(Or(FalseQ($s("lst")),FalseQ(Part($s("lst"),C1))),And(SameQ(Part($s("lst"),C1),C0),SameQ(Part($s("lst"),C2),C1))),False,List(FunctionOfLinearSubst(u,Part($s("lst"),C1),Part($s("lst"),C2),x),Part($s("lst"),C1),Part($s("lst"),C2))))),
SetDelayed(FunctionOfLinear($p(u),$p(a),$p(b),$p(x),$p("flag")),
    If(FreeQ(u,x),List(a,b),If(CalculusQ(u),False,If(LinearQ(u,x),If(FalseQ(a),List(Coefficient(u,x,C0),Coefficient(u,x,C1)),Module(List(Set($s("lst"),CommonFactors(List(b,Coefficient(u,x,C1))))),If(And(ZeroQ(Coefficient(u,x,C0)),Not($s("flag"))),List(C0,Part($s("lst"),C1)),If(ZeroQ(Plus(Times(b,Coefficient(u,x,C0)),Times(CN1,a,Coefficient(u,x,C1)))),List(Times(a,Power(Part($s("lst"),C2),CN1)),Part($s("lst"),C1)),List(C0,C1))))),If(And(PowerQ(u),FreeQ(Part(u,C1),x)),FunctionOfLinear(Times(Log(Part(u,C1)),Part(u,C2)),a,b,x,False),Module(List($s("lst")),If(And(ProductQ(u),NonzeroQ(Part(Set($s("lst"),MonomialFactor(u,x)),C1))),If(And(And(And(False,IntegerQ(Part($s("lst"),C1))),Unequal(Part($s("lst"),C1),CN1)),FreeQ(Part($s("lst"),C2),x)),If(And(RationalQ(LeadFactor(Part($s("lst"),C2))),Less(LeadFactor(Part($s("lst"),C2)),C0)),FunctionOfLinear(Times(DivideDegreesOfFactors(Times(CN1,Part($s("lst"),C2)),Part($s("lst"),C1)),x),a,b,x,False),FunctionOfLinear(Times(DivideDegreesOfFactors(Part($s("lst"),C2),Part($s("lst"),C1)),x),a,b,x,False)),False),CompoundExpression(Set($s("lst"),List(a,b)),Catch(CompoundExpression(Scan(Function(CompoundExpression(Set($s("lst"),FunctionOfLinear(Slot1,Part($s("lst"),C1),Part($s("lst"),C2),x,SumQ(u))),If(FalseQ($s("lst")),Throw(False)))),u),$s("lst"))))))))))),
SetDelayed(FunctionOfLinearSubst($p(u),$p(a),$p(b),$p(x)),
    If(FreeQ(u,x),u,If(LinearQ(u,x),Module(List(Set($s("tmp"),Coefficient(u,x,C1))),CompoundExpression(Set($s("tmp"),If(SameQ($s("tmp"),b),C1,Times($s("tmp"),Power(b,CN1)))),Plus(Coefficient(u,x,C0),Times(CN1,a,$s("tmp")),Times($s("tmp"),x)))),If(And(PowerQ(u),FreeQ(Part(u,C1),x)),Power(E,FullSimplify(FunctionOfLinearSubst(Times(Log(Part(u,C1)),Part(u,C2)),a,b,x))),Module(List($s("lst")),If(And(ProductQ(u),NonzeroQ(Part(Set($s("lst"),MonomialFactor(u,x)),C1))),If(And(RationalQ(LeadFactor(Part($s("lst"),C2))),Less(LeadFactor(Part($s("lst"),C2)),C0)),Times(CN1,Power(FunctionOfLinearSubst(Times(DivideDegreesOfFactors(Times(CN1,Part($s("lst"),C2)),Part($s("lst"),C1)),x),a,b,x),Part($s("lst"),C1))),Power(FunctionOfLinearSubst(Times(DivideDegreesOfFactors(Part($s("lst"),C2),Part($s("lst"),C1)),x),a,b,x),Part($s("lst"),C1))),Map(Function(FunctionOfLinearSubst(Slot1,a,b,x)),u))))))),
SetDelayed(DivideDegreesOfFactors($p(u),$p(n)),
    If(ProductQ(u),Map(Function(Power(LeadBase(Slot1),Times(LeadDegree(Slot1),Power(n,CN1)))),u),Power(LeadBase(u),Times(LeadDegree(u),Power(n,CN1))))),
SetDelayed(FunctionOfInverseLinear($p(u),$p(x,SymbolHead)),
    FunctionOfInverseLinear(u,Null,x)),
SetDelayed(FunctionOfInverseLinear($p(u),$p("lst"),$p(x)),
    If(FreeQ(u,x),$s("lst"),If(SameQ(u,x),False,If(QuotientOfLinearsQ(u,x),Module(List(Set($s("tmp"),Drop(QuotientOfLinearsParts(u,x),C2))),If(SameQ(Part($s("tmp"),C2),C0),False,If(SameQ($s("lst"),Null),$s("tmp"),If(ZeroQ(Plus(Times(Part($s("lst"),C1),Part($s("tmp"),C2)),Times(CN1,Part($s("lst"),C2),Part($s("tmp"),C1)))),$s("lst"),False)))),If(CalculusQ(u),False,Module(List(Set($s("tmp"),$s("lst"))),Catch(CompoundExpression(Scan(Function(If(FalseQ(Set($s("tmp"),FunctionOfInverseLinear(Slot1,$s("tmp"),x))),Throw(False))),u),$s("tmp"))))))))),
SetDelayed(FunctionOfExponentialQ($p(u),$p(x,SymbolHead)),
    Block(List(Set(Times($s("$base"),$s("$")),Null),Set(Times($s("$expon"),$s("$")),Null),Set(Times($s("$exponFlag"),$s("$")),False)),And(FunctionOfExponentialTest(u,x),Times($s("$exponFlag"),$s("$"))))),
SetDelayed(FunctionOfExponential($p(u),$p(x,SymbolHead)),
    Block(List(Set(Times($s("$base"),$s("$")),Null),Set(Times($s("$expon"),$s("$")),Null),Set(Times($s("$exponFlag"),$s("$")),False)),CompoundExpression(FunctionOfExponentialTest(u,x),Times($s("$base"),Power($s("$"),$s("$expon")),$s("$"))))),
SetDelayed(FunctionOfExponentialFunction($p(u),$p(x,SymbolHead)),
    Block(List(Set(Times($s("$base"),$s("$")),Null),Set(Times($s("$expon"),$s("$")),Null),Set(Times($s("$exponFlag"),$s("$")),False)),CompoundExpression(FunctionOfExponentialTest(u,x),SimplifyIntegrand(FunctionOfExponentialFunctionAux(u,x),x)))),
SetDelayed(FunctionOfExponentialFunctionAux($p(u),$p(x)),
    If(AtomQ(u),u,If(And(And(PowerQ(u),FreeQ(Part(u,C1),x)),LinearQ(Part(u,C2),x)),If(ZeroQ(Coefficient(Times($s("$expon"),$s("$")),x,C0)),Times(Power(Part(u,C1),Coefficient(Part(u,C2),x,C0)),Power(x,FullSimplify(Times(Log(Part(u,C1)),Coefficient(Part(u,C2),x,C1),Power(Times(Log(Times($s("$base"),$s("$"))),Coefficient(Times($s("$expon"),$s("$")),x,C1)),CN1))))),Power(x,FullSimplify(Times(Log(Part(u,C1)),Coefficient(Part(u,C2),x,C1),Power(Times(Log(Times($s("$base"),$s("$"))),Coefficient(Times($s("$expon"),$s("$")),x,C1)),CN1))))),If(And(HyperbolicQ(u),LinearQ(Part(u,C1),x)),Module(List($s("tmp")),CompoundExpression(Set($s("tmp"),Power(x,FullSimplify(Times(Coefficient(Part(u,C1),x,C1),Power(Times(Log(Times($s("$base"),$s("$"))),Coefficient(Times($s("$expon"),$s("$")),x,C1)),CN1))))),If(SinhQ(u),Plus(Times(C1D2,$s("tmp")),Times(CN1,Power(Times(C2,$s("tmp")),CN1))),If(CoshQ(u),Plus(Times(C1D2,$s("tmp")),Power(Times(C2,$s("tmp")),CN1)),If(TanhQ(u),Times(Plus($s("tmp"),Times(CN1,Power($s("tmp"),CN1))),Power(Plus($s("tmp"),Power($s("tmp"),CN1)),CN1)),If(CothQ(u),Times(Plus($s("tmp"),Power($s("tmp"),CN1)),Power(Plus($s("tmp"),Times(CN1,Power($s("tmp"),CN1))),CN1)),If(SechQ(u),Times(C2,Power(Plus($s("tmp"),Power($s("tmp"),CN1)),CN1)),Times(C2,Power(Plus($s("tmp"),Times(CN1,Power($s("tmp"),CN1))),CN1))))))))),If(And(And(PowerQ(u),FreeQ(Part(u,C1),x)),SumQ(Part(u,C2))),Times(FunctionOfExponentialFunctionAux(Power(Part(u,C1),First(Part(u,C2))),x),FunctionOfExponentialFunctionAux(Power(Part(u,C1),Rest(Part(u,C2))),x)),Map(Function(FunctionOfExponentialFunctionAux(Slot1,x)),u)))))),
SetDelayed(FunctionOfExponentialTest($p(u),$p(x)),
    If(FreeQ(u,x),True,If(Or(SameQ(u,x),CalculusQ(u)),False,If(And(And(PowerQ(u),FreeQ(Part(u,C1),x)),LinearQ(Part(u,C2),x)),CompoundExpression(Set(Times($s("$exponFlag"),$s("$")),True),FunctionOfExponentialTestAux(Part(u,C1),Part(u,C2),x)),If(And(HyperbolicQ(u),LinearQ(Part(u,C1),x)),FunctionOfExponentialTestAux(E,Part(u,C1),x),If(And(And(PowerQ(u),FreeQ(Part(u,C1),x)),SumQ(Part(u,C2))),And(FunctionOfExponentialTest(Power(Part(u,C1),First(Part(u,C2))),x),FunctionOfExponentialTest(Power(Part(u,C1),Rest(Part(u,C2))),x)),Catch(CompoundExpression(Scan(Function(If(Not(FunctionOfExponentialTest(Slot1,x)),Throw(False))),u),True)))))))),
SetDelayed(FunctionOfExponentialTestAux($p("base"),$p("expon"),$p(x)),
    If(SameQ(Times($s("$base"),$s("$")),Null),CompoundExpression(CompoundExpression(Set(Times($s("$base"),$s("$")),$s("base")),Set(Times($s("$expon"),$s("$")),$s("expon"))),True),Module(List($s("tmp")),CompoundExpression(Set($s("tmp"),FullSimplify(Times(Log($s("base")),Coefficient($s("expon"),x,C1),Power(Times(Log(Times($s("$base"),$s("$"))),Coefficient(Times($s("$expon"),$s("$")),x,C1)),CN1)))),If(Not(RationalQ($s("tmp"))),False,If(Or(ZeroQ(Coefficient(Times($s("$expon"),$s("$")),x,C0)),NonzeroQ(Plus($s("tmp"),Times(CN1,FullSimplify(Times(Log($s("base")),Coefficient($s("expon"),x,C0),Power(Times(Log(Times($s("$base"),$s("$"))),Coefficient(Times($s("$expon"),$s("$")),x,C0)),CN1))))))),CompoundExpression(CompoundExpression(If(And(PositiveIntegerQ($s("base"),Times($s("$base"),$s("$"))),Less($s("base"),Times($s("$base"),$s("$")))),CompoundExpression(CompoundExpression(Set(Times($s("$base"),$s("$")),$s("base")),Set(Times($s("$expon"),$s("$")),$s("expon"))),Set($s("tmp"),Power($s("tmp"),CN1)))),Set(Times($s("$expon"),$s("$")),Times(Coefficient(Times($s("$expon"),$s("$")),x,C1),x,Power(Denominator($s("tmp")),CN1)))),If(And(Less($s("tmp"),C0),NegQ(Coefficient(Times($s("$expon"),$s("$")),x,C1))),CompoundExpression(Set(Times($s("$expon"),$s("$")),Times(CN1,$s("$expon"),$s("$"))),True),True)),CompoundExpression(CompoundExpression(If(And(PositiveIntegerQ($s("base"),Times($s("$base"),$s("$"))),Less($s("base"),Times($s("$base"),$s("$")))),CompoundExpression(CompoundExpression(Set(Times($s("$base"),$s("$")),$s("base")),Set(Times($s("$expon"),$s("$")),$s("expon"))),Set($s("tmp"),Power($s("tmp"),CN1)))),Set(Times($s("$expon"),$s("$")),Times($s("$expon"),$s("$"),Power(Denominator($s("tmp")),CN1)))),If(And(Less($s("tmp"),C0),NegQ(Coefficient(Times($s("$expon"),$s("$")),x,C1))),CompoundExpression(Set(Times($s("$expon"),$s("$")),Times(CN1,$s("$expon"),$s("$"))),True),True)))))))),
SetDelayed(FunctionOfTrigOfLinearQ($p(u),$p(x,SymbolHead)),
    And(Not(MemberQ(List(Null,False),FunctionOfTrig(u,Null,x))),AlgebraicTrigFunctionQ(u,x))),
SetDelayed(FunctionOfTrig($p(u),$p(x,SymbolHead)),
    Module(List(Set(v,FunctionOfTrig(ActivateTrig(u),Null,x))),If(SameQ(v,Null),False,v))),
SetDelayed(FunctionOfTrig($p(u),$p(v),$p(x)),
    If(AtomQ(u),If(SameQ(u,x),False,v),If(And(TrigQ(u),LinearQ(Part(u,C1),x)),If(SameQ(v,Null),Part(u,C1),Module(List(Set(a,Coefficient(v,x,C0)),Set(b,Coefficient(v,x,C1)),Set(c,Coefficient(Part(u,C1),x,C0)),Set(d,Coefficient(Part(u,C1),x,C1))),If(And(ZeroQ(Plus(Times(a,d),Times(CN1,b,c))),RationalQ(Times(b,Power(d,CN1)))),Plus(Times(a,Power(Numerator(Times(b,Power(d,CN1))),CN1)),Times(b,x,Power(Numerator(Times(b,Power(d,CN1))),CN1))),False))),If(And(HyperbolicQ(u),LinearQ(Part(u,C1),x)),If(SameQ(v,Null),Times(CI,Part(u,C1)),Module(List(Set(a,Coefficient(v,x,C0)),Set(b,Coefficient(v,x,C1)),Set(c,Times(CI,Coefficient(Part(u,C1),x,C0))),Set(d,Times(CI,Coefficient(Part(u,C1),x,C1)))),If(And(ZeroQ(Plus(Times(a,d),Times(CN1,b,c))),RationalQ(Times(b,Power(d,CN1)))),Plus(Times(a,Power(Numerator(Times(b,Power(d,CN1))),CN1)),Times(b,x,Power(Numerator(Times(b,Power(d,CN1))),CN1))),False))),If(CalculusQ(u),False,Module(List(Set(w,v)),Catch(CompoundExpression(Scan(Function(If(FalseQ(Set(w,FunctionOfTrig(Slot1,w,x))),Throw(False))),u),w)))))))),
SetDelayed(AlgebraicTrigFunctionQ($p(u),$p(x,SymbolHead)),
    If(AtomQ(u),True,If(And(TrigQ(u),LinearQ(Part(u,C1),x)),True,If(And(HyperbolicQ(u),LinearQ(Part(u,C1),x)),True,If(And(PowerQ(u),FreeQ(Part(u,C2),x)),AlgebraicTrigFunctionQ(Part(u,C1),x),If(Or(ProductQ(u),SumQ(u)),Catch(CompoundExpression(Scan(Function(If(Not(AlgebraicTrigFunctionQ(Slot1,x)),Throw(False))),u),True)),False)))))),
SetDelayed(FunctionOfHyperbolic($p(u),$p(x,SymbolHead)),
    Module(List(Set(v,FunctionOfHyperbolic(u,Null,x))),If(SameQ(v,Null),False,v))),
SetDelayed(FunctionOfHyperbolic($p(u),$p(v),$p(x)),
    If(AtomQ(u),If(SameQ(u,x),False,v),If(And(HyperbolicQ(u),LinearQ(Part(u,C1),x)),If(SameQ(v,Null),Part(u,C1),Module(List(Set(a,Coefficient(v,x,C0)),Set(b,Coefficient(v,x,C1)),Set(c,Coefficient(Part(u,C1),x,C0)),Set(d,Coefficient(Part(u,C1),x,C1))),If(And(ZeroQ(Plus(Times(a,d),Times(CN1,b,c))),RationalQ(Times(b,Power(d,CN1)))),Plus(Times(a,Power(Numerator(Times(b,Power(d,CN1))),CN1)),Times(b,x,Power(Numerator(Times(b,Power(d,CN1))),CN1))),False))),If(CalculusQ(u),False,Module(List(Set(w,v)),Catch(CompoundExpression(Scan(Function(If(FalseQ(Set(w,FunctionOfHyperbolic(Slot1,w,x))),Throw(False))),u),w))))))),
SetDelayed(FunctionOfQ($p(v),$p(u),$p(x,SymbolHead)),
    FunctionOfQ(v,u,x,False)),
SetDelayed(FunctionOfQ($p(v),$p(u),$p(x,SymbolHead),$p("PureFlag")),
    If(FreeQ(u,x),False,If(AtomQ(v),True,If(Not(InertTrigFreeQ(u)),FunctionOfQ(v,ActivateTrig(u),x,$s("PureFlag")),If(And(PowerQ(v),FreeQ(Part(v,C2),x)),FunctionOfPowerQ(u,Part(v,C1),Part(v,C2),x),If(And(ProductQ(v),Not(OneQ(FreeFactors(v,x)))),FunctionOfQ(NonfreeFactors(v,x),u,x,$s("PureFlag")),If($s("PureFlag"),If(Or(SinQ(v),CscQ(v)),PureFunctionOfSinQ(u,Part(v,C1),x),If(Or(CosQ(v),SecQ(v)),PureFunctionOfCosQ(u,Part(v,C1),x),If(TanQ(v),PureFunctionOfTanQ(u,Part(v,C1),x),If(CotQ(v),PureFunctionOfCotQ(u,Part(v,C1),x),If(Or(SinhQ(v),CschQ(v)),PureFunctionOfSinhQ(u,Part(v,C1),x),If(Or(CoshQ(v),SechQ(v)),PureFunctionOfCoshQ(u,Part(v,C1),x),If(TanhQ(v),PureFunctionOfTanhQ(u,Part(v,C1),x),If(CothQ(v),PureFunctionOfCothQ(u,Part(v,C1),x),FunctionOfExpnQ(u,v,x))))))))),If(Or(SinQ(v),CscQ(v)),FunctionOfSinQ(u,Part(v,C1),x),If(Or(CosQ(v),SecQ(v)),FunctionOfCosQ(u,Part(v,C1),x),If(Or(TanQ(v),CotQ(v)),FunctionOfTanQ(u,Part(v,C1),x),If(Or(SinhQ(v),CschQ(v)),FunctionOfSinhQ(u,Part(v,C1),x),If(Or(CoshQ(v),SechQ(v)),FunctionOfCoshQ(u,Part(v,C1),x),If(Or(TanhQ(v),CothQ(v)),FunctionOfTanhQ(u,Part(v,C1),x),FunctionOfExpnQ(u,v,x)))))))))))))),
SetDelayed(FunctionOfExpnQ($p(u),$p(v),$p(x)),
    If(SameQ(u,v),True,If(AtomQ(u),UnsameQ(u,x),If(CalculusQ(u),False,Catch(CompoundExpression(Scan(Function(If(FunctionOfExpnQ(Slot1,v,x),Null,Throw(False))),u),True)))))),
SetDelayed(FunctionOfPowerQ($p(u),$p("bas"),$p("deg"),$p(x)),
    If(AtomQ(u),UnsameQ(u,x),If(CalculusQ(u),False,If(And(And(PowerQ(u),ZeroQ(Plus(Part(u,C1),Times(CN1,$s("bas"))))),FreeQ(Part(u,C2),x)),If(RationalQ($s("deg")),If(RationalQ(Part(u,C2)),And(IntegerQ(Times(Part(u,C2),Power($s("deg"),CN1))),Or(Greater($s("deg"),C0),Less(Part(u,C2),C0))),False),IntegerQ(Simplify(Times(Part(u,C2),Power($s("deg"),CN1))))),Catch(CompoundExpression(Scan(Function(If(FunctionOfPowerQ(Slot1,$s("bas"),$s("deg"),x),Null,Throw(False))),u),True)))))),
SetDelayed(FindTrigFactor($p("func1"),$p("func2"),$p(u),$p(v),$p("flag")),
    If(SameQ(u,C1),False,If(And(And(And(Or(SameQ(Head(LeadBase(u)),$s("func1")),SameQ(Head(LeadBase(u)),$s("func2"))),OddQ(LeadDegree(u))),IntegerQuotientQ(Part(LeadBase(u),C1),v)),Or($s("flag"),NonzeroQ(Plus(Part(LeadBase(u),C1),Times(CN1,v))))),List(Part(LeadBase(u),C1),RemainingFactors(u)),Module(List(Set($s("lst"),FindTrigFactor($s("func1"),$s("func2"),RemainingFactors(u),v,$s("flag")))),If(FalseQ($s("lst")),False,List(Part($s("lst"),C1),Times(LeadFactor(u),Part($s("lst"),C2)))))))),
SetDelayed(PureFunctionOfSinQ($p(u),$p(v),$p(x)),
    If(AtomQ(u),UnsameQ(u,x),If(CalculusQ(u),False,If(And(TrigQ(u),ZeroQ(Plus(Part(u,C1),Times(CN1,v)))),Or(SinQ(u),CscQ(u)),Catch(CompoundExpression(Scan(Function(If(Not(PureFunctionOfSinQ(Slot1,v,x)),Throw(False))),u),True)))))),
SetDelayed(PureFunctionOfCosQ($p(u),$p(v),$p(x)),
    If(AtomQ(u),UnsameQ(u,x),If(CalculusQ(u),False,If(And(TrigQ(u),ZeroQ(Plus(Part(u,C1),Times(CN1,v)))),Or(CosQ(u),SecQ(u)),Catch(CompoundExpression(Scan(Function(If(Not(PureFunctionOfCosQ(Slot1,v,x)),Throw(False))),u),True)))))),
SetDelayed(PureFunctionOfTanQ($p(u),$p(v),$p(x)),
    If(AtomQ(u),UnsameQ(u,x),If(CalculusQ(u),False,If(And(TrigQ(u),ZeroQ(Plus(Part(u,C1),Times(CN1,v)))),Or(TanQ(u),CotQ(u)),Catch(CompoundExpression(Scan(Function(If(Not(PureFunctionOfTanQ(Slot1,v,x)),Throw(False))),u),True)))))),
SetDelayed(PureFunctionOfCotQ($p(u),$p(v),$p(x)),
    If(AtomQ(u),UnsameQ(u,x),If(CalculusQ(u),False,If(And(TrigQ(u),ZeroQ(Plus(Part(u,C1),Times(CN1,v)))),CotQ(u),Catch(CompoundExpression(Scan(Function(If(Not(PureFunctionOfCotQ(Slot1,v,x)),Throw(False))),u),True)))))),
SetDelayed(FunctionOfSinQ($p(u),$p(v),$p(x)),
    If(AtomQ(u),UnsameQ(u,x),If(CalculusQ(u),False,If(And(TrigQ(u),IntegerQuotientQ(Part(u,C1),v)),If(OddQuotientQ(Part(u,C1),v),Or(SinQ(u),CscQ(u)),Or(CosQ(u),SecQ(u))),If(And(And(IntegerPowerQ(u),TrigQ(Part(u,C1))),IntegerQuotientQ(Part(u,C1,C1),v)),If(EvenQ(Part(u,C2)),True,FunctionOfSinQ(Part(u,C1),v,x)),If(ProductQ(u),If(And(And(And(CosQ(Part(u,C1)),SinQ(Part(u,C2))),ZeroQ(Plus(Part(u,C1,C1),Times(CN1,C1D2,v)))),ZeroQ(Plus(Part(u,C2,C1),Times(CN1,C1D2,v)))),FunctionOfSinQ(Drop(u,C2),v,x),Module(List($s("lst")),CompoundExpression(Set($s("lst"),FindTrigFactor($s("Sin"),$s("Csc"),u,v,False)),If(And(NotFalseQ($s("lst")),EvenQuotientQ(Part($s("lst"),C1),v)),FunctionOfSinQ(Times(Cos(v),Part($s("lst"),C2)),v,x),CompoundExpression(Set($s("lst"),FindTrigFactor($s("Cos"),$s("Sec"),u,v,False)),If(And(NotFalseQ($s("lst")),OddQuotientQ(Part($s("lst"),C1),v)),FunctionOfSinQ(Times(Cos(v),Part($s("lst"),C2)),v,x),CompoundExpression(Set($s("lst"),FindTrigFactor($s("Tan"),$s("Cot"),u,v,True)),If(NotFalseQ($s("lst")),FunctionOfSinQ(Times(Cos(v),Part($s("lst"),C2)),v,x),Catch(CompoundExpression(Scan(Function(If(Not(FunctionOfSinQ(Slot1,v,x)),Throw(False))),u),True)))))))))),Catch(CompoundExpression(Scan(Function(If(Not(FunctionOfSinQ(Slot1,v,x)),Throw(False))),u),True)))))))),
SetDelayed(FunctionOfCosQ($p(u),$p(v),$p(x)),
    If(AtomQ(u),UnsameQ(u,x),If(CalculusQ(u),False,If(And(TrigQ(u),IntegerQuotientQ(Part(u,C1),v)),Or(CosQ(u),SecQ(u)),If(And(And(IntegerPowerQ(u),TrigQ(Part(u,C1))),IntegerQuotientQ(Part(u,C1,C1),v)),If(EvenQ(Part(u,C2)),True,FunctionOfCosQ(Part(u,C1),v,x)),If(ProductQ(u),Module(List($s("lst")),CompoundExpression(Set($s("lst"),FindTrigFactor($s("Sin"),$s("Csc"),u,v,False)),If(NotFalseQ($s("lst")),FunctionOfCosQ(Times(Sin(v),Part($s("lst"),C2)),v,x),CompoundExpression(Set($s("lst"),FindTrigFactor($s("Tan"),$s("Cot"),u,v,True)),If(NotFalseQ($s("lst")),FunctionOfCosQ(Times(Sin(v),Part($s("lst"),C2)),v,x),Catch(CompoundExpression(Scan(Function(If(Not(FunctionOfCosQ(Slot1,v,x)),Throw(False))),u),True))))))),Catch(CompoundExpression(Scan(Function(If(Not(FunctionOfCosQ(Slot1,v,x)),Throw(False))),u),True)))))))),
SetDelayed(FunctionOfTanQ($p(u),$p(v),$p(x)),
    If(AtomQ(u),UnsameQ(u,x),If(CalculusQ(u),False,If(And(TrigQ(u),IntegerQuotientQ(Part(u,C1),v)),Or(Or(TanQ(u),CotQ(u)),EvenQuotientQ(Part(u,C1),v)),If(And(And(And(PowerQ(u),EvenQ(Part(u,C2))),TrigQ(Part(u,C1))),IntegerQuotientQ(Part(u,C1,C1),v)),True,If(ProductQ(u),Module(List(Set($s("lst"),ReapList(Scan(Function(If(Not(FunctionOfTanQ(Slot1,v,x)),Sow(Slot1))),u)))),If(SameQ($s("lst"),List()),True,And(And(Equal(Length($s("lst")),C2),OddTrigPowerQ(Part($s("lst"),C1),v,x)),OddTrigPowerQ(Part($s("lst"),C2),v,x)))),Catch(CompoundExpression(Scan(Function(If(Not(FunctionOfTanQ(Slot1,v,x)),Throw(False))),u),True)))))))),
SetDelayed(OddTrigPowerQ($p(u),$p(v),$p(x)),
    If(Or(Or(Or(SinQ(u),CosQ(u)),SecQ(u)),CscQ(u)),OddQuotientQ(Part(u,C1),v),If(PowerQ(u),And(OddQ(Part(u,C2)),OddTrigPowerQ(Part(u,C1),v,x)),If(ProductQ(u),Module(List(Set($s("lst"),ReapList(Scan(Function(If(Not(FunctionOfTanQ(Slot1,v,x)),Sow(Slot1))),u)))),If(SameQ($s("lst"),List()),True,And(Equal(Length($s("lst")),C1),OddTrigPowerQ(Part($s("lst"),C1),v,x)))),False)))),
SetDelayed(FunctionOfTanWeight($p(u),$p(v),$p(x)),
    If(AtomQ(u),C0,If(CalculusQ(u),C0,If(And(TrigQ(u),IntegerQuotientQ(Part(u,C1),v)),If(And(TanQ(u),ZeroQ(Plus(Part(u,C1),Times(CN1,v)))),C1,If(And(CotQ(u),ZeroQ(Plus(Part(u,C1),Times(CN1,v)))),CN1,C0)),If(And(And(And(PowerQ(u),EvenQ(Part(u,C2))),TrigQ(Part(u,C1))),IntegerQuotientQ(Part(u,C1,C1),v)),If(Or(Or(TanQ(Part(u,C1)),CosQ(Part(u,C1))),SecQ(Part(u,C1))),C1,CN1),If(ProductQ(u),If(Catch(CompoundExpression(Scan(Function(If(Not(FunctionOfTanQ(Slot1,v,x)),Throw(False))),u),True)),Apply($s("Plus"),Map(Function(FunctionOfTanWeight(Slot1,v,x)),Apply($s("List"),u))),C0),Apply($s("Plus"),Map(Function(FunctionOfTanWeight(Slot1,v,x)),Apply($s("List"),u))))))))),
SetDelayed(FunctionOfTrigQ($p(u),$p(v),$p(x,SymbolHead)),
    If(AtomQ(u),UnsameQ(u,x),If(CalculusQ(u),False,If(And(TrigQ(u),IntegerQuotientQ(Part(u,C1),v)),True,Catch(CompoundExpression(Scan(Function(If(Not(FunctionOfTrigQ(Slot1,v,x)),Throw(False))),u),True)))))),
SetDelayed(PureFunctionOfSinhQ($p(u),$p(v),$p(x)),
    If(AtomQ(u),UnsameQ(u,x),If(CalculusQ(u),False,If(And(HyperbolicQ(u),ZeroQ(Plus(Part(u,C1),Times(CN1,v)))),Or(SinhQ(u),CschQ(u)),Catch(CompoundExpression(Scan(Function(If(Not(PureFunctionOfSinhQ(Slot1,v,x)),Throw(False))),u),True)))))),
SetDelayed(PureFunctionOfCoshQ($p(u),$p(v),$p(x)),
    If(AtomQ(u),UnsameQ(u,x),If(CalculusQ(u),False,If(And(HyperbolicQ(u),ZeroQ(Plus(Part(u,C1),Times(CN1,v)))),Or(CoshQ(u),SechQ(u)),Catch(CompoundExpression(Scan(Function(If(Not(PureFunctionOfCoshQ(Slot1,v,x)),Throw(False))),u),True)))))),
SetDelayed(PureFunctionOfTanhQ($p(u),$p(v),$p(x)),
    If(AtomQ(u),UnsameQ(u,x),If(CalculusQ(u),False,If(And(HyperbolicQ(u),ZeroQ(Plus(Part(u,C1),Times(CN1,v)))),Or(TanhQ(u),CothQ(u)),Catch(CompoundExpression(Scan(Function(If(Not(PureFunctionOfTanhQ(Slot1,v,x)),Throw(False))),u),True)))))),
SetDelayed(PureFunctionOfCothQ($p(u),$p(v),$p(x)),
    If(AtomQ(u),UnsameQ(u,x),If(CalculusQ(u),False,If(And(HyperbolicQ(u),ZeroQ(Plus(Part(u,C1),Times(CN1,v)))),CothQ(u),Catch(CompoundExpression(Scan(Function(If(Not(PureFunctionOfCothQ(Slot1,v,x)),Throw(False))),u),True)))))),
SetDelayed(FunctionOfSinhQ($p(u),$p(v),$p(x)),
    If(AtomQ(u),UnsameQ(u,x),If(CalculusQ(u),False,If(And(HyperbolicQ(u),IntegerQuotientQ(Part(u,C1),v)),If(OddQuotientQ(Part(u,C1),v),Or(SinhQ(u),CschQ(u)),Or(CoshQ(u),SechQ(u))),If(And(And(IntegerPowerQ(u),HyperbolicQ(Part(u,C1))),IntegerQuotientQ(Part(u,C1,C1),v)),If(EvenQ(Part(u,C2)),True,FunctionOfSinhQ(Part(u,C1),v,x)),If(ProductQ(u),If(And(And(And(CoshQ(Part(u,C1)),SinhQ(Part(u,C2))),ZeroQ(Plus(Part(u,C1,C1),Times(CN1,C1D2,v)))),ZeroQ(Plus(Part(u,C2,C1),Times(CN1,C1D2,v)))),FunctionOfSinhQ(Drop(u,C2),v,x),Module(List($s("lst")),CompoundExpression(Set($s("lst"),FindTrigFactor($s("Sinh"),$s("Csch"),u,v,False)),If(And(NotFalseQ($s("lst")),EvenQuotientQ(Part($s("lst"),C1),v)),FunctionOfSinhQ(Times(Cosh(v),Part($s("lst"),C2)),v,x),CompoundExpression(Set($s("lst"),FindTrigFactor($s("Cosh"),$s("Sech"),u,v,False)),If(And(NotFalseQ($s("lst")),OddQuotientQ(Part($s("lst"),C1),v)),FunctionOfSinhQ(Times(Cosh(v),Part($s("lst"),C2)),v,x),CompoundExpression(Set($s("lst"),FindTrigFactor($s("Tanh"),$s("Coth"),u,v,True)),If(NotFalseQ($s("lst")),FunctionOfSinhQ(Times(Cosh(v),Part($s("lst"),C2)),v,x),Catch(CompoundExpression(Scan(Function(If(Not(FunctionOfSinhQ(Slot1,v,x)),Throw(False))),u),True)))))))))),Catch(CompoundExpression(Scan(Function(If(Not(FunctionOfSinhQ(Slot1,v,x)),Throw(False))),u),True)))))))),
SetDelayed(FunctionOfCoshQ($p(u),$p(v),$p(x)),
    If(AtomQ(u),UnsameQ(u,x),If(CalculusQ(u),False,If(And(HyperbolicQ(u),IntegerQuotientQ(Part(u,C1),v)),Or(CoshQ(u),SechQ(u)),If(And(And(IntegerPowerQ(u),HyperbolicQ(Part(u,C1))),IntegerQuotientQ(Part(u,C1,C1),v)),If(EvenQ(Part(u,C2)),True,FunctionOfCoshQ(Part(u,C1),v,x)),If(ProductQ(u),Module(List($s("lst")),CompoundExpression(Set($s("lst"),FindTrigFactor($s("Sinh"),$s("Csch"),u,v,False)),If(NotFalseQ($s("lst")),FunctionOfCoshQ(Times(Sinh(v),Part($s("lst"),C2)),v,x),CompoundExpression(Set($s("lst"),FindTrigFactor($s("Tanh"),$s("Coth"),u,v,True)),If(NotFalseQ($s("lst")),FunctionOfCoshQ(Times(Sinh(v),Part($s("lst"),C2)),v,x),Catch(CompoundExpression(Scan(Function(If(Not(FunctionOfCoshQ(Slot1,v,x)),Throw(False))),u),True))))))),Catch(CompoundExpression(Scan(Function(If(Not(FunctionOfCoshQ(Slot1,v,x)),Throw(False))),u),True)))))))),
SetDelayed(FunctionOfTanhQ($p(u),$p(v),$p(x)),
    If(AtomQ(u),UnsameQ(u,x),If(CalculusQ(u),False,If(And(HyperbolicQ(u),IntegerQuotientQ(Part(u,C1),v)),Or(Or(TanhQ(u),CothQ(u)),EvenQuotientQ(Part(u,C1),v)),If(And(And(And(PowerQ(u),EvenQ(Part(u,C2))),HyperbolicQ(Part(u,C1))),IntegerQuotientQ(Part(u,C1,C1),v)),True,If(ProductQ(u),Module(List(Set($s("lst"),ReapList(Scan(Function(If(Not(FunctionOfTanhQ(Slot1,v,x)),Sow(Slot1))),u)))),If(SameQ($s("lst"),List()),True,And(And(Equal(Length($s("lst")),C2),OddHyperbolicPowerQ(Part($s("lst"),C1),v,x)),OddHyperbolicPowerQ(Part($s("lst"),C2),v,x)))),Catch(CompoundExpression(Scan(Function(If(Not(FunctionOfTanhQ(Slot1,v,x)),Throw(False))),u),True)))))))),
SetDelayed(OddHyperbolicPowerQ($p(u),$p(v),$p(x)),
    If(Or(Or(Or(SinhQ(u),CoshQ(u)),SechQ(u)),CschQ(u)),OddQuotientQ(Part(u,C1),v),If(PowerQ(u),And(OddQ(Part(u,C2)),OddHyperbolicPowerQ(Part(u,C1),v,x)),If(ProductQ(u),Module(List(Set($s("lst"),ReapList(Scan(Function(If(Not(FunctionOfTanhQ(Slot1,v,x)),Sow(Slot1))),u)))),If(SameQ($s("lst"),List()),True,And(Equal(Length($s("lst")),C1),OddHyperbolicPowerQ(Part($s("lst"),C1),v,x)))),False)))),
SetDelayed(FunctionOfTanhWeight($p(u),$p(v),$p(x)),
    If(AtomQ(u),C0,If(CalculusQ(u),C0,If(And(HyperbolicQ(u),IntegerQuotientQ(Part(u,C1),v)),If(And(TanhQ(u),ZeroQ(Plus(Part(u,C1),Times(CN1,v)))),C1,If(And(CothQ(u),ZeroQ(Plus(Part(u,C1),Times(CN1,v)))),CN1,C0)),If(And(And(And(PowerQ(u),EvenQ(Part(u,C2))),HyperbolicQ(Part(u,C1))),IntegerQuotientQ(Part(u,C1,C1),v)),If(Or(Or(TanhQ(Part(u,C1)),CoshQ(Part(u,C1))),SechQ(Part(u,C1))),C1,CN1),If(ProductQ(u),If(Catch(CompoundExpression(Scan(Function(If(Not(FunctionOfTanhQ(Slot1,v,x)),Throw(False))),u),True)),Apply($s("Plus"),Map(Function(FunctionOfTanhWeight(Slot1,v,x)),Apply($s("List"),u))),C0),Apply($s("Plus"),Map(Function(FunctionOfTanhWeight(Slot1,v,x)),Apply($s("List"),u))))))))),
SetDelayed(FunctionOfHyperbolicQ($p(u),$p(v),$p(x,SymbolHead)),
    If(AtomQ(u),UnsameQ(u,x),If(CalculusQ(u),False,If(And(HyperbolicQ(u),IntegerQuotientQ(Part(u,C1),v)),True,Catch(CompoundExpression(Scan(Function(If(FunctionOfHyperbolicQ(Slot1,v,x),Null,Throw(False))),u),True)))))),
SetDelayed(IntegerQuotientQ($p(u),$p(v)),
    IntegerQ(Simplify(Times(u,Power(v,CN1))))),
SetDelayed(OddQuotientQ($p(u),$p(v)),
    OddQ(Simplify(Times(u,Power(v,CN1))))),
SetDelayed(EvenQuotientQ($p(u),$p(v)),
    EvenQ(Simplify(Times(u,Power(v,CN1))))),
SetDelayed(FunctionOfDensePolynomialsQ($p(u),$p(x,SymbolHead)),
    If(FreeQ(u,x),True,If(PolynomialQ(u,x),Greater(Length(Exponent(u,x,$s("List"))),C1),Catch(CompoundExpression(Scan(Function(If(FunctionOfDensePolynomialsQ(Slot1,x),Null,Throw(False))),u),True))))),
SetDelayed(FunctionOfLog($p(u),$p(x,SymbolHead)),
    Module(List(Set($s("lst"),FunctionOfLog(u,False,False,x))),If(Or(FalseQ($s("lst")),FalseQ(Part($s("lst"),C2))),False,$s("lst")))),
SetDelayed(FunctionOfLog($p(u),$p(v),$p(n),$p(x)),
    If(AtomQ(u),If(SameQ(u,x),False,List(u,v,n)),If(CalculusQ(u),False,Module(List($s("lst")),If(And(And(LogQ(u),NotFalseQ(Set($s("lst"),BinomialTest(Part(u,C1),x)))),ZeroQ(Part($s("lst"),C1))),If(Or(FalseQ(v),SameQ(Part(u,C1),v)),List(x,Part(u,C1),Part($s("lst"),C3)),False),CompoundExpression(Set($s("lst"),List(C0,v,n)),Catch(List(Map(Function(CompoundExpression(Set($s("lst"),FunctionOfLog(Slot1,Part($s("lst"),C2),Part($s("lst"),C3),x)),If(FalseQ($s("lst")),Throw(False),Part($s("lst"),C1)))),u),Part($s("lst"),C2),Part($s("lst"),C3))))))))),
SetDelayed(PowerVariableExpn($p(u),$p(m),$p(x,SymbolHead)),
    If(IntegerQ(m),Module(List(Set($s("lst"),PowerVariableDegree(u,m,C1,x))),If(FalseQ($s("lst")),False,List(Times(Power(x,Times(m,Power(Part($s("lst"),C1),CN1))),PowerVariableSubst(u,Part($s("lst"),C1),x)),Part($s("lst"),C1),Part($s("lst"),C2)))),False)),
SetDelayed(PowerVariableDegree($p(u),$p(m),$p(c),$p(x,SymbolHead)),
    If(FreeQ(u,x),List(m,c),If(Or(AtomQ(u),CalculusQ(u)),False,If(And(PowerQ(u),FreeQ(Times(Part(u,C1),Power(x,CN1)),x)),If(Or(ZeroQ(m),And(SameQ(m,Part(u,C2)),SameQ(c,Times(Part(u,C1),Power(x,CN1))))),List(Part(u,C2),Times(Part(u,C1),Power(x,CN1))),If(And(And(And(IntegerQ(Part(u,C2)),IntegerQ(m)),Greater(GCD(m,Part(u,C2)),C1)),SameQ(c,Times(Part(u,C1),Power(x,CN1)))),List(GCD(m,Part(u,C2)),c),False)),Catch(Module(List(Set($s("lst"),List(m,c))),CompoundExpression(Scan(Function(CompoundExpression(Set($s("lst"),PowerVariableDegree(Slot1,Part($s("lst"),C1),Part($s("lst"),C2),x)),If(FalseQ($s("lst")),Throw(False)))),u),$s("lst")))))))),
SetDelayed(PowerVariableSubst($p(u),$p(m),$p(x,SymbolHead)),
    If(Or(Or(FreeQ(u,x),AtomQ(u)),CalculusQ(u)),u,If(And(PowerQ(u),FreeQ(Times(Part(u,C1),Power(x,CN1)),x)),Power(x,Times(Part(u,C2),Power(m,CN1))),Map(Function(PowerVariableSubst(Slot1,m,x)),u)))),
SetDelayed(EulerIntegrandQ(Power(Plus(Times(Power($p(u),$p(n)),$p(b,true)),Times($p(a,true),$p(x))),$p(p)),$p(x,SymbolHead)),
    Condition(True,And(And(And(FreeQ(List(a,b),x),IntegerQ(Plus(n,C1D2))),QuadraticQ(u,x)),Or(Not(RationalQ(p)),And(NegativeIntegerQ(p),Not(BinomialQ(u,x))))))),
SetDelayed(EulerIntegrandQ(Times(Power(Plus(Times(Power($p(u),$p(n)),$p(b,true)),Times($p(a,true),$p(x))),$p(p)),Power($p(v),$p(m,true))),$p(x,SymbolHead)),
    Condition(True,And(And(And(And(FreeQ(List(a,b),x),ZeroQ(Plus(u,Times(CN1,v)))),IntegersQ(Times(C2,m),Plus(n,C1D2))),QuadraticQ(u,x)),Or(Not(RationalQ(p)),And(NegativeIntegerQ(p),Not(BinomialQ(u,x))))))),
SetDelayed(EulerIntegrandQ(Times(Power(Plus(Times(Power($p(u),$p(n)),$p(b,true)),Times($p(a,true),$p(x))),$p(p)),Power($p(v),$p(m,true))),$p(x,SymbolHead)),
    Condition(True,And(And(And(And(FreeQ(List(a,b),x),ZeroQ(Plus(u,Times(CN1,v)))),IntegersQ(Times(C2,m),Plus(n,C1D2))),QuadraticQ(u,x)),Or(Not(RationalQ(p)),And(NegativeIntegerQ(p),Not(BinomialQ(u,x))))))),
SetDelayed(EulerIntegrandQ(Times(Power($p(u),$p(n)),Power($p(v),$p(p))),$p(x,SymbolHead)),
    Condition(True,And(And(And(And(NegativeIntegerQ(p),IntegerQ(Plus(n,C1D2))),QuadraticQ(u,x)),QuadraticQ(v,x)),Not(BinomialQ(v,x))))),
SetDelayed(EulerIntegrandQ($p(u),$p(x,SymbolHead)),
    False),
SetDelayed(FunctionOfSquareRootOfQuadratic($p(u),$p(x,SymbolHead)),
    If(MatchQ(u,Condition(Times(Power(x,$p(m,true)),Power(Plus($p(a),Times($p(b,true),Power(x,$p(n,true)))),$p(p))),FreeQ(List(a,b,m,n,p),x))),False,Module(List(Set($s("tmp"),FunctionOfSquareRootOfQuadratic(u,False,x))),If(Or(FalseQ($s("tmp")),FalseQ(Part($s("tmp"),C1))),False,CompoundExpression(Set($s("tmp"),Part($s("tmp"),C1)),Module(List(Set(a,Coefficient($s("tmp"),x,C0)),Set(b,Coefficient($s("tmp"),x,C1)),Set(c,Coefficient($s("tmp"),x,C2)),$s("sqrt"),q,r),If(Or(And(ZeroQ(a),ZeroQ(b)),ZeroQ(Plus(Power(b,C2),Times(CN1,C4,a,c)))),False,If(PosQ(c),CompoundExpression(CompoundExpression(CompoundExpression(Set($s("sqrt"),Rt(c,C2)),Set(q,Plus(Times(a,$s("sqrt")),Times(b,x),Times($s("sqrt"),Power(x,C2))))),Set(r,Plus(b,Times(C2,$s("sqrt"),x)))),List(Simplify(Times(SquareRootOfQuadraticSubst(u,Times(q,Power(r,CN1)),Times(Plus(Times(CN1,a),Power(x,C2)),Power(r,CN1)),x),q,Power(Power(r,C2),CN1))),Simplify(Plus(Times($s("sqrt"),x),Sqrt($s("tmp")))),C2)),If(PosQ(a),CompoundExpression(CompoundExpression(CompoundExpression(Set($s("sqrt"),Rt(a,C2)),Set(q,Plus(Times(c,$s("sqrt")),Times(CN1,b,x),Times($s("sqrt"),Power(x,C2))))),Set(r,Plus(c,Times(CN1,Power(x,C2))))),List(Simplify(Times(SquareRootOfQuadraticSubst(u,Times(q,Power(r,CN1)),Times(Plus(Times(CN1,b),Times(C2,$s("sqrt"),x)),Power(r,CN1)),x),q,Power(Power(r,C2),CN1))),Simplify(Times(Plus(Times(CN1,$s("sqrt")),Sqrt($s("tmp"))),Power(x,CN1))),C1)),CompoundExpression(CompoundExpression(Set($s("sqrt"),Rt(Plus(Power(b,C2),Times(CN1,C4,a,c)),C2)),Set(r,Plus(c,Times(CN1,Power(x,C2))))),List(Simplify(Times(CN1,$s("sqrt"),SquareRootOfQuadraticSubst(u,Times(CN1,$s("sqrt"),x,Power(r,CN1)),Times(CN1,Plus(Times(b,c),Times(c,$s("sqrt")),Times(Plus(Times(CN1,b),$s("sqrt")),Power(x,C2))),Power(Times(C2,c,r),CN1)),x),x,Power(Power(r,C2),CN1))),FullSimplify(Times(C2,c,Sqrt($s("tmp")),Power(Plus(b,Times(CN1,$s("sqrt")),Times(C2,c,x)),CN1))),C3))))))))))),
SetDelayed(FunctionOfSquareRootOfQuadratic($p(u),$p(v),$p(x,SymbolHead)),
    If(Or(AtomQ(u),FreeQ(u,x)),List(v),If(And(PowerQ(u),FreeQ(Part(u,C2),x)),If(And(And(And(FractionQ(Part(u,C2)),Equal(Denominator(Part(u,C2)),C2)),PolynomialQ(Part(u,C1),x)),Equal(Exponent(Part(u,C1),x),C2)),If(Or(FalseQ(v),SameQ(Part(u,C1),v)),List(Part(u,C1)),False),FunctionOfSquareRootOfQuadratic(Part(u,C1),v,x)),If(Or(ProductQ(u),SumQ(u)),Catch(Module(List(Set($s("lst"),List(v))),CompoundExpression(Scan(Function(CompoundExpression(Set($s("lst"),FunctionOfSquareRootOfQuadratic(Slot1,Part($s("lst"),C1),x)),If(FalseQ($s("lst")),Throw(False)))),u),$s("lst")))),False)))),
SetDelayed(SquareRootOfQuadraticSubst($p(u),$p("vv"),$p("xx"),$p(x,SymbolHead)),
    If(Or(AtomQ(u),FreeQ(u,x)),If(SameQ(u,x),$s("xx"),u),If(And(PowerQ(u),FreeQ(Part(u,C2),x)),If(And(And(And(FractionQ(Part(u,C2)),Equal(Denominator(Part(u,C2)),C2)),PolynomialQ(Part(u,C1),x)),Equal(Exponent(Part(u,C1),x),C2)),Power($s("vv"),Numerator(Part(u,C2))),Power(SquareRootOfQuadraticSubst(Part(u,C1),$s("vv"),$s("xx"),x),Part(u,C2))),Map(Function(SquareRootOfQuadraticSubst(Slot1,$s("vv"),$s("xx"),x)),u)))),
SetDelayed(Subst($p(u),$p(x,SymbolHead),$p(w)),
    SimplifyAntiderivative(SubstAux(u,x,w),x)),
SetDelayed(Subst($p(u),$p(x),$p(w)),
    SubstAux(u,x,w)),
SetDelayed(SubstAux($p(u),$p(v),$p(w)),
    If(SameQ(u,v),w,If(AtomQ(u),u,If(PowerQ(u),If(And(And(PowerQ(v),SameQ(Part(u,C1),Part(v,C1))),SumQ(Part(u,C2))),Times(SubstAux(Power(Part(u,C1),First(Part(u,C2))),v,w),SubstAux(Power(Part(u,C1),Rest(Part(u,C2))),v,w)),Power(SubstAux(Part(u,C1),v,w),SubstAux(Part(u,C2),v,w))),If(SameQ(Head(u),Defer($s("Integrate::Subst"))),If(Or(SameQ(Part(u,C2),v),FreeQ(Part(u,C1),v)),SubstAux(Part(u,C1),Part(u,C2),SubstAux(Part(u,C3),v,w)),$(Defer($s("Integrate::Subst")),u,v,w)),If(SameQ(Head(u),Defer($s("Integrate::Dist"))),$(Defer($s("Integrate::Dist")),SubstAux(Part(u,C1),v,w),SubstAux(Part(u,C2),v,w),Part(u,C3)),If(Or(And(CalculusQ(u),Not(FreeQ(v,Part(u,C2)))),And(HeldFormQ(u),UnsameQ(Head(u),Defer($s("AppellF1"))))),$(Defer($s("Integrate::Subst")),u,v,w),Map(Function(SubstAux(Slot1,v,w)),u)))))))),
SetDelayed(SimplifyAntiderivative(Times($p(c),$p(u)),$p(x,SymbolHead)),
    Condition(Times(c,SimplifyAntiderivative(u,x)),FreeQ(c,x))),
SetDelayed(SimplifyAntiderivative(Log(Times($p(c),$p(u))),$p(x,SymbolHead)),
    Condition(SimplifyAntiderivative(Log(u),x),FreeQ(c,x))),
SetDelayed(SimplifyAntiderivative(Log(Power($p(u),$p(n))),$p(x,SymbolHead)),
    Condition(Times(n,SimplifyAntiderivative(Log(u),x)),FreeQ(n,x))),
SetDelayed(SimplifyAntiderivative(Log(Power($p(f),$p(u))),$p(x,SymbolHead)),
    Condition(Times(Log(f),SimplifyAntiderivative(u,x)),FreeQ(f,x))),
SetDelayed(SimplifyAntiderivative(ArcTan(Tan($p(u))),$p(x,SymbolHead)),
    SimplifyAntiderivative(u,x)),
SetDelayed(SimplifyAntiderivative(ArcTan(Cot($p(u))),$p(x,SymbolHead)),
    Times(CN1,SimplifyAntiderivative(u,x))),
SetDelayed(SimplifyAntiderivative(ArcTan(Times(Complex(C0,$p(n)),Tanh($p(u)))),$p(x,SymbolHead)),
    Condition(Times(Complex(C0,n),SimplifyAntiderivative(u,x)),OneQ(Power(n,C2)))),
SetDelayed(SimplifyAntiderivative(ArcTan(Times(Complex(C0,$p(n)),Coth($p(u)))),$p(x,SymbolHead)),
    Condition(Times(Complex(C0,n),SimplifyAntiderivative(u,x)),OneQ(Power(n,C2)))),
SetDelayed(SimplifyAntiderivative(ArcCot(Tan($p(u))),$p(x,SymbolHead)),
    Times(CN1,SimplifyAntiderivative(u,x))),
SetDelayed(SimplifyAntiderivative(ArcCot(Cot($p(u))),$p(x,SymbolHead)),
    SimplifyAntiderivative(u,x)),
SetDelayed(SimplifyAntiderivative(ArcCot(Times(Complex(C0,$p(n)),Tanh($p(u)))),$p(x,SymbolHead)),
    Condition(Times(CN1,Complex(C0,n),SimplifyAntiderivative(u,x)),OneQ(Power(n,C2)))),
SetDelayed(SimplifyAntiderivative(ArcCot(Times(Complex(C0,$p(n)),Coth($p(u)))),$p(x,SymbolHead)),
    Condition(Times(CN1,Complex(C0,n),SimplifyAntiderivative(u,x)),OneQ(Power(n,C2)))),
SetDelayed(SimplifyAntiderivative(ArcTanh(Tanh($p(u))),$p(x,SymbolHead)),
    SimplifyAntiderivative(u,x)),
SetDelayed(SimplifyAntiderivative(ArcTanh(Coth($p(u))),$p(x,SymbolHead)),
    SimplifyAntiderivative(u,x)),
SetDelayed(SimplifyAntiderivative(ArcCoth(Tanh($p(u))),$p(x,SymbolHead)),
    SimplifyAntiderivative(u,x)),
SetDelayed(SimplifyAntiderivative(ArcCoth(Coth($p(u))),$p(x,SymbolHead)),
    SimplifyAntiderivative(u,x)),
SetDelayed(SimplifyAntiderivative($p(u),$p(x,SymbolHead)),
    If(FreeQ(u,x),C0,If(LogQ(u),Log(RemoveContent(Part(u,C1),x)),If(SumQ(u),Map(Function(SimplifyAntiderivative(Slot1,x)),u),u)))),
SetDelayed(SubstFor($p(w),$p(v),$p(u),$p(x)),
    SimplifyIntegrand(Times(w,SubstFor(v,u,x)),x)),
SetDelayed(SubstFor($p(v),$p(u),$p(x)),
    If(AtomQ(v),Subst(u,v,x),If(Not(InertTrigFreeQ(u)),SubstFor(v,ActivateTrig(u),x),If(And(PowerQ(v),FreeQ(Part(v,C2),x)),SubstForPower(u,Part(v,C1),Part(v,C2),x),If(Not(OneQ(FreeFactors(v,x))),SubstFor(NonfreeFactors(v,x),u,Times(x,Power(FreeFactors(v,x),CN1))),If(SinQ(v),SubstForTrig(u,x,Sqrt(Plus(C1,Times(CN1,Power(x,C2)))),Part(v,C1),x),If(CosQ(v),SubstForTrig(u,Sqrt(Plus(C1,Times(CN1,Power(x,C2)))),x,Part(v,C1),x),If(TanQ(v),SubstForTrig(u,Times(x,Power(Sqrt(Plus(C1,Power(x,C2))),CN1)),Power(Sqrt(Plus(C1,Power(x,C2))),CN1),Part(v,C1),x),If(CotQ(v),SubstForTrig(u,Power(Sqrt(Plus(C1,Power(x,C2))),CN1),Times(x,Power(Sqrt(Plus(C1,Power(x,C2))),CN1)),Part(v,C1),x),If(SecQ(v),SubstForTrig(u,Power(Sqrt(Plus(C1,Times(CN1,Power(x,C2)))),CN1),Power(x,CN1),Part(v,C1),x),If(CscQ(v),SubstForTrig(u,Power(x,CN1),Power(Sqrt(Plus(C1,Times(CN1,Power(x,C2)))),CN1),Part(v,C1),x),If(SinhQ(v),SubstForHyperbolic(u,x,Sqrt(Plus(C1,Power(x,C2))),Part(v,C1),x),If(CoshQ(v),SubstForHyperbolic(u,Sqrt(Plus(CN1,Power(x,C2))),x,Part(v,C1),x),If(TanhQ(v),SubstForHyperbolic(u,Times(x,Power(Sqrt(Plus(C1,Times(CN1,Power(x,C2)))),CN1)),Power(Sqrt(Plus(C1,Times(CN1,Power(x,C2)))),CN1),Part(v,C1),x),If(CothQ(v),SubstForHyperbolic(u,Power(Sqrt(Plus(CN1,Power(x,C2))),CN1),Times(x,Power(Sqrt(Plus(CN1,Power(x,C2))),CN1)),Part(v,C1),x),If(SechQ(v),SubstForHyperbolic(u,Power(Sqrt(Plus(CN1,Power(x,C2))),CN1),Power(x,CN1),Part(v,C1),x),If(CschQ(v),SubstForHyperbolic(u,Power(x,CN1),Power(Sqrt(Plus(C1,Power(x,C2))),CN1),Part(v,C1),x),SubstForExpn(u,v,x)))))))))))))))))),
SetDelayed(SubstForExpn($p(u),$p(v),$p(w)),
    If(SameQ(u,v),w,If(AtomQ(u),u,Map(Function(SubstForExpn(Slot1,v,w)),u)))),
SetDelayed(SubstForPower($p(u),$p("bas"),$p("deg"),$p(x)),
    If(AtomQ(u),u,If(And(And(And(PowerQ(u),ZeroQ(Plus(Part(u,C1),Times(CN1,$s("bas"))))),FreeQ(Part(u,C2),x)),IntegerQ(Simplify(Times(Part(u,C2),Power($s("deg"),CN1))))),Power(x,Times(Part(u,C2),Power($s("deg"),CN1))),Map(Function(SubstForPower(Slot1,$s("bas"),$s("deg"),x)),u)))),
SetDelayed(SubstForTrig($p(u),$p("sin"),$p("cos"),$p(v),$p(x)),
    If(AtomQ(u),u,If(And(TrigQ(u),IntegerQuotientQ(Part(u,C1),v)),If(Or(SameQ(Part(u,C1),v),ZeroQ(Plus(Part(u,C1),Times(CN1,v)))),If(SinQ(u),$s("§sin"),If(CosQ(u),$s("§cos"),If(TanQ(u),Times($s("§sin"),Power($s("§cos"),CN1)),If(CotQ(u),Times($s("§cos"),Power($s("§sin"),CN1)),If(SecQ(u),Power($s("§cos"),CN1),Power($s("§sin"),CN1)))))),Map(Function(SubstForTrig(Slot1,$s("§sin"),$s("§cos"),v,x)),ReplaceAll(TrigExpand($(Head(u),Times(Simplify(Times(Part(u,C1),Power(v,CN1))),x))),Rule(x,v)))),If(And(And(And(And(ProductQ(u),CosQ(Part(u,C1))),SinQ(Part(u,C2))),ZeroQ(Plus(Part(u,C1,C1),Times(CN1,C1D2,v)))),ZeroQ(Plus(Part(u,C2,C1),Times(CN1,C1D2,v)))),Times(C1D2,$s("§sin"),SubstForTrig(Drop(u,C2),$s("§sin"),$s("§cos"),v,x)),Map(Function(SubstForTrig(Slot1,$s("§sin"),$s("§cos"),v,x)),u))))),
SetDelayed(SubstForHyperbolic($p(u),$p("sinh"),$p("cosh"),$p(v),$p(x)),
    If(AtomQ(u),u,If(And(HyperbolicQ(u),IntegerQuotientQ(Part(u,C1),v)),If(Or(SameQ(Part(u,C1),v),ZeroQ(Plus(Part(u,C1),Times(CN1,v)))),If(SinhQ(u),$s("sinh"),If(CoshQ(u),$s("cosh"),If(TanhQ(u),Times($s("sinh"),Power($s("cosh"),CN1)),If(CothQ(u),Times($s("cosh"),Power($s("sinh"),CN1)),If(SechQ(u),Power($s("cosh"),CN1),Power($s("sinh"),CN1)))))),Map(Function(SubstForHyperbolic(Slot1,$s("sinh"),$s("cosh"),v,x)),ReplaceAll(TrigExpand($(Head(u),Times(Simplify(Times(Part(u,C1),Power(v,CN1))),x))),Rule(x,v)))),If(And(And(And(And(ProductQ(u),CoshQ(Part(u,C1))),SinhQ(Part(u,C2))),ZeroQ(Plus(Part(u,C1,C1),Times(CN1,C1D2,v)))),ZeroQ(Plus(Part(u,C2,C1),Times(CN1,C1D2,v)))),Times(C1D2,$s("sinh"),SubstForHyperbolic(Drop(u,C2),$s("sinh"),$s("cosh"),v,x)),Map(Function(SubstForHyperbolic(Slot1,$s("sinh"),$s("cosh"),v,x)),u))))),
SetDelayed(SubstForFractionalPowerOfLinear($p(u),$p(x,SymbolHead)),
    Module(List(Set($s("lst"),FractionalPowerOfLinear(u,C1,False,x)),n,a,b,$s("tmp")),If(Or(FalseQ($s("lst")),FalseQ(Part($s("lst"),C2))),False,CompoundExpression(CompoundExpression(CompoundExpression(CompoundExpression(CompoundExpression(Set(n,Part($s("lst"),C1)),Set(a,Coefficient(Part($s("lst"),C2),x,C0))),Set(b,Coefficient(Part($s("lst"),C2),x,C1))),Set($s("tmp"),Times(Power(x,Plus(n,Times(CN1,C1))),SubstForFractionalPower(u,Part($s("lst"),C2),n,Plus(Times(CN1,a,Power(b,CN1)),Times(Power(x,n),Power(b,CN1))),x)))),Set($s("tmp"),SplitFreeFactors(Simplify($s("tmp")),x))),List(Part($s("tmp"),C2),n,Part($s("lst"),C2),Times(Part($s("tmp"),C1),Power(b,CN1)))))))
  );
}

 

Ads help maintain this website.