m2m模型翻译
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

464 lines
23 KiB

6 months ago
  1. """
  2. This code is automatically generated. Never edit it manually.
  3. For details of generating the code see `rubi_parsing_guide.md` in `parsetools`.
  4. """
  5. from sympy.external import import_module
  6. matchpy = import_module("matchpy")
  7. if matchpy:
  8. from matchpy import Pattern, ReplacementRule, CustomConstraint, is_match
  9. from sympy.integrals.rubi.utility_function import (
  10. Int, Sum, Set, With, Module, Scan, MapAnd, FalseQ,
  11. ZeroQ, NegativeQ, NonzeroQ, FreeQ, NFreeQ, List, Log, PositiveQ,
  12. PositiveIntegerQ, NegativeIntegerQ, IntegerQ, IntegersQ,
  13. ComplexNumberQ, PureComplexNumberQ, RealNumericQ, PositiveOrZeroQ,
  14. NegativeOrZeroQ, FractionOrNegativeQ, NegQ, Equal, Unequal, IntPart,
  15. FracPart, RationalQ, ProductQ, SumQ, NonsumQ, Subst, First, Rest,
  16. SqrtNumberQ, SqrtNumberSumQ, LinearQ, Sqrt, ArcCosh, Coefficient,
  17. Denominator, Hypergeometric2F1, Not, Simplify, FractionalPart,
  18. IntegerPart, AppellF1, EllipticPi, EllipticE, EllipticF, ArcTan,
  19. ArcCot, ArcCoth, ArcTanh, ArcSin, ArcSinh, ArcCos, ArcCsc, ArcSec,
  20. ArcCsch, ArcSech, Sinh, Tanh, Cosh, Sech, Csch, Coth, LessEqual, Less,
  21. Greater, GreaterEqual, FractionQ, IntLinearcQ, Expand, IndependentQ,
  22. PowerQ, IntegerPowerQ, PositiveIntegerPowerQ, FractionalPowerQ, AtomQ,
  23. ExpQ, LogQ, Head, MemberQ, TrigQ, SinQ, CosQ, TanQ, CotQ, SecQ, CscQ,
  24. Sin, Cos, Tan, Cot, Sec, Csc, HyperbolicQ, SinhQ, CoshQ, TanhQ, CothQ,
  25. SechQ, CschQ, InverseTrigQ, SinCosQ, SinhCoshQ, LeafCount, Numerator,
  26. NumberQ, NumericQ, Length, ListQ, Im, Re, InverseHyperbolicQ,
  27. InverseFunctionQ, TrigHyperbolicFreeQ, InverseFunctionFreeQ, RealQ,
  28. EqQ, FractionalPowerFreeQ, ComplexFreeQ, PolynomialQ, FactorSquareFree,
  29. PowerOfLinearQ, Exponent, QuadraticQ, LinearPairQ, BinomialParts,
  30. TrinomialParts, PolyQ, EvenQ, OddQ, PerfectSquareQ, NiceSqrtAuxQ,
  31. NiceSqrtQ, Together, PosAux, PosQ, CoefficientList, ReplaceAll,
  32. ExpandLinearProduct, GCD, ContentFactor, NumericFactor,
  33. NonnumericFactors, MakeAssocList, GensymSubst, KernelSubst,
  34. ExpandExpression, Apart, SmartApart, MatchQ,
  35. PolynomialQuotientRemainder, FreeFactors, NonfreeFactors,
  36. RemoveContentAux, RemoveContent, FreeTerms, NonfreeTerms,
  37. ExpandAlgebraicFunction, CollectReciprocals, ExpandCleanup,
  38. AlgebraicFunctionQ, Coeff, LeadTerm, RemainingTerms, LeadFactor,
  39. RemainingFactors, LeadBase, LeadDegree, Numer, Denom, hypergeom, Expon,
  40. MergeMonomials, PolynomialDivide, BinomialQ, TrinomialQ,
  41. GeneralizedBinomialQ, GeneralizedTrinomialQ, FactorSquareFreeList,
  42. PerfectPowerTest, SquareFreeFactorTest, RationalFunctionQ,
  43. RationalFunctionFactors, NonrationalFunctionFactors, Reverse,
  44. RationalFunctionExponents, RationalFunctionExpand, ExpandIntegrand,
  45. SimplerQ, SimplerSqrtQ, SumSimplerQ, BinomialDegree, TrinomialDegree,
  46. CancelCommonFactors, SimplerIntegrandQ, GeneralizedBinomialDegree,
  47. GeneralizedBinomialParts, GeneralizedTrinomialDegree,
  48. GeneralizedTrinomialParts, MonomialQ, MonomialSumQ,
  49. MinimumMonomialExponent, MonomialExponent, LinearMatchQ,
  50. PowerOfLinearMatchQ, QuadraticMatchQ, CubicMatchQ, BinomialMatchQ,
  51. TrinomialMatchQ, GeneralizedBinomialMatchQ, GeneralizedTrinomialMatchQ,
  52. QuotientOfLinearsMatchQ, PolynomialTermQ, PolynomialTerms,
  53. NonpolynomialTerms, PseudoBinomialParts, NormalizePseudoBinomial,
  54. PseudoBinomialPairQ, PseudoBinomialQ, PolynomialGCD, PolyGCD,
  55. AlgebraicFunctionFactors, NonalgebraicFunctionFactors,
  56. QuotientOfLinearsP, QuotientOfLinearsParts, QuotientOfLinearsQ,
  57. Flatten, Sort, AbsurdNumberQ, AbsurdNumberFactors,
  58. NonabsurdNumberFactors, SumSimplerAuxQ, Prepend, Drop,
  59. CombineExponents, FactorInteger, FactorAbsurdNumber,
  60. SubstForInverseFunction, SubstForFractionalPower,
  61. SubstForFractionalPowerOfQuotientOfLinears,
  62. FractionalPowerOfQuotientOfLinears, SubstForFractionalPowerQ,
  63. SubstForFractionalPowerAuxQ, FractionalPowerOfSquareQ,
  64. FractionalPowerSubexpressionQ, Apply, FactorNumericGcd,
  65. MergeableFactorQ, MergeFactor, MergeFactors, TrigSimplifyQ,
  66. TrigSimplify, TrigSimplifyRecur, Order, FactorOrder, Smallest,
  67. OrderedQ, MinimumDegree, PositiveFactors, Sign, NonpositiveFactors,
  68. PolynomialInAuxQ, PolynomialInQ, ExponentInAux, ExponentIn,
  69. PolynomialInSubstAux, PolynomialInSubst, Distrib, DistributeDegree,
  70. FunctionOfPower, DivideDegreesOfFactors, MonomialFactor, FullSimplify,
  71. FunctionOfLinearSubst, FunctionOfLinear, NormalizeIntegrand,
  72. NormalizeIntegrandAux, NormalizeIntegrandFactor,
  73. NormalizeIntegrandFactorBase, NormalizeTogether,
  74. NormalizeLeadTermSigns, AbsorbMinusSign, NormalizeSumFactors,
  75. SignOfFactor, NormalizePowerOfLinear, SimplifyIntegrand, SimplifyTerm,
  76. TogetherSimplify, SmartSimplify, SubstForExpn, ExpandToSum, UnifySum,
  77. UnifyTerms, UnifyTerm, CalculusQ, FunctionOfInverseLinear,
  78. PureFunctionOfSinhQ, PureFunctionOfTanhQ, PureFunctionOfCoshQ,
  79. IntegerQuotientQ, OddQuotientQ, EvenQuotientQ, FindTrigFactor,
  80. FunctionOfSinhQ, FunctionOfCoshQ, OddHyperbolicPowerQ, FunctionOfTanhQ,
  81. FunctionOfTanhWeight, FunctionOfHyperbolicQ, SmartNumerator,
  82. SmartDenominator, SubstForAux, ActivateTrig, ExpandTrig, TrigExpand,
  83. SubstForTrig, SubstForHyperbolic, InertTrigFreeQ, LCM,
  84. SubstForFractionalPowerOfLinear, FractionalPowerOfLinear,
  85. InverseFunctionOfLinear, InertTrigQ, InertReciprocalQ, DeactivateTrig,
  86. FixInertTrigFunction, DeactivateTrigAux, PowerOfInertTrigSumQ,
  87. PiecewiseLinearQ, KnownTrigIntegrandQ, KnownSineIntegrandQ,
  88. KnownTangentIntegrandQ, KnownCotangentIntegrandQ,
  89. KnownSecantIntegrandQ, TryPureTanSubst, TryTanhSubst, TryPureTanhSubst,
  90. AbsurdNumberGCD, AbsurdNumberGCDList, ExpandTrigExpand,
  91. ExpandTrigReduce, ExpandTrigReduceAux, NormalizeTrig, TrigToExp,
  92. ExpandTrigToExp, TrigReduce, FunctionOfTrig, AlgebraicTrigFunctionQ,
  93. FunctionOfHyperbolic, FunctionOfQ, FunctionOfExpnQ, PureFunctionOfSinQ,
  94. PureFunctionOfCosQ, PureFunctionOfTanQ, PureFunctionOfCotQ,
  95. FunctionOfCosQ, FunctionOfSinQ, OddTrigPowerQ, FunctionOfTanQ,
  96. FunctionOfTanWeight, FunctionOfTrigQ, FunctionOfDensePolynomialsQ,
  97. FunctionOfLog, PowerVariableExpn, PowerVariableDegree,
  98. PowerVariableSubst, EulerIntegrandQ, FunctionOfSquareRootOfQuadratic,
  99. SquareRootOfQuadraticSubst, Divides, EasyDQ, ProductOfLinearPowersQ,
  100. Rt, NthRoot, AtomBaseQ, SumBaseQ, NegSumBaseQ, AllNegTermQ,
  101. SomeNegTermQ, TrigSquareQ, RtAux, TrigSquare, IntSum, IntTerm, Map2,
  102. ConstantFactor, SameQ, ReplacePart, CommonFactors,
  103. MostMainFactorPosition, FunctionOfExponentialQ, FunctionOfExponential,
  104. FunctionOfExponentialFunction, FunctionOfExponentialFunctionAux,
  105. FunctionOfExponentialTest, FunctionOfExponentialTestAux, stdev,
  106. rubi_test, If, IntQuadraticQ, IntBinomialQ, RectifyTangent,
  107. RectifyCotangent, Inequality, Condition, Simp, SimpHelp, SplitProduct,
  108. SplitSum, SubstFor, SubstForAux, FresnelS, FresnelC, Erfc, Erfi, Gamma,
  109. FunctionOfTrigOfLinearQ, ElementaryFunctionQ, Complex, UnsameQ,
  110. _SimpFixFactor, SimpFixFactor, _FixSimplify, FixSimplify,
  111. _SimplifyAntiderivativeSum, SimplifyAntiderivativeSum,
  112. _SimplifyAntiderivative, SimplifyAntiderivative, _TrigSimplifyAux,
  113. TrigSimplifyAux, Cancel, Part, PolyLog, D, Dist, Sum_doit, PolynomialQuotient, Floor,
  114. PolynomialRemainder, Factor, PolyLog, CosIntegral, SinIntegral, LogIntegral, SinhIntegral,
  115. CoshIntegral, Rule, Erf, PolyGamma, ExpIntegralEi, ExpIntegralE, LogGamma , UtilityOperator, Factorial,
  116. Zeta, ProductLog, DerivativeDivides, HypergeometricPFQ, IntHide, OneQ, Null, rubi_exp as exp, rubi_log as log, Discriminant,
  117. Negative, Quotient
  118. )
  119. from sympy.core.add import Add
  120. from sympy.core.mod import Mod
  121. from sympy.core.mul import Mul
  122. from sympy.core import EulerGamma
  123. from sympy.core.numbers import (Float, I, Integer)
  124. from sympy.core.power import Pow
  125. from sympy.core.singleton import S
  126. from sympy.functions.elementary.complexes import (Abs, sign)
  127. from sympy.functions.elementary.miscellaneous import sqrt
  128. from sympy.integrals.integrals import Integral
  129. from sympy.logic.boolalg import (And, Or)
  130. from sympy.simplify.simplify import simplify
  131. from sympy.integrals.rubi.symbol import WC
  132. from sympy.core.symbol import symbols, Symbol
  133. from sympy.functions import (sin, cos, tan, cot, csc, sec, sqrt, erf)
  134. from sympy.functions.elementary.hyperbolic import (acosh, asinh, atanh, acoth, acsch, asech, cosh, sinh, tanh, coth, sech, csch)
  135. from sympy.functions.elementary.trigonometric import (atan, acsc, asin, acot, acos, asec, atan2)
  136. from sympy.core.numbers import pi as Pi
  137. A_, B_, C_, F_, G_, H_, a_, b_, c_, d_, e_, f_, g_, h_, i_, j_, k_, l_, m_, n_, p_, q_, r_, t_, u_, v_, s_, w_, x_, y_, z_ = [WC(i) for i in 'ABCFGHabcdefghijklmnpqrtuvswxyz']
  138. a1_, a2_, b1_, b2_, c1_, c2_, d1_, d2_, n1_, n2_, e1_, e2_, f1_, f2_, g1_, g2_, n1_, n2_, n3_, Pq_, Pm_, Px_, Qm_, Qr_, Qx_, jn_, mn_, non2_, RFx_, RGx_ = [WC(i) for i in ['a1', 'a2', 'b1', 'b2', 'c1', 'c2', 'd1', 'd2', 'n1', 'n2', 'e1', 'e2', 'f1', 'f2', 'g1', 'g2', 'n1', 'n2', 'n3', 'Pq', 'Pm', 'Px', 'Qm', 'Qr', 'Qx', 'jn', 'mn', 'non2', 'RFx', 'RGx']]
  139. i, ii, Pqq, Q, R, r, C, k, u = symbols('i ii Pqq Q R r C k u')
  140. _UseGamma = False
  141. ShowSteps = False
  142. StepCounter = None
  143. def integrand_simplification():
  144. from sympy.integrals.rubi.constraints import cons1, cons2, cons3, cons4, cons5, cons6, cons7, cons8, cons9, cons10, cons11, cons12, cons13, cons14, cons15, cons16, cons17, cons18, cons19, cons20, cons21, cons22, cons23, cons24, cons25, cons26, cons27, cons28, cons29, cons30, cons31, cons32, cons33, cons34, cons35, cons36, cons37, cons38, cons39, cons40, cons41, cons42, cons43, cons44, cons45, cons46, cons47, cons48, cons49, cons50, cons51, cons52, cons53, cons54, cons55, cons56, cons57, cons58, cons59, cons60, cons61, cons62, cons63, cons64, cons65, cons66, cons67
  145. pattern1 = Pattern(Integral((a_ + x_**WC('n', S(1))*WC('b', S(1)))**WC('p', S(1))*WC('u', S(1)), x_), cons2, cons3, cons4, cons5, cons1)
  146. rule1 = ReplacementRule(pattern1, replacement1)
  147. pattern2 = Pattern(Integral((x_**WC('n', S(1))*WC('b', S(1)) + WC('a', S(0)))**WC('p', S(1))*WC('u', S(1)), x_), cons2, cons3, cons4, cons5, cons6)
  148. rule2 = ReplacementRule(pattern2, replacement2)
  149. pattern3 = Pattern(Integral((a_ + x_**WC('j', S(1))*WC('c', S(1)) + x_**WC('n', S(1))*WC('b', S(1)))**WC('p', S(1))*WC('u', S(1)), x_), cons2, cons3, cons8, cons4, cons5, cons7, cons1)
  150. rule3 = ReplacementRule(pattern3, replacement3)
  151. pattern4 = Pattern(Integral((x_**WC('j', S(1))*WC('c', S(1)) + x_**WC('n', S(1))*WC('b', S(1)) + WC('a', S(0)))**WC('p', S(1))*WC('u', S(1)), x_), cons2, cons3, cons8, cons4, cons5, cons7, cons6)
  152. rule4 = ReplacementRule(pattern4, replacement4)
  153. pattern5 = Pattern(Integral((x_**WC('j', S(1))*WC('c', S(1)) + x_**WC('n', S(1))*WC('b', S(1)) + WC('a', S(0)))**WC('p', S(1))*WC('u', S(1)), x_), cons2, cons3, cons8, cons4, cons5, cons7, cons9)
  154. rule5 = ReplacementRule(pattern5, replacement5)
  155. pattern6 = Pattern(Integral((v_*WC('a', S(1)) + v_*WC('b', S(1)) + WC('w', S(0)))**WC('p', S(1))*WC('u', S(1)), x_), cons2, cons3, cons10)
  156. rule6 = ReplacementRule(pattern6, replacement6)
  157. pattern7 = Pattern(Integral(Pm_**p_*WC('u', S(1)), x_), cons11, cons12, cons13)
  158. rule7 = ReplacementRule(pattern7, replacement7)
  159. pattern8 = Pattern(Integral(a_, x_), cons2, cons2)
  160. rule8 = ReplacementRule(pattern8, replacement8)
  161. pattern9 = Pattern(Integral(a_*(b_ + x_*WC('c', S(1))), x_), cons2, cons3, cons8, cons14)
  162. rule9 = ReplacementRule(pattern9, replacement9)
  163. pattern10 = Pattern(Integral(-u_, x_))
  164. rule10 = ReplacementRule(pattern10, replacement10)
  165. pattern11 = Pattern(Integral(u_*Complex(S(0), a_), x_), cons2, cons15)
  166. rule11 = ReplacementRule(pattern11, replacement11)
  167. pattern12 = Pattern(Integral(a_*u_, x_), cons2, cons16)
  168. rule12 = ReplacementRule(pattern12, replacement12)
  169. pattern13 = Pattern(Integral(u_, x_), cons17)
  170. rule13 = ReplacementRule(pattern13, replacement13)
  171. pattern14 = Pattern(Integral(u_*(x_*WC('c', S(1)))**WC('m', S(1)), x_), cons8, cons19, cons17, cons18)
  172. rule14 = ReplacementRule(pattern14, replacement14)
  173. pattern15 = Pattern(Integral(v_**WC('m', S(1))*(b_*v_)**n_*WC('u', S(1)), x_), cons3, cons4, cons20)
  174. rule15 = ReplacementRule(pattern15, replacement15)
  175. pattern16 = Pattern(Integral((v_*WC('a', S(1)))**m_*(v_*WC('b', S(1)))**n_*WC('u', S(1)), x_), cons2, cons3, cons19, cons21, cons22, cons23)
  176. rule16 = ReplacementRule(pattern16, replacement16)
  177. pattern17 = Pattern(Integral((v_*WC('a', S(1)))**m_*(v_*WC('b', S(1)))**n_*WC('u', S(1)), x_), cons2, cons3, cons19, cons21, cons24, cons23)
  178. rule17 = ReplacementRule(pattern17, replacement17)
  179. pattern18 = Pattern(Integral((v_*WC('a', S(1)))**m_*(v_*WC('b', S(1)))**n_*WC('u', S(1)), x_), cons2, cons3, cons19, cons4, cons21, cons25, cons23)
  180. rule18 = ReplacementRule(pattern18, replacement18)
  181. pattern19 = Pattern(Integral((v_*WC('a', S(1)))**m_*(v_*WC('b', S(1)))**n_*WC('u', S(1)), x_), cons2, cons3, cons19, cons4, cons21, cons25, cons26)
  182. rule19 = ReplacementRule(pattern19, replacement19)
  183. pattern20 = Pattern(Integral((a_ + v_*WC('b', S(1)))**WC('m', S(1))*(c_ + v_*WC('d', S(1)))**WC('n', S(1))*WC('u', S(1)), x_), cons2, cons3, cons8, cons29, cons4, cons27, cons20, cons28)
  184. rule20 = ReplacementRule(pattern20, replacement20)
  185. pattern21 = Pattern(Integral((a_ + v_*WC('b', S(1)))**m_*(c_ + v_*WC('d', S(1)))**n_*WC('u', S(1)), x_), cons2, cons3, cons8, cons29, cons19, cons4, cons27, cons30, cons31)
  186. rule21 = ReplacementRule(pattern21, replacement21)
  187. pattern22 = Pattern(Integral((a_ + v_*WC('b', S(1)))**m_*(c_ + v_*WC('d', S(1)))**n_*WC('u', S(1)), x_), cons2, cons3, cons8, cons29, cons19, cons4, cons27, cons32)
  188. rule22 = ReplacementRule(pattern22, replacement22)
  189. pattern23 = Pattern(Integral((v_*WC('a', S(1)))**m_*(v_**S(2)*WC('c', S(1)) + v_*WC('b', S(1)))*WC('u', S(1)), x_), cons2, cons3, cons8, cons33, cons34)
  190. rule23 = ReplacementRule(pattern23, replacement23)
  191. pattern24 = Pattern(Integral((a_ + v_*WC('b', S(1)))**m_*(v_**S(2)*WC('C', S(1)) + v_*WC('B', S(1)) + WC('A', S(0)))*WC('u', S(1)), x_), cons2, cons3, cons36, cons37, cons38, cons35, cons33, cons34)
  192. rule24 = ReplacementRule(pattern24, replacement24)
  193. pattern25 = Pattern(Integral((a_ + x_**WC('n', S(1))*WC('b', S(1)))**WC('m', S(1))*(c_ + x_**WC('q', S(1))*WC('d', S(1)))**WC('p', S(1))*WC('u', S(1)), x_), cons2, cons3, cons8, cons29, cons19, cons4, cons39, cons40, cons41, cons42)
  194. rule25 = ReplacementRule(pattern25, replacement25)
  195. pattern26 = Pattern(Integral((a_ + x_**WC('n', S(1))*WC('b', S(1)))**WC('m', S(1))*(c_ + x_**j_*WC('d', S(1)))**WC('p', S(1))*WC('u', S(1)), x_), cons2, cons3, cons8, cons29, cons19, cons4, cons5, cons7, cons43, cons44, cons45, cons46)
  196. rule26 = ReplacementRule(pattern26, replacement26)
  197. pattern27 = Pattern(Integral((a_ + x_**S(2)*WC('c', S(1)) + x_*WC('b', S(1)))**WC('p', S(1))*WC('u', S(1)), x_), cons2, cons3, cons8, cons47, cons40)
  198. rule27 = ReplacementRule(pattern27, replacement27)
  199. pattern28 = Pattern(Integral((a_ + x_**n_*WC('b', S(1)) + x_**WC('n2', S(1))*WC('c', S(1)))**WC('p', S(1))*WC('u', S(1)), x_), cons2, cons3, cons8, cons4, cons48, cons47, cons40)
  200. rule28 = ReplacementRule(pattern28, replacement28)
  201. pattern29 = Pattern(Integral((d_ + x_*WC('e', S(1)))*(x_**S(2)*WC('c', S(1)) + x_*WC('b', S(1)) + WC('a', S(0)))**WC('p', S(1)), x_), cons2, cons3, cons8, cons29, cons50, cons5, cons49)
  202. rule29 = ReplacementRule(pattern29, replacement29)
  203. pattern30 = Pattern(Integral((x_**WC('p', S(1))*WC('a', S(1)) + x_**WC('q', S(1))*WC('b', S(1)))**WC('m', S(1))*WC('u', S(1)), x_), cons2, cons3, cons5, cons52, cons20, cons51)
  204. rule30 = ReplacementRule(pattern30, replacement30)
  205. pattern31 = Pattern(Integral((x_**WC('p', S(1))*WC('a', S(1)) + x_**WC('q', S(1))*WC('b', S(1)) + x_**WC('r', S(1))*WC('c', S(1)))**WC('m', S(1))*WC('u', S(1)), x_), cons2, cons3, cons8, cons5, cons52, cons54, cons20, cons51, cons53)
  206. rule31 = ReplacementRule(pattern31, replacement31)
  207. pattern32 = Pattern(Integral(x_**WC('m', S(1))/(a_ + x_**n_*WC('b', S(1))), x_), cons2, cons3, cons19, cons4, cons55)
  208. rule32 = ReplacementRule(pattern32, replacement32)
  209. pattern33 = Pattern(Integral(x_**WC('m', S(1))*(a_ + x_**n_*WC('b', S(1)))**p_, x_), cons2, cons3, cons19, cons4, cons5, cons55, cons56)
  210. rule33 = ReplacementRule(pattern33, replacement33)
  211. pattern34 = Pattern(Integral(x_**WC('m', S(1))*(a1_ + x_**WC('n', S(1))*WC('b1', S(1)))**p_*(a2_ + x_**WC('n', S(1))*WC('b2', S(1)))**p_, x_), cons59, cons60, cons61, cons62, cons19, cons4, cons5, cons57, cons58, cons56)
  212. rule34 = ReplacementRule(pattern34, replacement34)
  213. pattern35 = Pattern(Integral(Qm_*(Pm_**WC('n', S(1))*WC('b', S(1)) + WC('a', S(0)))**WC('p', S(1)), x_), cons2, cons3, cons4, cons5, cons11, cons63, CustomConstraint(With35))
  214. rule35 = ReplacementRule(pattern35, replacement35)
  215. pattern36 = Pattern(Integral(Qm_*(Pm_**WC('n', S(1))*WC('b', S(1)) + Pm_**WC('n2', S(1))*WC('c', S(1)) + WC('a', S(0)))**WC('p', S(1)), x_), cons2, cons3, cons8, cons4, cons5, cons48, cons11, cons63, CustomConstraint(With36))
  216. rule36 = ReplacementRule(pattern36, replacement36)
  217. pattern37 = Pattern(Integral(Pq_**m_*Qr_**p_*WC('u', S(1)), x_), cons64, cons65, cons66, cons67, CustomConstraint(With37))
  218. rule37 = ReplacementRule(pattern37, replacement37)
  219. pattern38 = Pattern(Integral(Pq_*Qr_**p_*WC('u', S(1)), x_), cons65, cons66, cons67, CustomConstraint(With38))
  220. rule38 = ReplacementRule(pattern38, replacement38)
  221. return [rule1, rule2, rule3, rule4, rule5, rule6, rule7, rule8, rule9, rule10, rule11, rule12, rule13, rule14, rule15, rule16, rule17, rule18, rule19, rule20, rule21, rule22, rule23, rule24, rule25, rule26, rule27, rule28, rule29, rule30, rule31, rule32, rule33, rule34, rule35, rule36, rule37, rule38, ]
  222. def replacement1(a, b, n, p, u, x):
  223. return Int(u*(b*x**n)**p, x)
  224. def replacement2(a, b, n, p, u, x):
  225. return Int(a**p*u, x)
  226. def replacement3(a, b, c, j, n, p, u, x):
  227. return Int(u*(b*x**n + c*x**(S(2)*n))**p, x)
  228. def replacement4(a, b, c, j, n, p, u, x):
  229. return Int(u*(a + c*x**(S(2)*n))**p, x)
  230. def replacement5(a, b, c, j, n, p, u, x):
  231. return Int(u*(a + b*x**n)**p, x)
  232. def replacement6(a, b, p, u, v, w, x):
  233. return Int(u*(v*(a + b) + w)**p, x)
  234. def replacement7(Pm, p, u, x):
  235. return Int(Pm**p*u, x)
  236. def replacement8(a, x):
  237. return Simp(a*x, x)
  238. def replacement9(a, b, c, x):
  239. return Simp(a*(b + c*x)**S(2)/(S(2)*c), x)
  240. def replacement10(u, x):
  241. return Dist(S(-1), Int(u, x), x)
  242. def replacement11(a, u, x):
  243. return Dist(Complex(S(0), a), Int(u, x), x)
  244. def replacement12(a, u, x):
  245. return Dist(a, Int(u, x), x)
  246. def replacement13(u, x):
  247. return Simp(IntSum(u, x), x)
  248. def replacement14(c, m, u, x):
  249. return Int(ExpandIntegrand(u*(c*x)**m, x), x)
  250. def replacement15(b, m, n, u, v, x):
  251. return Dist(b**(-m), Int(u*(b*v)**(m + n), x), x)
  252. def replacement16(a, b, m, n, u, v, x):
  253. return Dist(a**(m + S(1)/2)*b**(n + S(-1)/2)*sqrt(b*v)/sqrt(a*v), Int(u*v**(m + n), x), x)
  254. def replacement17(a, b, m, n, u, v, x):
  255. return Dist(a**(m + S(-1)/2)*b**(n + S(1)/2)*sqrt(a*v)/sqrt(b*v), Int(u*v**(m + n), x), x)
  256. def replacement18(a, b, m, n, u, v, x):
  257. return Dist(a**(m + n)*(a*v)**(-n)*(b*v)**n, Int(u*v**(m + n), x), x)
  258. def replacement19(a, b, m, n, u, v, x):
  259. return Dist(a**(-IntPart(n))*b**IntPart(n)*(a*v)**(-FracPart(n))*(b*v)**FracPart(n), Int(u*(a*v)**(m + n), x), x)
  260. def replacement20(a, b, c, d, m, n, u, v, x):
  261. return Dist((b/d)**m, Int(u*(c + d*v)**(m + n), x), x)
  262. def replacement21(a, b, c, d, m, n, u, v, x):
  263. return Dist((b/d)**m, Int(u*(c + d*v)**(m + n), x), x)
  264. def replacement22(a, b, c, d, m, n, u, v, x):
  265. return Dist((a + b*v)**m*(c + d*v)**(-m), Int(u*(c + d*v)**(m + n), x), x)
  266. def replacement23(a, b, c, m, u, v, x):
  267. return Dist(S(1)/a, Int(u*(a*v)**(m + S(1))*(b + c*v), x), x)
  268. def replacement24(A, B, C, a, b, m, u, v, x):
  269. return Dist(b**(S(-2)), Int(u*(a + b*v)**(m + S(1))*Simp(B*b - C*a + C*b*v, x), x), x)
  270. def replacement25(a, b, c, d, m, n, p, q, u, x):
  271. return Dist((d/a)**p, Int(u*x**(-n*p)*(a + b*x**n)**(m + p), x), x)
  272. def replacement26(a, b, c, d, j, m, n, p, u, x):
  273. return Dist((-b**S(2)/d)**m, Int(u*(a - b*x**n)**(-m), x), x)
  274. def replacement27(a, b, c, p, u, x):
  275. return Int(S(2)**(-S(2)*p)*c**(-p)*u*(b + S(2)*c*x)**(S(2)*p), x)
  276. def replacement28(a, b, c, n, n2, p, u, x):
  277. return Dist(c**(-p), Int(u*(b/S(2) + c*x**n)**(S(2)*p), x), x)
  278. def replacement29(a, b, c, d, e, p, x):
  279. return Dist(d/b, Subst(Int(x**p, x), x, a + b*x + c*x**S(2)), x)
  280. def replacement30(a, b, m, p, q, u, x):
  281. return Int(u*x**(m*p)*(a + b*x**(-p + q))**m, x)
  282. def replacement31(a, b, c, m, p, q, r, u, x):
  283. return Int(u*x**(m*p)*(a + b*x**(-p + q) + c*x**(-p + r))**m, x)
  284. def replacement32(a, b, m, n, x):
  285. return Simp(log(RemoveContent(a + b*x**n, x))/(b*n), x)
  286. def replacement33(a, b, m, n, p, x):
  287. return Simp((a + b*x**n)**(p + S(1))/(b*n*(p + S(1))), x)
  288. def replacement34(a1, a2, b1, b2, m, n, p, x):
  289. return Simp((a1 + b1*x**n)**(p + S(1))*(a2 + b2*x**n)**(p + S(1))/(S(2)*b1*b2*n*(p + S(1))), x)
  290. def With35(Pm, Qm, a, b, n, p, x):
  291. if isinstance(x, (int, Integer, float, Float)):
  292. return False
  293. m = Expon(Pm, x)
  294. if And(Equal(Expon(Qm, x), m + S(-1)), ZeroQ(-Qm*m*Coeff(Pm, x, m) + Coeff(Qm, x, m + S(-1))*D(Pm, x))):
  295. return True
  296. return False
  297. def replacement35(Pm, Qm, a, b, n, p, x):
  298. m = Expon(Pm, x)
  299. return Dist(Coeff(Qm, x, m + S(-1))/(m*Coeff(Pm, x, m)), Subst(Int((a + b*x**n)**p, x), x, Pm), x)
  300. def With36(Pm, Qm, a, b, c, n, n2, p, x):
  301. if isinstance(x, (int, Integer, float, Float)):
  302. return False
  303. m = Expon(Pm, x)
  304. if And(Equal(Expon(Qm, x), m + S(-1)), ZeroQ(-Qm*m*Coeff(Pm, x, m) + Coeff(Qm, x, m + S(-1))*D(Pm, x))):
  305. return True
  306. return False
  307. def replacement36(Pm, Qm, a, b, c, n, n2, p, x):
  308. m = Expon(Pm, x)
  309. return Dist(Coeff(Qm, x, m + S(-1))/(m*Coeff(Pm, x, m)), Subst(Int((a + b*x**n + c*x**(S(2)*n))**p, x), x, Pm), x)
  310. def With37(Pq, Qr, m, p, u, x):
  311. if isinstance(x, (int, Integer, float, Float)):
  312. return False
  313. gcd = PolyGCD(Pq, Qr, x)
  314. if NonzeroQ(gcd + S(-1)):
  315. return True
  316. return False
  317. def replacement37(Pq, Qr, m, p, u, x):
  318. gcd = PolyGCD(Pq, Qr, x)
  319. return Int(gcd**(m + p)*u*PolynomialQuotient(Pq, gcd, x)**m*PolynomialQuotient(Qr, gcd, x)**p, x)
  320. def With38(Pq, Qr, p, u, x):
  321. if isinstance(x, (int, Integer, float, Float)):
  322. return False
  323. gcd = PolyGCD(Pq, Qr, x)
  324. if NonzeroQ(gcd + S(-1)):
  325. return True
  326. return False
  327. def replacement38(Pq, Qr, p, u, x):
  328. gcd = PolyGCD(Pq, Qr, x)
  329. return Int(gcd**(p + S(1))*u*PolynomialQuotient(Pq, gcd, x)*PolynomialQuotient(Qr, gcd, x)**p, x)