text:
int_rules_1_2_3_4 = @theory begin

    #= ::Subsection::Closed:: =#
    #= 1.2.3.4*(f*x)^m*(d+e*x^n)^q*(a+b*x^n+c*x^(2*n))^p =#
    @apply_utils Antiderivative((~(f') * ~x) ^ ~(m') * (~(e') * (~x) ^ ~n) ^ ~q * (~a + ~(b') * (~x) ^ ~n + ~(c') * (~x) ^ ~(n2')) ^ ~(p'), ~x) => ((~f) ^ ~m / (~n * (~e) ^ ((~m + 1) / ~n - 1))) * Subst(Antiderivative((~e * ~x) ^ ((~q + (~m + 1) / ~n) - 1) * (~a + ~b * ~x + ~c * (~x) ^ 2) ^ ~p, ~x), ~x, (~x) ^ ~n) <-- FreeQ([~a, ~b, ~c, ~e, ~f, ~m, ~n, ~p, ~q], ~x) && (EqQ(~n2, 2 * ~n) && ((IntegerQ(~m) || GtQ(~f, 0)) && IntegerQ(Simplify((~m + 1) / ~n))))
    @apply_utils Antiderivative((~(f') * ~x) ^ ~(m') * (~(e') * (~x) ^ ~n) ^ ~q * (~a + ~(c') * (~x) ^ ~(n2')) ^ ~(p'), ~x) => ((~f) ^ ~m / (~n * (~e) ^ ((~m + 1) / ~n - 1))) * Subst(Antiderivative((~e * ~x) ^ ((~q + (~m + 1) / ~n) - 1) * (~a + ~c * (~x) ^ 2) ^ ~p, ~x), ~x, (~x) ^ ~n) <-- FreeQ([~a, ~c, ~e, ~f, ~m, ~n, ~p, ~q], ~x) && (EqQ(~n2, 2 * ~n) && ((IntegerQ(~m) || GtQ(~f, 0)) && IntegerQ(Simplify((~m + 1) / ~n))))
    @apply_utils Antiderivative((~(f') * ~x) ^ ~(m') * (~(e') * (~x) ^ ~n) ^ ~q * (~a + ~(b') * (~x) ^ ~n + ~(c') * (~x) ^ ~(n2')) ^ ~(p'), ~x) => (((~f) ^ ~m * (~e) ^ IntPart(~q) * (~e * (~x) ^ ~n) ^ FracPart(~q)) / (~x) ^ (~n * FracPart(~q))) * Antiderivative((~x) ^ (~m + ~n * ~q) * (~a + ~b * (~x) ^ ~n + ~c * (~x) ^ (2 * ~n)) ^ ~p, ~x) <-- FreeQ([~a, ~b, ~c, ~e, ~f, ~m, ~n, ~p, ~q], ~x) && (EqQ(~n2, 2 * ~n) && ((IntegerQ(~m) || GtQ(~f, 0)) && Not(IntegerQ(Simplify((~m + 1) / ~n)))))
    @apply_utils Antiderivative((~(f') * ~x) ^ ~(m') * (~(e') * (~x) ^ ~n) ^ ~q * (~a + ~(c') * (~x) ^ ~(n2')) ^ ~(p'), ~x) => (((~f) ^ ~m * (~e) ^ IntPart(~q) * (~e * (~x) ^ ~n) ^ FracPart(~q)) / (~x) ^ (~n * FracPart(~q))) * Antiderivative((~x) ^ (~m + ~n * ~q) * (~a + ~c * (~x) ^ (2 * ~n)) ^ ~p, ~x) <-- FreeQ([~a, ~c, ~e, ~f, ~m, ~n, ~p, ~q], ~x) && (EqQ(~n2, 2 * ~n) && ((IntegerQ(~m) || GtQ(~f, 0)) && Not(IntegerQ(Simplify((~m + 1) / ~n)))))
    @apply_utils Antiderivative((~f * ~x) ^ ~(m') * (~(e') * (~x) ^ ~n) ^ ~q * (~a + ~(b') * (~x) ^ ~n + ~(c') * (~x) ^ ~(n2')) ^ ~(p'), ~x) => (((~f) ^ IntPart(~m) * (~f * ~x) ^ FracPart(~m)) / (~x) ^ FracPart(~m)) * Antiderivative((~x) ^ ~m * (~e * (~x) ^ ~n) ^ ~q * (~a + ~b * (~x) ^ ~n + ~c * (~x) ^ (2 * ~n)) ^ ~p, ~x) <-- FreeQ([~a, ~b, ~c, ~e, ~f, ~m, ~n, ~p, ~q], ~x) && (EqQ(~n2, 2 * ~n) && Not(IntegerQ(~m)))
    @apply_utils Antiderivative((~f * ~x) ^ ~(m') * (~(e') * (~x) ^ ~n) ^ ~q * (~a + ~(c') * (~x) ^ ~(n2')) ^ ~(p'), ~x) => (((~f) ^ IntPart(~m) * (~f * ~x) ^ FracPart(~m)) / (~x) ^ FracPart(~m)) * Antiderivative((~x) ^ ~m * (~e * (~x) ^ ~n) ^ ~q * (~a + ~c * (~x) ^ (2 * ~n)) ^ ~p, ~x) <-- FreeQ([~a, ~c, ~e, ~f, ~m, ~n, ~p, ~q], ~x) && (EqQ(~n2, 2 * ~n) && Not(IntegerQ(~m)))
    @apply_utils Antiderivative((~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) ^ ~(q') * (~a + ~(b') * (~x) ^ ~n + ~(c') * (~x) ^ ~(n2')) ^ ~(p'), ~x) => (1 / ~n) * Subst(Antiderivative((~d + ~e * ~x) ^ ~q * (~a + ~b * ~x + ~c * (~x) ^ 2) ^ ~p, ~x), ~x, (~x) ^ ~n) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~m, ~n, ~p, ~q], ~x) && (EqQ(~n2, 2 * ~n) && EqQ(Simplify((~m - ~n) + 1), 0))
    @apply_utils Antiderivative((~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) ^ ~(q') * (~a + ~(c') * (~x) ^ ~(n2')) ^ ~(p'), ~x) => (1 / ~n) * Subst(Antiderivative((~d + ~e * ~x) ^ ~q * (~a + ~c * (~x) ^ 2) ^ ~p, ~x), ~x, (~x) ^ ~n) <-- FreeQ([~a, ~c, ~d, ~e, ~m, ~n, ~p, ~q], ~x) && (EqQ(~n2, 2 * ~n) && EqQ(Simplify((~m - ~n) + 1), 0))
    @apply_utils Antiderivative((~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) ^ ~(q') * (~a + ~(b') * (~x) ^ ~n + ~(c') * (~x) ^ ~(n2')) ^ ~(p'), ~x) => Antiderivative((~x) ^ (~m + ~n * (2 * ~p + ~q)) * (~e + ~d * (~x) ^ -(~n)) ^ ~q * (~c + ~b * (~x) ^ -(~n) + ~a * (~x) ^ (-2 * ~n)) ^ ~p, ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~m, ~n], ~x) && (EqQ(~n2, 2 * ~n) && (IntegersQ(~p, ~q) && NegQ(~n)))
    @apply_utils Antiderivative((~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) ^ ~(q') * (~a + ~(c') * (~x) ^ ~(n2')) ^ ~(p'), ~x) => Antiderivative((~x) ^ (~m + ~n * (2 * ~p + ~q)) * (~e + ~d * (~x) ^ -(~n)) ^ ~q * (~c + ~a * (~x) ^ (-2 * ~n)) ^ ~p, ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~m, ~n], ~x) && (EqQ(~n2, 2 * ~n) && (IntegersQ(~p, ~q) && NegQ(~n)))
    @apply_utils Antiderivative((~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) ^ ~(q') * (~a + ~(b') * (~x) ^ ~n + ~(c') * (~x) ^ ~(n2')) ^ ~p, ~x) => (1 / ~n) * Subst(Antiderivative((~x) ^ ((~m + 1) / ~n - 1) * (~d + ~e * ~x) ^ ~q * (~a + ~b * ~x + ~c * (~x) ^ 2) ^ ~p, ~x), ~x, (~x) ^ ~n) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~p, ~q], ~x) && (EqQ(~n2, 2 * ~n) && (EqQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (Not(IntegerQ(~p)) && (IGtQ(~m, 0) && (IGtQ(~n, 0) && IGtQ((~m + 1) / ~n, 0))))))
    @apply_utils Antiderivative((~(f') * ~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) ^ ~(q') * (~a + ~(b') * (~x) ^ ~n + ~(c') * (~x) ^ ~(n2')) ^ ~p, ~x) => ((~a + ~b * (~x) ^ ~n + ~c * (~x) ^ (2 * ~n)) ^ FracPart(~p) / ((~c) ^ IntPart(~p) * (~b / 2 + ~c * (~x) ^ ~n) ^ (2 * FracPart(~p)))) * Antiderivative((~f * ~x) ^ ~m * (~d + ~e * (~x) ^ ~n) ^ ~q * (~b / 2 + ~c * (~x) ^ ~n) ^ (2 * ~p), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~m, ~n, ~p, ~q], ~x) && (EqQ(~n2, 2 * ~n) && (EqQ((~b) ^ 2 - 4 * ~a * ~c, 0) && Not(IntegerQ(~p))))
    @apply_utils Antiderivative((~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) ^ ~(q') * (~a + ~(b') * (~x) ^ ~n + ~(c') * (~x) ^ ~(n2')) ^ ~(p'), ~x) => (1 / ~n) * Subst(Antiderivative((~x) ^ (Simplify((~m + 1) / ~n) - 1) * (~d + ~e * ~x) ^ ~q * (~a + ~b * ~x + ~c * (~x) ^ 2) ^ ~p, ~x), ~x, (~x) ^ ~n) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~m, ~n, ~p, ~q], ~x) && (EqQ(~n2, 2 * ~n) && IntegerQ(Simplify((~m + 1) / ~n)))
    @apply_utils Antiderivative((~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) ^ ~(q') * (~a + ~(c') * (~x) ^ ~(n2')) ^ ~(p'), ~x) => (1 / ~n) * Subst(Antiderivative((~x) ^ (Simplify((~m + 1) / ~n) - 1) * (~d + ~e * ~x) ^ ~q * (~a + ~c * (~x) ^ 2) ^ ~p, ~x), ~x, (~x) ^ ~n) <-- FreeQ([~a, ~c, ~d, ~e, ~m, ~n, ~p, ~q], ~x) && (EqQ(~n2, 2 * ~n) && IntegerQ(Simplify((~m + 1) / ~n)))
    @apply_utils Antiderivative((~f * ~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) ^ ~(q') * (~a + ~(b') * (~x) ^ ~n + ~(c') * (~x) ^ ~(n2')) ^ ~(p'), ~x) => (((~f) ^ IntPart(~m) * (~f * ~x) ^ FracPart(~m)) / (~x) ^ FracPart(~m)) * Antiderivative((~x) ^ ~m * (~d + ~e * (~x) ^ ~n) ^ ~q * (~a + ~b * (~x) ^ ~n + ~c * (~x) ^ (2 * ~n)) ^ ~p, ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~m, ~n, ~p, ~q], ~x) && (EqQ(~n2, 2 * ~n) && IntegerQ(Simplify((~m + 1) / ~n)))
    @apply_utils Antiderivative((~f * ~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) ^ ~(q') * (~a + ~(c') * (~x) ^ ~(n2')) ^ ~(p'), ~x) => (((~f) ^ IntPart(~m) * (~f * ~x) ^ FracPart(~m)) / (~x) ^ FracPart(~m)) * Antiderivative((~x) ^ ~m * (~d + ~e * (~x) ^ ~n) ^ ~q * (~a + ~c * (~x) ^ (2 * ~n)) ^ ~p, ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~m, ~n, ~p, ~q], ~x) && (EqQ(~n2, 2 * ~n) && IntegerQ(Simplify((~m + 1) / ~n)))
    @apply_utils Antiderivative((~(f') * ~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) ^ ~(q') * (~a + ~(b') * (~x) ^ ~n + ~(c') * (~x) ^ ~n2) ^ ~(p'), ~x) => Antiderivative((~f * ~x) ^ ~m * (~d + ~e * (~x) ^ ~n) ^ (~q + ~p) * (~a / ~d + (~c / ~e) * (~x) ^ ~n) ^ ~p, ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~m, ~n, ~q], ~x) && (EqQ(~n2, 2 * ~n) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (EqQ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2, 0) && IntegerQ(~p))))
    @apply_utils Antiderivative((~(f') * ~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) ^ ~(q') * (~a + ~(c') * (~x) ^ ~n2) ^ ~(p'), ~x) => Antiderivative((~f * ~x) ^ ~m * (~d + ~e * (~x) ^ ~n) ^ (~q + ~p) * (~a / ~d + (~c / ~e) * (~x) ^ ~n) ^ ~p, ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~q, ~m, ~n, ~q], ~x) && (EqQ(~n2, 2 * ~n) && (EqQ(~c * (~d) ^ 2 + ~a * (~e) ^ 2, 0) && IntegerQ(~p)))
    @apply_utils Antiderivative((~(f') * ~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) ^ ~q * (~a + ~(b') * (~x) ^ ~n + ~(c') * (~x) ^ ~n2) ^ ~p, ~x) => ((~a + ~b * (~x) ^ ~n + ~c * (~x) ^ (2 * ~n)) ^ FracPart(~p) / ((~d + ~e * (~x) ^ ~n) ^ FracPart(~p) * (~a / ~d + (~c * (~x) ^ ~n) / ~e) ^ FracPart(~p))) * Antiderivative((~f * ~x) ^ ~m * (~d + ~e * (~x) ^ ~n) ^ (~q + ~p) * (~a / ~d + (~c / ~e) * (~x) ^ ~n) ^ ~p, ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~m, ~n, ~p, ~q], ~x) && (EqQ(~n2, 2 * ~n) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (EqQ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2, 0) && Not(IntegerQ(~p)))))
    @apply_utils Antiderivative((~(f') * ~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) ^ ~q * (~a + ~(c') * (~x) ^ ~n2) ^ ~p, ~x) => ((~a + ~c * (~x) ^ (2 * ~n)) ^ FracPart(~p) / ((~d + ~e * (~x) ^ ~n) ^ FracPart(~p) * (~a / ~d + (~c * (~x) ^ ~n) / ~e) ^ FracPart(~p))) * Antiderivative((~f * ~x) ^ ~m * (~d + ~e * (~x) ^ ~n) ^ (~q + ~p) * (~a / ~d + (~c / ~e) * (~x) ^ ~n) ^ ~p, ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~m, ~n, ~p, ~q], ~x) && (EqQ(~n2, 2 * ~n) && (EqQ(~c * (~d) ^ 2 + ~a * (~e) ^ 2, 0) && Not(IntegerQ(~p))))
    @apply_utils Antiderivative((~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) ^ ~q * (~a + ~(b') * (~x) ^ ~n + ~(c') * (~x) ^ ~(n2')) ^ ~(p'), ~x) => ((-(~d)) ^ ((~m - Mod(~m, ~n)) / ~n - 1) * ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2) ^ ~p * (~x) ^ (Mod(~m, ~n) + 1) * (~d + ~e * (~x) ^ ~n) ^ (~q + 1)) / (~n * (~e) ^ (2 * ~p + (~m - Mod(~m, ~n)) / ~n) * (~q + 1)) + (1 / (~n * (~e) ^ (2 * ~p + (~m - Mod(~m, ~n)) / ~n) * (~q + 1))) * Antiderivative((~x) ^ Mod(~m, ~n) * (~d + ~e * (~x) ^ ~n) ^ (~q + 1) * ExpandToSum(Together((1 / (~d + ~e * (~x) ^ ~n)) * (~n * (~e) ^ (2 * ~p + (~m - Mod(~m, ~n)) / ~n) * (~q + 1) * (~x) ^ (~m - Mod(~m, ~n)) * (~a + ~b * (~x) ^ ~n + ~c * (~x) ^ (2 * ~n)) ^ ~p - (-(~d)) ^ ((~m - Mod(~m, ~n)) / ~n - 1) * ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2) ^ ~p * (~d * (Mod(~m, ~n) + 1) + ~e * (Mod(~m, ~n) + ~n * (~q + 1) + 1) * (~x) ^ ~n))), ~x), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e], ~x) && (EqQ(~n2, 2 * ~n) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (IGtQ(~n, 0) && (IGtQ(~p, 0) && (ILtQ(~q, -1) && IGtQ(~m, 0))))))
    @apply_utils Antiderivative((~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) ^ ~q * (~a + ~(c') * (~x) ^ ~(n2')) ^ ~(p'), ~x) => ((-(~d)) ^ ((~m - Mod(~m, ~n)) / ~n - 1) * (~c * (~d) ^ 2 + ~a * (~e) ^ 2) ^ ~p * (~x) ^ (Mod(~m, ~n) + 1) * (~d + ~e * (~x) ^ ~n) ^ (~q + 1)) / (~n * (~e) ^ (2 * ~p + (~m - Mod(~m, ~n)) / ~n) * (~q + 1)) + (1 / (~n * (~e) ^ (2 * ~p + (~m - Mod(~m, ~n)) / ~n) * (~q + 1))) * Antiderivative((~x) ^ Mod(~m, ~n) * (~d + ~e * (~x) ^ ~n) ^ (~q + 1) * ExpandToSum(Together((1 / (~d + ~e * (~x) ^ ~n)) * (~n * (~e) ^ (2 * ~p + (~m - Mod(~m, ~n)) / ~n) * (~q + 1) * (~x) ^ (~m - Mod(~m, ~n)) * (~a + ~c * (~x) ^ (2 * ~n)) ^ ~p - (-(~d)) ^ ((~m - Mod(~m, ~n)) / ~n - 1) * (~c * (~d) ^ 2 + ~a * (~e) ^ 2) ^ ~p * (~d * (Mod(~m, ~n) + 1) + ~e * (Mod(~m, ~n) + ~n * (~q + 1) + 1) * (~x) ^ ~n))), ~x), ~x) <-- FreeQ([~a, ~c, ~d, ~e], ~x) && (EqQ(~n2, 2 * ~n) && (IGtQ(~n, 0) && (IGtQ(~p, 0) && (ILtQ(~q, -1) && IGtQ(~m, 0)))))
    @apply_utils Antiderivative((~x) ^ ~m * (~d + ~(e') * (~x) ^ ~n) ^ ~q * (~a + ~(b') * (~x) ^ ~n + ~(c') * (~x) ^ ~(n2')) ^ ~(p'), ~x) => ((-(~d)) ^ ((~m - Mod(~m, ~n)) / ~n - 1) * ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2) ^ ~p * (~x) ^ (Mod(~m, ~n) + 1) * (~d + ~e * (~x) ^ ~n) ^ (~q + 1)) / (~n * (~e) ^ (2 * ~p + (~m - Mod(~m, ~n)) / ~n) * (~q + 1)) + ((-(~d)) ^ ((~m - Mod(~m, ~n)) / ~n - 1) / (~n * (~e) ^ (2 * ~p) * (~q + 1))) * Antiderivative((~x) ^ ~m * (~d + ~e * (~x) ^ ~n) ^ (~q + 1) * ExpandToSum(Together((1 / (~d + ~e * (~x) ^ ~n)) * (~n * (-(~d)) ^ (-((~m - Mod(~m, ~n))) / ~n + 1) * (~e) ^ (2 * ~p) * (~q + 1) * (~a + ~b * (~x) ^ ~n + ~c * (~x) ^ (2 * ~n)) ^ ~p - ((~e) ^ (-((~m - Mod(~m, ~n))) / ~n) * ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2) ^ ~p * (~x) ^ -((~m - Mod(~m, ~n)))) * (~d * (Mod(~m, ~n) + 1) + ~e * (Mod(~m, ~n) + ~n * (~q + 1) + 1) * (~x) ^ ~n))), ~x), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e], ~x) && (EqQ(~n2, 2 * ~n) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (IGtQ(~n, 0) && (IGtQ(~p, 0) && (ILtQ(~q, -1) && ILtQ(~m, 0))))))
    @apply_utils Antiderivative((~x) ^ ~m * (~d + ~(e') * (~x) ^ ~n) ^ ~q * (~a + ~(c') * (~x) ^ ~(n2')) ^ ~(p'), ~x) => ((-(~d)) ^ ((~m - Mod(~m, ~n)) / ~n - 1) * (~c * (~d) ^ 2 + ~a * (~e) ^ 2) ^ ~p * (~x) ^ (Mod(~m, ~n) + 1) * (~d + ~e * (~x) ^ ~n) ^ (~q + 1)) / (~n * (~e) ^ (2 * ~p + (~m - Mod(~m, ~n)) / ~n) * (~q + 1)) + ((-(~d)) ^ ((~m - Mod(~m, ~n)) / ~n - 1) / (~n * (~e) ^ (2 * ~p) * (~q + 1))) * Antiderivative((~x) ^ ~m * (~d + ~e * (~x) ^ ~n) ^ (~q + 1) * ExpandToSum(Together((1 / (~d + ~e * (~x) ^ ~n)) * (~n * (-(~d)) ^ (-((~m - Mod(~m, ~n))) / ~n + 1) * (~e) ^ (2 * ~p) * (~q + 1) * (~a + ~c * (~x) ^ (2 * ~n)) ^ ~p - ((~e) ^ (-((~m - Mod(~m, ~n))) / ~n) * (~c * (~d) ^ 2 + ~a * (~e) ^ 2) ^ ~p * (~x) ^ -((~m - Mod(~m, ~n)))) * (~d * (Mod(~m, ~n) + 1) + ~e * (Mod(~m, ~n) + ~n * (~q + 1) + 1) * (~x) ^ ~n))), ~x), ~x) <-- FreeQ([~a, ~c, ~d, ~e], ~x) && (EqQ(~n2, 2 * ~n) && (IGtQ(~n, 0) && (IGtQ(~p, 0) && (IntegersQ(~m, ~q) && (ILtQ(~q, -1) && ILtQ(~m, 0))))))
    @apply_utils Antiderivative((~(f') * ~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) ^ ~(q') * (~a + ~(b') * (~x) ^ ~n + ~(c') * (~x) ^ ~(n2')) ^ ~(p'), ~x) => ((~c) ^ ~p * (~f * ~x) ^ (((~m + 2 * ~n * ~p) - ~n) + 1) * (~d + ~e * (~x) ^ ~n) ^ (~q + 1)) / (~e * (~f) ^ ((2 * ~n * ~p - ~n) + 1) * (~m + 2 * ~n * ~p + ~n * ~q + 1)) + (1 / (~e * (~m + 2 * ~n * ~p + ~n * ~q + 1))) * Antiderivative((~f * ~x) ^ ~m * (~d + ~e * (~x) ^ ~n) ^ ~q * ExpandToSum(~e * (~m + 2 * ~n * ~p + ~n * ~q + 1) * ((~a + ~b * (~x) ^ ~n + ~c * (~x) ^ (2 * ~n)) ^ ~p - (~c) ^ ~p * (~x) ^ (2 * ~n * ~p)) - ~d * (~c) ^ ~p * (((~m + 2 * ~n * ~p) - ~n) + 1) * (~x) ^ (2 * ~n * ~p - ~n), ~x), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~m, ~q], ~x) && (EqQ(~n2, 2 * ~n) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (IGtQ(~n, 0) && (IGtQ(~p, 0) && (GtQ(2 * ~n * ~p, ~n - 1) && (Not(IntegerQ(~q)) && NeQ(~m + 2 * ~n * ~p + ~n * ~q + 1, 0)))))))
    @apply_utils Antiderivative((~(f') * ~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) ^ ~(q') * (~a + ~(c') * (~x) ^ ~(n2')) ^ ~(p'), ~x) => ((~c) ^ ~p * (~f * ~x) ^ (((~m + 2 * ~n * ~p) - ~n) + 1) * (~d + ~e * (~x) ^ ~n) ^ (~q + 1)) / (~e * (~f) ^ ((2 * ~n * ~p - ~n) + 1) * (~m + 2 * ~n * ~p + ~n * ~q + 1)) + (1 / (~e * (~m + 2 * ~n * ~p + ~n * ~q + 1))) * Antiderivative((~f * ~x) ^ ~m * (~d + ~e * (~x) ^ ~n) ^ ~q * ExpandToSum(~e * (~m + 2 * ~n * ~p + ~n * ~q + 1) * ((~a + ~c * (~x) ^ (2 * ~n)) ^ ~p - (~c) ^ ~p * (~x) ^ (2 * ~n * ~p)) - ~d * (~c) ^ ~p * (((~m + 2 * ~n * ~p) - ~n) + 1) * (~x) ^ (2 * ~n * ~p - ~n), ~x), ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~m, ~q], ~x) && (EqQ(~n2, 2 * ~n) && (IGtQ(~n, 0) && (IGtQ(~p, 0) && (GtQ(2 * ~n * ~p, ~n - 1) && (Not(IntegerQ(~q)) && NeQ(~m + 2 * ~n * ~p + ~n * ~q + 1, 0))))))
    @apply_utils Antiderivative((~(f') * ~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) ^ ~(q') * (~a + ~(b') * (~x) ^ ~n + ~(c') * (~x) ^ ~(n2')) ^ ~(p'), ~x) => Antiderivative(ExpandIntegrand((~f * ~x) ^ ~m * (~d + ~e * (~x) ^ ~n) ^ ~q * (~a + ~b * (~x) ^ ~n + ~c * (~x) ^ (2 * ~n)) ^ ~p, ~x), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~m, ~q], ~x) && (EqQ(~n2, 2 * ~n) && (IGtQ(~n, 0) && IGtQ(~p, 0)))
    @apply_utils Antiderivative((~(f') * ~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) ^ ~(q') * (~a + ~(c') * (~x) ^ ~(n2')) ^ ~(p'), ~x) => Antiderivative(ExpandIntegrand((~f * ~x) ^ ~m * (~d + ~e * (~x) ^ ~n) ^ ~q * (~a + ~c * (~x) ^ (2 * ~n)) ^ ~p, ~x), ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~m, ~q], ~x) && (EqQ(~n2, 2 * ~n) && (IGtQ(~n, 0) && IGtQ(~p, 0)))
    @apply_utils Antiderivative((~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) ^ ~(q') * (~a + ~(b') * (~x) ^ ~n + ~(c') * (~x) ^ ~(n2')) ^ ~p, ~x) => With([k = GCD(~m + 1, ~n)], (1 / k) * Subst(Antiderivative((~x) ^ ((~m + 1) / k - 1) * (~d + ~e * (~x) ^ (~n / k)) ^ ~q * (~a + ~b * (~x) ^ (~n / k) + ~c * (~x) ^ ((2 * ~n) / k)) ^ ~p, ~x), ~x, (~x) ^ k) <-- k != 1) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~p, ~q], ~x) && (EqQ(~n2, 2 * ~n) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (IGtQ(~n, 0) && IntegerQ(~m))))
    @apply_utils Antiderivative((~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) ^ ~(q') * (~a + ~(c') * (~x) ^ ~(n2')) ^ ~p, ~x) => With([k = GCD(~m + 1, ~n)], (1 / k) * Subst(Antiderivative((~x) ^ ((~m + 1) / k - 1) * (~d + ~e * (~x) ^ (~n / k)) ^ ~q * (~a + ~c * (~x) ^ ((2 * ~n) / k)) ^ ~p, ~x), ~x, (~x) ^ k) <-- k != 1) <-- FreeQ([~a, ~c, ~d, ~e, ~p, ~q], ~x) && (EqQ(~n2, 2 * ~n) && (IGtQ(~n, 0) && IntegerQ(~m)))
    @apply_utils Antiderivative((~(f') * ~x) ^ ~m * (~d + ~(e') * (~x) ^ ~n) ^ ~(q') * (~a + ~(b') * (~x) ^ ~n + ~(c') * (~x) ^ ~(n2')) ^ ~p, ~x) => With([k = Denominator(~m)], (k / ~f) * Subst(Antiderivative((~x) ^ (k * (~m + 1) - 1) * (~d + (~e * (~x) ^ (k * ~n)) / (~f) ^ ~n) ^ ~q * (~a + (~b * (~x) ^ (k * ~n)) / (~f) ^ ~n + (~c * (~x) ^ (2 * k * ~n)) / (~f) ^ (2 * ~n)) ^ ~p, ~x), ~x, (~f * ~x) ^ (1 / k))) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~p, ~q], ~x) && (EqQ(~n2, 2 * ~n) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (IGtQ(~n, 0) && (FractionQ(~m) && IntegerQ(~p)))))
    @apply_utils Antiderivative((~(f') * ~x) ^ ~m * (~d + ~(e') * (~x) ^ ~n) ^ ~(q') * (~a + ~(c') * (~x) ^ ~(n2')) ^ ~p, ~x) => With([k = Denominator(~m)], (k / ~f) * Subst(Antiderivative((~x) ^ (k * (~m + 1) - 1) * (~d + (~e * (~x) ^ (k * ~n)) / ~f) ^ ~q * (~a + (~c * (~x) ^ (2 * k * ~n)) / ~f) ^ ~p, ~x), ~x, (~f * ~x) ^ (1 / k))) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~p, ~q], ~x) && (EqQ(~n2, 2 * ~n) && (IGtQ(~n, 0) && (FractionQ(~m) && IntegerQ(~p))))
    @apply_utils Antiderivative((~(f') * ~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) * (~a + ~(b') * (~x) ^ ~n + ~(c') * (~x) ^ ~n2) ^ ~(p'), ~x) => ((~f * ~x) ^ (~m + 1) * (~a + ~b * (~x) ^ ~n + ~c * (~x) ^ (2 * ~n)) ^ ~p * (~d * (~m + ~n * (2 * ~p + 1) + 1) + ~e * (~m + 1) * (~x) ^ ~n)) / (~f * (~m + 1) * (~m + ~n * (2 * ~p + 1) + 1)) + ((~n * ~p) / ((~f) ^ ~n * (~m + 1) * (~m + ~n * (2 * ~p + 1) + 1))) * Antiderivative((~f * ~x) ^ (~m + ~n) * (~a + ~b * (~x) ^ ~n + ~c * (~x) ^ (2 * ~n)) ^ (~p - 1) * Simp((2 * ~a * ~e * (~m + 1) - ~b * ~d * (~m + ~n * (2 * ~p + 1) + 1)) + (~b * ~e * (~m + 1) - 2 * ~c * ~d * (~m + ~n * (2 * ~p + 1) + 1)) * (~x) ^ ~n, ~x), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f], ~x) && (EqQ(~n2, 2 * ~n) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (IGtQ(~n, 0) && (GtQ(~p, 0) && (LtQ(~m, -1) && (NeQ(~m + ~n * (2 * ~p + 1) + 1, 0) && IntegerQ(~p)))))))
    @apply_utils Antiderivative((~(f') * ~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) * (~a + ~(c') * (~x) ^ ~n2) ^ ~(p'), ~x) => ((~f * ~x) ^ (~m + 1) * (~a + ~c * (~x) ^ (2 * ~n)) ^ ~p * (~d * (~m + ~n * (2 * ~p + 1) + 1) + ~e * (~m + 1) * (~x) ^ ~n)) / (~f * (~m + 1) * (~m + ~n * (2 * ~p + 1) + 1)) + ((2 * ~n * ~p) / ((~f) ^ ~n * (~m + 1) * (~m + ~n * (2 * ~p + 1) + 1))) * Antiderivative((~f * ~x) ^ (~m + ~n) * (~a + ~c * (~x) ^ (2 * ~n)) ^ (~p - 1) * (~a * ~e * (~m + 1) - ~c * ~d * (~m + ~n * (2 * ~p + 1) + 1) * (~x) ^ ~n), ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f], ~x) && (EqQ(~n2, 2 * ~n) && (IGtQ(~n, 0) && (GtQ(~p, 0) && (LtQ(~m, -1) && (NeQ(~m + ~n * (2 * ~p + 1) + 1, 0) && IntegerQ(~p))))))
    @apply_utils Antiderivative((~(f') * ~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) * (~a + ~(b') * (~x) ^ ~n + ~(c') * (~x) ^ ~n2) ^ ~(p'), ~x) => ((~f * ~x) ^ (~m + 1) * (~a + ~b * (~x) ^ ~n + ~c * (~x) ^ (2 * ~n)) ^ ~p * (~b * ~e * ~n * ~p + ~c * ~d * (~m + ~n * (2 * ~p + 1) + 1) + ~c * ~e * (2 * ~n * ~p + ~m + 1) * (~x) ^ ~n)) / (~c * ~f * (2 * ~n * ~p + ~m + 1) * (~m + ~n * (2 * ~p + 1) + 1)) + ((~n * ~p) / (~c * (2 * ~n * ~p + ~m + 1) * (~m + ~n * (2 * ~p + 1) + 1))) * Antiderivative((~f * ~x) ^ ~m * (~a + ~b * (~x) ^ ~n + ~c * (~x) ^ (2 * ~n)) ^ (~p - 1) * Simp((2 * ~a * ~c * ~d * (~m + ~n * (2 * ~p + 1) + 1) - ~a * ~b * ~e * (~m + 1)) + ((2 * ~a * ~c * ~e * (2 * ~n * ~p + ~m + 1) + ~b * ~c * ~d * (~m + ~n * (2 * ~p + 1) + 1)) - (~b) ^ 2 * ~e * (~m + ~n * ~p + 1)) * (~x) ^ ~n, ~x), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~m], ~x) && (EqQ(~n2, 2 * ~n) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (IGtQ(~n, 0) && (GtQ(~p, 0) && (NeQ(2 * ~n * ~p + ~m + 1, 0) && (NeQ(~m + ~n * (2 * ~p + 1) + 1, 0) && IntegerQ(~p)))))))
    @apply_utils Antiderivative((~(f') * ~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) * (~a + ~(c') * (~x) ^ ~n2) ^ ~(p'), ~x) => ((~f * ~x) ^ (~m + 1) * (~a + ~c * (~x) ^ (2 * ~n)) ^ ~p * (~c * ~d * (~m + ~n * (2 * ~p + 1) + 1) + ~c * ~e * (2 * ~n * ~p + ~m + 1) * (~x) ^ ~n)) / (~c * ~f * (2 * ~n * ~p + ~m + 1) * (~m + ~n * (2 * ~p + 1) + 1)) + ((2 * ~a * ~n * ~p) / ((2 * ~n * ~p + ~m + 1) * (~m + ~n * (2 * ~p + 1) + 1))) * Antiderivative((~f * ~x) ^ ~m * (~a + ~c * (~x) ^ (2 * ~n)) ^ (~p - 1) * Simp(~d * (~m + ~n * (2 * ~p + 1) + 1) + ~e * (2 * ~n * ~p + ~m + 1) * (~x) ^ ~n, ~x), ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~m], ~x) && (EqQ(~n2, 2 * ~n) && (IGtQ(~n, 0) && (GtQ(~p, 0) && (NeQ(2 * ~n * ~p + ~m + 1, 0) && (NeQ(~m + ~n * (2 * ~p + 1) + 1, 0) && IntegerQ(~p))))))
    @apply_utils Antiderivative((~(f') * ~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) * (~a + ~(b') * (~x) ^ ~n + ~(c') * (~x) ^ ~n2) ^ ~(p'), ~x) => ((~f) ^ (~n - 1) * (~f * ~x) ^ ((~m - ~n) + 1) * (~a + ~b * (~x) ^ ~n + ~c * (~x) ^ (2 * ~n)) ^ (~p + 1) * ((~b * ~d - 2 * ~a * ~e) - (~b * ~e - 2 * ~c * ~d) * (~x) ^ ~n)) / (~n * (~p + 1) * ((~b) ^ 2 - 4 * ~a * ~c)) + ((~f) ^ ~n / (~n * (~p + 1) * ((~b) ^ 2 - 4 * ~a * ~c))) * Antiderivative((~f * ~x) ^ (~m - ~n) * (~a + ~b * (~x) ^ ~n + ~c * (~x) ^ (2 * ~n)) ^ (~p + 1) * Simp(((~n - ~m) - 1) * (~b * ~d - 2 * ~a * ~e) + (2 * ~n * ~p + 2 * ~n + ~m + 1) * (~b * ~e - 2 * ~c * ~d) * (~x) ^ ~n, ~x), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f], ~x) && (EqQ(~n2, 2 * ~n) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (IGtQ(~n, 0) && (LtQ(~p, -1) && (GtQ(~m, ~n - 1) && IntegerQ(~p))))))
    @apply_utils Antiderivative((~(f') * ~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) * (~a + ~(c') * (~x) ^ ~n2) ^ ~(p'), ~x) => ((~f) ^ (~n - 1) * (~f * ~x) ^ ((~m - ~n) + 1) * (~a + ~c * (~x) ^ (2 * ~n)) ^ (~p + 1) * (~a * ~e - ~c * ~d * (~x) ^ ~n)) / (2 * ~a * ~c * ~n * (~p + 1)) + ((~f) ^ ~n / (2 * ~a * ~c * ~n * (~p + 1))) * Antiderivative((~f * ~x) ^ (~m - ~n) * (~a + ~c * (~x) ^ (2 * ~n)) ^ (~p + 1) * (~a * ~e * ((~n - ~m) - 1) + ~c * ~d * (2 * ~n * ~p + 2 * ~n + ~m + 1) * (~x) ^ ~n), ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f], ~x) && (EqQ(~n2, 2 * ~n) && (IGtQ(~n, 0) && (LtQ(~p, -1) && (GtQ(~m, ~n - 1) && IntegerQ(~p)))))
    @apply_utils Antiderivative((~(f') * ~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) * (~a + ~(b') * (~x) ^ ~n + ~(c') * (~x) ^ ~n2) ^ ~p, ~x) => (-((~f * ~x) ^ (~m + 1)) * (~a + ~b * (~x) ^ ~n + ~c * (~x) ^ (2 * ~n)) ^ (~p + 1) * ((~d * ((~b) ^ 2 - 2 * ~a * ~c) - ~a * ~b * ~e) + (~b * ~d - 2 * ~a * ~e) * ~c * (~x) ^ ~n)) / (~a * ~f * ~n * (~p + 1) * ((~b) ^ 2 - 4 * ~a * ~c)) + (1 / (~a * ~n * (~p + 1) * ((~b) ^ 2 - 4 * ~a * ~c))) * Antiderivative((~f * ~x) ^ ~m * (~a + ~b * (~x) ^ ~n + ~c * (~x) ^ (2 * ~n)) ^ (~p + 1) * Simp((~d * ((~b) ^ 2 * (~m + ~n * (~p + 1) + 1) - 2 * ~a * ~c * (~m + 2 * ~n * (~p + 1) + 1)) - ~a * ~b * ~e * (~m + 1)) + ~c * (~m + ~n * (2 * ~p + 3) + 1) * (~b * ~d - 2 * ~a * ~e) * (~x) ^ ~n, ~x), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~m], ~x) && (EqQ(~n2, 2 * ~n) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (IGtQ(~n, 0) && (LtQ(~p, -1) && IntegerQ(~p)))))
    @apply_utils Antiderivative((~(f') * ~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) * (~a + ~(c') * (~x) ^ ~n2) ^ ~p, ~x) => (-((~f * ~x) ^ (~m + 1)) * (~a + ~c * (~x) ^ (2 * ~n)) ^ (~p + 1) * (~d + ~e * (~x) ^ ~n)) / (2 * ~a * ~f * ~n * (~p + 1)) + (1 / (2 * ~a * ~n * (~p + 1))) * Antiderivative((~f * ~x) ^ ~m * (~a + ~c * (~x) ^ (2 * ~n)) ^ (~p + 1) * Simp(~d * (~m + 2 * ~n * (~p + 1) + 1) + ~e * (~m + ~n * (2 * ~p + 3) + 1) * (~x) ^ ~n, ~x), ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~m], ~x) && (EqQ(~n2, 2 * ~n) && (IGtQ(~n, 0) && (LtQ(~p, -1) && IntegerQ(~p))))
    @apply_utils Antiderivative((~(f') * ~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) * (~a + ~(b') * (~x) ^ ~n + ~(c') * (~x) ^ ~n2) ^ ~p, ~x) => (~e * (~f) ^ (~n - 1) * (~f * ~x) ^ ((~m - ~n) + 1) * (~a + ~b * (~x) ^ ~n + ~c * (~x) ^ (2 * ~n)) ^ (~p + 1)) / (~c * (~m + ~n * (2 * ~p + 1) + 1)) - ((~f) ^ ~n / (~c * (~m + ~n * (2 * ~p + 1) + 1))) * Antiderivative((~f * ~x) ^ (~m - ~n) * (~a + ~b * (~x) ^ ~n + ~c * (~x) ^ (2 * ~n)) ^ ~p * Simp(~a * ~e * ((~m - ~n) + 1) + (~b * ~e * (~m + ~n * ~p + 1) - ~c * ~d * (~m + ~n * (2 * ~p + 1) + 1)) * (~x) ^ ~n, ~x), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~p], ~x) && (EqQ(~n2, 2 * ~n) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (IGtQ(~n, 0) && (GtQ(~m, ~n - 1) && (NeQ(~m + ~n * (2 * ~p + 1) + 1, 0) && IntegerQ(~p))))))
    @apply_utils Antiderivative((~(f') * ~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) * (~a + ~(c') * (~x) ^ ~n2) ^ ~p, ~x) => (~e * (~f) ^ (~n - 1) * (~f * ~x) ^ ((~m - ~n) + 1) * (~a + ~c * (~x) ^ (2 * ~n)) ^ (~p + 1)) / (~c * (~m + ~n * (2 * ~p + 1) + 1)) - ((~f) ^ ~n / (~c * (~m + ~n * (2 * ~p + 1) + 1))) * Antiderivative((~f * ~x) ^ (~m - ~n) * (~a + ~c * (~x) ^ (2 * ~n)) ^ ~p * (~a * ~e * ((~m - ~n) + 1) - ~c * ~d * (~m + ~n * (2 * ~p + 1) + 1) * (~x) ^ ~n), ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~p], ~x) && (EqQ(~n2, 2 * ~n) && (IGtQ(~n, 0) && (GtQ(~m, ~n - 1) && (NeQ(~m + ~n * (2 * ~p + 1) + 1, 0) && IntegerQ(~p)))))
    @apply_utils Antiderivative((~(f') * ~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) * (~a + ~(b') * (~x) ^ ~n + ~(c') * (~x) ^ ~n2) ^ ~p, ~x) => (~d * (~f * ~x) ^ (~m + 1) * (~a + ~b * (~x) ^ ~n + ~c * (~x) ^ (2 * ~n)) ^ (~p + 1)) / (~a * ~f * (~m + 1)) + (1 / (~a * (~f) ^ ~n * (~m + 1))) * Antiderivative((~f * ~x) ^ (~m + ~n) * (~a + ~b * (~x) ^ ~n + ~c * (~x) ^ (2 * ~n)) ^ ~p * Simp((~a * ~e * (~m + 1) - ~b * ~d * (~m + ~n * (~p + 1) + 1)) - ~c * ~d * (~m + 2 * ~n * (~p + 1) + 1) * (~x) ^ ~n, ~x), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~p], ~x) && (EqQ(~n2, 2 * ~n) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (IGtQ(~n, 0) && (LtQ(~m, -1) && IntegerQ(~p)))))
    @apply_utils Antiderivative((~(f') * ~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) * (~a + ~(c') * (~x) ^ ~n2) ^ ~p, ~x) => (~d * (~f * ~x) ^ (~m + 1) * (~a + ~c * (~x) ^ (2 * ~n)) ^ (~p + 1)) / (~a * ~f * (~m + 1)) + (1 / (~a * (~f) ^ ~n * (~m + 1))) * Antiderivative((~f * ~x) ^ (~m + ~n) * (~a + ~c * (~x) ^ (2 * ~n)) ^ ~p * (~a * ~e * (~m + 1) - ~c * ~d * (~m + 2 * ~n * (~p + 1) + 1) * (~x) ^ ~n), ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~p], ~x) && (EqQ(~n2, 2 * ~n) && (IGtQ(~n, 0) && (LtQ(~m, -1) && IntegerQ(~p))))
    @apply_utils Antiderivative(((~(f') * ~x) ^ ~m * (~d + ~(e') * (~x) ^ ~n)) / (~a + ~(b') * (~x) ^ ~n + ~(c') * (~x) ^ ~n2), ~x) => With([q = Rt(~a * ~c, 2)], With([r = Rt(2 * ~c * q - ~b * ~c, 2)], (~c / (2 * q * r)) * Antiderivative(((~f * ~x) ^ ~m * Simp(~d * r - (~c * ~d - ~e * q) * (~x) ^ (~n / 2), ~x)) / ((q - r * (~x) ^ (~n / 2)) + ~c * (~x) ^ ~n), ~x) + (~c / (2 * q * r)) * Antiderivative(((~f * ~x) ^ ~m * Simp(~d * r + (~c * ~d - ~e * q) * (~x) ^ (~n / 2), ~x)) / (q + r * (~x) ^ (~n / 2) + ~c * (~x) ^ ~n), ~x)) <-- Not(LtQ(2 * ~c * q - ~b * ~c, 0))) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f], ~x) && (EqQ(~n2, 2 * ~n) && (LtQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (IntegersQ(~m, ~n / 2) && (LtQ(0, ~m, ~n) && PosQ(~a * ~c)))))
    @apply_utils Antiderivative(((~(f') * ~x) ^ ~m * (~d + ~(e') * (~x) ^ ~n)) / (~a + ~(c') * (~x) ^ ~n2), ~x) => With([q = Rt(~a * ~c, 2)], With([r = Rt(2 * ~c * q, 2)], (~c / (2 * q * r)) * Antiderivative(((~f * ~x) ^ ~m * Simp(~d * r - (~c * ~d - ~e * q) * (~x) ^ (~n / 2), ~x)) / ((q - r * (~x) ^ (~n / 2)) + ~c * (~x) ^ ~n), ~x) + (~c / (2 * q * r)) * Antiderivative(((~f * ~x) ^ ~m * Simp(~d * r + (~c * ~d - ~e * q) * (~x) ^ (~n / 2), ~x)) / (q + r * (~x) ^ (~n / 2) + ~c * (~x) ^ ~n), ~x)) <-- Not(LtQ(2 * ~c * q, 0))) <-- FreeQ([~a, ~c, ~d, ~e, ~f], ~x) && (EqQ(~n2, 2 * ~n) && (GtQ(~a * ~c, 0) && (IntegersQ(~m, ~n / 2) && LtQ(0, ~m, ~n))))
    @apply_utils Antiderivative(((~(f') * ~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n)) / (~a + ~(b') * (~x) ^ ~n + ~(c') * (~x) ^ ~n2), ~x) => With([q = Rt(~a * ~c, 2)], With([r = Rt(2 * ~c * q - ~b * ~c, 2)], (~c / (2 * q * r)) * Antiderivative(((~f * ~x) ^ ~m * (~d * r - (~c * ~d - ~e * q) * (~x) ^ (~n / 2))) / ((q - r * (~x) ^ (~n / 2)) + ~c * (~x) ^ ~n), ~x) + (~c / (2 * q * r)) * Antiderivative(((~f * ~x) ^ ~m * (~d * r + (~c * ~d - ~e * q) * (~x) ^ (~n / 2))) / (q + r * (~x) ^ (~n / 2) + ~c * (~x) ^ ~n), ~x)) <-- Not(LtQ(2 * ~c * q - ~b * ~c, 0))) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~m], ~x) && (EqQ(~n2, 2 * ~n) && (LtQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (IGtQ(~n / 2, 1) && PosQ(~a * ~c))))
    @apply_utils Antiderivative(((~(f') * ~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n)) / (~a + ~(c') * (~x) ^ ~n2), ~x) => With([q = Rt(~a * ~c, 2)], With([r = Rt(2 * ~c * q, 2)], (~c / (2 * q * r)) * Antiderivative(((~f * ~x) ^ ~m * (~d * r - (~c * ~d - ~e * q) * (~x) ^ (~n / 2))) / ((q - r * (~x) ^ (~n / 2)) + ~c * (~x) ^ ~n), ~x) + (~c / (2 * q * r)) * Antiderivative(((~f * ~x) ^ ~m * (~d * r + (~c * ~d - ~e * q) * (~x) ^ (~n / 2))) / (q + r * (~x) ^ (~n / 2) + ~c * (~x) ^ ~n), ~x)) <-- Not(LtQ(2 * ~c * q, 0))) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~m], ~x) && (EqQ(~n2, 2 * ~n) && (IGtQ(~n / 2, 1) && GtQ(~a * ~c, 0)))
    @apply_utils Antiderivative(((~(f') * ~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n)) / (~a + ~(b') * (~x) ^ ~n + ~(c') * (~x) ^ ~n2), ~x) => With([q = Rt((~b) ^ 2 - 4 * ~a * ~c, 2)], (~e / 2 + (2 * ~c * ~d - ~b * ~e) / (2q)) * Antiderivative((~f * ~x) ^ ~m / ((~b / 2 - q / 2) + ~c * (~x) ^ ~n), ~x) + (~e / 2 - (2 * ~c * ~d - ~b * ~e) / (2q)) * Antiderivative((~f * ~x) ^ ~m / (~b / 2 + q / 2 + ~c * (~x) ^ ~n), ~x)) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~m], ~x) && (EqQ(~n2, 2 * ~n) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && IGtQ(~n, 0)))
    @apply_utils Antiderivative(((~(f') * ~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n)) / (~a + ~(c') * (~x) ^ ~n2), ~x) => With([q = Rt(-(~a) * ~c, 2)], -((~e / 2 + (~c * ~d) / (2q))) * Antiderivative((~f * ~x) ^ ~m / (q - ~c * (~x) ^ ~n), ~x) + (~e / 2 - (~c * ~d) / (2q)) * Antiderivative((~f * ~x) ^ ~m / (q + ~c * (~x) ^ ~n), ~x)) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~m], ~x) && (EqQ(~n2, 2 * ~n) && IGtQ(~n, 0))
    @apply_utils Antiderivative(((~(f') * ~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) ^ ~(q')) / (~a + ~(b') * (~x) ^ ~n + ~(c') * (~x) ^ ~(n2')), ~x) => Antiderivative(ExpandIntegrand(((~f * ~x) ^ ~m * (~d + ~e * (~x) ^ ~n) ^ ~q) / (~a + ~b * (~x) ^ ~n + ~c * (~x) ^ (2 * ~n)), ~x), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~m], ~x) && (EqQ(~n2, 2 * ~n) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (IGtQ(~n, 0) && (IntegerQ(~q) && IntegerQ(~m)))))
    @apply_utils Antiderivative(((~(f') * ~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) ^ ~(q')) / (~a + ~(c') * (~x) ^ ~(n2')), ~x) => Antiderivative(ExpandIntegrand(((~f * ~x) ^ ~m * (~d + ~e * (~x) ^ ~n) ^ ~q) / (~a + ~c * (~x) ^ (2 * ~n)), ~x), ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~m], ~x) && (EqQ(~n2, 2 * ~n) && (IGtQ(~n, 0) && (IntegerQ(~q) && IntegerQ(~m))))
    @apply_utils Antiderivative(((~(f') * ~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) ^ ~(q')) / (~a + ~(b') * (~x) ^ ~n + ~(c') * (~x) ^ ~(n2')), ~x) => Antiderivative(ExpandIntegrand((~f * ~x) ^ ~m, (~d + ~e * (~x) ^ ~n) ^ ~q / (~a + ~b * (~x) ^ ~n + ~c * (~x) ^ (2 * ~n)), ~x), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~m], ~x) && (EqQ(~n2, 2 * ~n) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (IGtQ(~n, 0) && (IntegerQ(~q) && Not(IntegerQ(~m))))))
    @apply_utils Antiderivative(((~(f') * ~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) ^ ~(q')) / (~a + ~(c') * (~x) ^ ~(n2')), ~x) => Antiderivative(ExpandIntegrand((~f * ~x) ^ ~m, (~d + ~e * (~x) ^ ~n) ^ ~q / (~a + ~c * (~x) ^ (2 * ~n)), ~x), ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~m], ~x) && (EqQ(~n2, 2 * ~n) && (IGtQ(~n, 0) && (IntegerQ(~q) && Not(IntegerQ(~m)))))
    @apply_utils Antiderivative(((~(f') * ~x) ^ ~(m') * (~(d') + ~(e') * (~x) ^ ~n) ^ ~q) / (~a + ~(b') * (~x) ^ ~n + ~(c') * (~x) ^ ~(n2')), ~x) => ((~f) ^ (2 * ~n) / (~c) ^ 2) * Antiderivative((~f * ~x) ^ (~m - 2 * ~n) * ((~c * ~d - ~b * ~e) + ~c * ~e * (~x) ^ ~n) * (~d + ~e * (~x) ^ ~n) ^ (~q - 1), ~x) - ((~f) ^ (2 * ~n) / (~c) ^ 2) * Antiderivative(((~f * ~x) ^ (~m - 2 * ~n) * (~d + ~e * (~x) ^ ~n) ^ (~q - 1) * Simp(~a * (~c * ~d - ~b * ~e) + ((~b * ~c * ~d - (~b) ^ 2 * ~e) + ~a * ~c * ~e) * (~x) ^ ~n, ~x)) / (~a + ~b * (~x) ^ ~n + ~c * (~x) ^ (2 * ~n)), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f], ~x) && (EqQ(~n2, 2 * ~n) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (IGtQ(~n, 0) && (Not(IntegerQ(~q)) && (GtQ(~q, 0) && GtQ(~m, 2 * ~n - 1))))))
    @apply_utils Antiderivative(((~(f') * ~x) ^ ~(m') * (~(d') + ~(e') * (~x) ^ ~n) ^ ~q) / (~a + ~(c') * (~x) ^ ~(n2')), ~x) => ((~f) ^ (2 * ~n) / ~c) * Antiderivative((~f * ~x) ^ (~m - 2 * ~n) * (~d + ~e * (~x) ^ ~n) ^ ~q, ~x) - ((~a * (~f) ^ (2 * ~n)) / ~c) * Antiderivative(((~f * ~x) ^ (~m - 2 * ~n) * (~d + ~e * (~x) ^ ~n) ^ ~q) / (~a + ~c * (~x) ^ (2 * ~n)), ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~q], ~x) && (EqQ(~n2, 2 * ~n) && (IGtQ(~n, 0) && (Not(IntegerQ(~q)) && GtQ(~m, 2 * ~n - 1))))
    @apply_utils Antiderivative(((~(f') * ~x) ^ ~(m') * (~(d') + ~(e') * (~x) ^ ~n) ^ ~q) / (~a + ~(b') * (~x) ^ ~n + ~(c') * (~x) ^ ~(n2')), ~x) => ((~e * (~f) ^ ~n) / ~c) * Antiderivative((~f * ~x) ^ (~m - ~n) * (~d + ~e * (~x) ^ ~n) ^ (~q - 1), ~x) - ((~f) ^ ~n / ~c) * Antiderivative(((~f * ~x) ^ (~m - ~n) * (~d + ~e * (~x) ^ ~n) ^ (~q - 1) * Simp(~a * ~e - (~c * ~d - ~b * ~e) * (~x) ^ ~n, ~x)) / (~a + ~b * (~x) ^ ~n + ~c * (~x) ^ (2 * ~n)), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f], ~x) && (EqQ(~n2, 2 * ~n) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (IGtQ(~n, 0) && (Not(IntegerQ(~q)) && (GtQ(~q, 0) && (GtQ(~m, ~n - 1) && LeQ(~m, 2 * ~n - 1)))))))
    @apply_utils Antiderivative(((~(f') * ~x) ^ ~(m') * (~(d') + ~(e') * (~x) ^ ~n) ^ ~q) / (~a + ~(c') * (~x) ^ ~(n2')), ~x) => ((~e * (~f) ^ ~n) / ~c) * Antiderivative((~f * ~x) ^ (~m - ~n) * (~d + ~e * (~x) ^ ~n) ^ (~q - 1), ~x) - ((~f) ^ ~n / ~c) * Antiderivative(((~f * ~x) ^ (~m - ~n) * (~d + ~e * (~x) ^ ~n) ^ (~q - 1) * Simp(~a * ~e - ~c * ~d * (~x) ^ ~n, ~x)) / (~a + ~c * (~x) ^ (2 * ~n)), ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f], ~x) && (EqQ(~n2, 2 * ~n) && (IGtQ(~n, 0) && (Not(IntegerQ(~q)) && (GtQ(~q, 0) && (GtQ(~m, ~n - 1) && LeQ(~m, 2 * ~n - 1))))))
    @apply_utils Antiderivative(((~(f') * ~x) ^ ~m * (~(d') + ~(e') * (~x) ^ ~n) ^ ~q) / (~a + ~(b') * (~x) ^ ~n + ~(c') * (~x) ^ ~(n2')), ~x) => (~d / ~a) * Antiderivative((~f * ~x) ^ ~m * (~d + ~e * (~x) ^ ~n) ^ (~q - 1), ~x) - (1 / (~a * (~f) ^ ~n)) * Antiderivative(((~f * ~x) ^ (~m + ~n) * (~d + ~e * (~x) ^ ~n) ^ (~q - 1) * Simp((~b * ~d - ~a * ~e) + ~c * ~d * (~x) ^ ~n, ~x)) / (~a + ~b * (~x) ^ ~n + ~c * (~x) ^ (2 * ~n)), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f], ~x) && (EqQ(~n2, 2 * ~n) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (IGtQ(~n, 0) && (Not(IntegerQ(~q)) && (GtQ(~q, 0) && LtQ(~m, 0))))))
    @apply_utils Antiderivative(((~(f') * ~x) ^ ~m * (~(d') + ~(e') * (~x) ^ ~n) ^ ~q) / (~a + ~(c') * (~x) ^ ~(n2')), ~x) => (~d / ~a) * Antiderivative((~f * ~x) ^ ~m * (~d + ~e * (~x) ^ ~n) ^ (~q - 1), ~x) + (1 / (~a * (~f) ^ ~n)) * Antiderivative(((~f * ~x) ^ (~m + ~n) * (~d + ~e * (~x) ^ ~n) ^ (~q - 1) * Simp(~a * ~e - ~c * ~d * (~x) ^ ~n, ~x)) / (~a + ~c * (~x) ^ (2 * ~n)), ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f], ~x) && (EqQ(~n2, 2 * ~n) && (IGtQ(~n, 0) && (Not(IntegerQ(~q)) && (GtQ(~q, 0) && LtQ(~m, 0)))))
    @apply_utils Antiderivative(((~(f') * ~x) ^ ~(m') * (~(d') + ~(e') * (~x) ^ ~n) ^ ~q) / (~a + ~(b') * (~x) ^ ~n + ~(c') * (~x) ^ ~(n2')), ~x) => (((~d) ^ 2 * (~f) ^ (2 * ~n)) / ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2)) * Antiderivative((~f * ~x) ^ (~m - 2 * ~n) * (~d + ~e * (~x) ^ ~n) ^ ~q, ~x) - ((~f) ^ (2 * ~n) / ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2)) * Antiderivative(((~f * ~x) ^ (~m - 2 * ~n) * (~d + ~e * (~x) ^ ~n) ^ (~q + 1) * Simp(~a * ~d + (~b * ~d - ~a * ~e) * (~x) ^ ~n, ~x)) / (~a + ~b * (~x) ^ ~n + ~c * (~x) ^ (2 * ~n)), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f], ~x) && (EqQ(~n2, 2 * ~n) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (IGtQ(~n, 0) && (Not(IntegerQ(~q)) && (LtQ(~q, -1) && GtQ(~m, 2 * ~n - 1))))))
    @apply_utils Antiderivative(((~(f') * ~x) ^ ~(m') * (~(d') + ~(e') * (~x) ^ ~n) ^ ~q) / (~a + ~(c') * (~x) ^ ~(n2')), ~x) => (((~d) ^ 2 * (~f) ^ (2 * ~n)) / (~c * (~d) ^ 2 + ~a * (~e) ^ 2)) * Antiderivative((~f * ~x) ^ (~m - 2 * ~n) * (~d + ~e * (~x) ^ ~n) ^ ~q, ~x) - ((~a * (~f) ^ (2 * ~n)) / (~c * (~d) ^ 2 + ~a * (~e) ^ 2)) * Antiderivative(((~f * ~x) ^ (~m - 2 * ~n) * (~d + ~e * (~x) ^ ~n) ^ (~q + 1) * (~d - ~e * (~x) ^ ~n)) / (~a + ~c * (~x) ^ (2 * ~n)), ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f], ~x) && (EqQ(~n2, 2 * ~n) && (IGtQ(~n, 0) && (Not(IntegerQ(~q)) && (LtQ(~q, -1) && GtQ(~m, 2 * ~n - 1)))))
    @apply_utils Antiderivative(((~(f') * ~x) ^ ~(m') * (~(d') + ~(e') * (~x) ^ ~n) ^ ~q) / (~a + ~(b') * (~x) ^ ~n + ~(c') * (~x) ^ ~(n2')), ~x) => ((-(~d) * ~e * (~f) ^ ~n) / ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2)) * Antiderivative((~f * ~x) ^ (~m - ~n) * (~d + ~e * (~x) ^ ~n) ^ ~q, ~x) + ((~f) ^ ~n / ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2)) * Antiderivative(((~f * ~x) ^ (~m - ~n) * (~d + ~e * (~x) ^ ~n) ^ (~q + 1) * Simp(~a * ~e + ~c * ~d * (~x) ^ ~n, ~x)) / (~a + ~b * (~x) ^ ~n + ~c * (~x) ^ (2 * ~n)), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f], ~x) && (EqQ(~n2, 2 * ~n) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (IGtQ(~n, 0) && (Not(IntegerQ(~q)) && (LtQ(~q, -1) && (GtQ(~m, ~n - 1) && LeQ(~m, 2 * ~n - 1)))))))
    @apply_utils Antiderivative(((~(f') * ~x) ^ ~(m') * (~(d') + ~(e') * (~x) ^ ~n) ^ ~q) / (~a + ~(c') * (~x) ^ ~(n2')), ~x) => ((-(~d) * ~e * (~f) ^ ~n) / (~c * (~d) ^ 2 + ~a * (~e) ^ 2)) * Antiderivative((~f * ~x) ^ (~m - ~n) * (~d + ~e * (~x) ^ ~n) ^ ~q, ~x) + ((~f) ^ ~n / (~c * (~d) ^ 2 + ~a * (~e) ^ 2)) * Antiderivative(((~f * ~x) ^ (~m - ~n) * (~d + ~e * (~x) ^ ~n) ^ (~q + 1) * Simp(~a * ~e + ~c * ~d * (~x) ^ ~n, ~x)) / (~a + ~c * (~x) ^ (2 * ~n)), ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f], ~x) && (EqQ(~n2, 2 * ~n) && (IGtQ(~n, 0) && (Not(IntegerQ(~q)) && (LtQ(~q, -1) && (GtQ(~m, ~n - 1) && LeQ(~m, 2 * ~n - 1))))))
    @apply_utils Antiderivative(((~(f') * ~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) ^ ~q) / (~a + ~(b') * (~x) ^ ~n + ~(c') * (~x) ^ ~n2), ~x) => ((~e) ^ 2 / ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2)) * Antiderivative((~f * ~x) ^ ~m * (~d + ~e * (~x) ^ ~n) ^ ~q, ~x) + (1 / ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2)) * Antiderivative(((~f * ~x) ^ ~m * (~d + ~e * (~x) ^ ~n) ^ (~q + 1) * Simp((~c * ~d - ~b * ~e) - ~c * ~e * (~x) ^ ~n, ~x)) / (~a + ~b * (~x) ^ ~n + ~c * (~x) ^ (2 * ~n)), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~m], ~x) && (EqQ(~n2, 2 * ~n) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (IGtQ(~n, 0) && (Not(IntegerQ(~q)) && LtQ(~q, -1)))))
    @apply_utils Antiderivative(((~(f') * ~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) ^ ~q) / (~a + ~(c') * (~x) ^ ~n2), ~x) => ((~e) ^ 2 / (~c * (~d) ^ 2 + ~a * (~e) ^ 2)) * Antiderivative((~f * ~x) ^ ~m * (~d + ~e * (~x) ^ ~n) ^ ~q, ~x) + (~c / (~c * (~d) ^ 2 + ~a * (~e) ^ 2)) * Antiderivative(((~f * ~x) ^ ~m * (~d + ~e * (~x) ^ ~n) ^ (~q + 1) * (~d - ~e * (~x) ^ ~n)) / (~a + ~c * (~x) ^ (2 * ~n)), ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~m], ~x) && (EqQ(~n2, 2 * ~n) && (IGtQ(~n, 0) && (Not(IntegerQ(~q)) && LtQ(~q, -1))))
    @apply_utils Antiderivative(((~(f') * ~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) ^ ~q) / (~a + ~(b') * (~x) ^ ~n + ~(c') * (~x) ^ ~(n2')), ~x) => Antiderivative(ExpandIntegrand((~d + ~e * (~x) ^ ~n) ^ ~q, (~f * ~x) ^ ~m / (~a + ~b * (~x) ^ ~n + ~c * (~x) ^ (2 * ~n)), ~x), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~q, ~n], ~x) && (EqQ(~n2, 2 * ~n) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (IGtQ(~n, 0) && (Not(IntegerQ(~q)) && IntegerQ(~m)))))
    @apply_utils Antiderivative(((~(f') * ~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) ^ ~q) / (~a + ~(c') * (~x) ^ ~(n2')), ~x) => Antiderivative(ExpandIntegrand((~d + ~e * (~x) ^ ~n) ^ ~q, (~f * ~x) ^ ~m / (~a + ~c * (~x) ^ (2 * ~n)), ~x), ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~q, ~n], ~x) && (EqQ(~n2, 2 * ~n) && (IGtQ(~n, 0) && (Not(IntegerQ(~q)) && IntegerQ(~m))))
    @apply_utils Antiderivative(((~(f') * ~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) ^ ~q) / (~a + ~(b') * (~x) ^ ~n + ~(c') * (~x) ^ ~(n2')), ~x) => Antiderivative(ExpandIntegrand((~f * ~x) ^ ~m * (~d + ~e * (~x) ^ ~n) ^ ~q, 1 / (~a + ~b * (~x) ^ ~n + ~c * (~x) ^ (2 * ~n)), ~x), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~m, ~q, ~n], ~x) && (EqQ(~n2, 2 * ~n) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (IGtQ(~n, 0) && (Not(IntegerQ(~q)) && Not(IntegerQ(~m))))))
    @apply_utils Antiderivative(((~(f') * ~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) ^ ~q) / (~a + ~(c') * (~x) ^ ~(n2')), ~x) => Antiderivative(ExpandIntegrand((~f * ~x) ^ ~m * (~d + ~e * (~x) ^ ~n) ^ ~q, 1 / (~a + ~c * (~x) ^ (2 * ~n)), ~x), ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~m, ~q, ~n], ~x) && (EqQ(~n2, 2 * ~n) && (IGtQ(~n, 0) && (Not(IntegerQ(~q)) && Not(IntegerQ(~m)))))
    @apply_utils Antiderivative(((~(f') * ~x) ^ ~m * (~(a') + ~(b') * (~x) ^ ~n + ~(c') * (~x) ^ ~(n2')) ^ ~(p')) / (~(d') + ~(e') * (~x) ^ ~n), ~x) => (1 / (~d) ^ 2) * Antiderivative((~f * ~x) ^ ~m * (~a * ~d + (~b * ~d - ~a * ~e) * (~x) ^ ~n) * (~a + ~b * (~x) ^ ~n + ~c * (~x) ^ (2 * ~n)) ^ (~p - 1), ~x) + (((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2) / ((~d) ^ 2 * (~f) ^ (2 * ~n))) * Antiderivative(((~f * ~x) ^ (~m + 2 * ~n) * (~a + ~b * (~x) ^ ~n + ~c * (~x) ^ (2 * ~n)) ^ (~p - 1)) / (~d + ~e * (~x) ^ ~n), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f], ~x) && (EqQ(~n2, 2 * ~n) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (IGtQ(~n, 0) && (GtQ(~p, 0) && LtQ(~m, -(~n))))))
    @apply_utils Antiderivative(((~(f') * ~x) ^ ~m * (~a + ~(c') * (~x) ^ ~(n2')) ^ ~(p')) / (~(d') + ~(e') * (~x) ^ ~n), ~x) => (~a / (~d) ^ 2) * Antiderivative((~f * ~x) ^ ~m * (~d - ~e * (~x) ^ ~n) * (~a + ~c * (~x) ^ (2 * ~n)) ^ (~p - 1), ~x) + ((~c * (~d) ^ 2 + ~a * (~e) ^ 2) / ((~d) ^ 2 * (~f) ^ (2 * ~n))) * Antiderivative(((~f * ~x) ^ (~m + 2 * ~n) * (~a + ~c * (~x) ^ (2 * ~n)) ^ (~p - 1)) / (~d + ~e * (~x) ^ ~n), ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f], ~x) && (EqQ(~n2, 2 * ~n) && (IGtQ(~n, 0) && (GtQ(~p, 0) && LtQ(~m, -(~n)))))
    @apply_utils Antiderivative(((~(f') * ~x) ^ ~m * (~(a') + ~(b') * (~x) ^ ~n + ~(c') * (~x) ^ ~(n2')) ^ ~(p')) / (~(d') + ~(e') * (~x) ^ ~n), ~x) => (1 / (~d * ~e)) * Antiderivative((~f * ~x) ^ ~m * (~a * ~e + ~c * ~d * (~x) ^ ~n) * (~a + ~b * (~x) ^ ~n + ~c * (~x) ^ (2 * ~n)) ^ (~p - 1), ~x) - (((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2) / (~d * ~e * (~f) ^ ~n)) * Antiderivative(((~f * ~x) ^ (~m + ~n) * (~a + ~b * (~x) ^ ~n + ~c * (~x) ^ (2 * ~n)) ^ (~p - 1)) / (~d + ~e * (~x) ^ ~n), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f], ~x) && (EqQ(~n2, 2 * ~n) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (IGtQ(~n, 0) && (GtQ(~p, 0) && LtQ(~m, 0)))))
    @apply_utils Antiderivative(((~(f') * ~x) ^ ~m * (~a + ~(c') * (~x) ^ ~(n2')) ^ ~(p')) / (~(d') + ~(e') * (~x) ^ ~n), ~x) => (1 / (~d * ~e)) * Antiderivative((~f * ~x) ^ ~m * (~a * ~e + ~c * ~d * (~x) ^ ~n) * (~a + ~c * (~x) ^ (2 * ~n)) ^ (~p - 1), ~x) - ((~c * (~d) ^ 2 + ~a * (~e) ^ 2) / (~d * ~e * (~f) ^ ~n)) * Antiderivative(((~f * ~x) ^ (~m + ~n) * (~a + ~c * (~x) ^ (2 * ~n)) ^ (~p - 1)) / (~d + ~e * (~x) ^ ~n), ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f], ~x) && (EqQ(~n2, 2 * ~n) && (IGtQ(~n, 0) && (GtQ(~p, 0) && LtQ(~m, 0))))
    @apply_utils Antiderivative(((~(f') * ~x) ^ ~(m') * (~(a') + ~(b') * (~x) ^ ~n + ~(c') * (~x) ^ ~(n2')) ^ ~p) / (~(d') + ~(e') * (~x) ^ ~n), ~x) => (-((~f) ^ (2 * ~n)) / ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2)) * Antiderivative((~f * ~x) ^ (~m - 2 * ~n) * (~a * ~d + (~b * ~d - ~a * ~e) * (~x) ^ ~n) * (~a + ~b * (~x) ^ ~n + ~c * (~x) ^ (2 * ~n)) ^ ~p, ~x) + (((~d) ^ 2 * (~f) ^ (2 * ~n)) / ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2)) * Antiderivative(((~f * ~x) ^ (~m - 2 * ~n) * (~a + ~b * (~x) ^ ~n + ~c * (~x) ^ (2 * ~n)) ^ (~p + 1)) / (~d + ~e * (~x) ^ ~n), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f], ~x) && (EqQ(~n2, 2 * ~n) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (IGtQ(~n, 0) && (LtQ(~p, -1) && GtQ(~m, ~n)))))
    @apply_utils Antiderivative(((~(f') * ~x) ^ ~(m') * (~a + ~(c') * (~x) ^ ~(n2')) ^ ~p) / (~(d') + ~(e') * (~x) ^ ~n), ~x) => ((-(~a) * (~f) ^ (2 * ~n)) / (~c * (~d) ^ 2 + ~a * (~e) ^ 2)) * Antiderivative((~f * ~x) ^ (~m - 2 * ~n) * (~d - ~e * (~x) ^ ~n) * (~a + ~c * (~x) ^ (2 * ~n)) ^ ~p, ~x) + (((~d) ^ 2 * (~f) ^ (2 * ~n)) / (~c * (~d) ^ 2 + ~a * (~e) ^ 2)) * Antiderivative(((~f * ~x) ^ (~m - 2 * ~n) * (~a + ~c * (~x) ^ (2 * ~n)) ^ (~p + 1)) / (~d + ~e * (~x) ^ ~n), ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f], ~x) && (EqQ(~n2, 2 * ~n) && (IGtQ(~n, 0) && (LtQ(~p, -1) && GtQ(~m, ~n))))
    @apply_utils Antiderivative(((~(f') * ~x) ^ ~(m') * (~(a') + ~(b') * (~x) ^ ~n + ~(c') * (~x) ^ ~(n2')) ^ ~p) / (~(d') + ~(e') * (~x) ^ ~n), ~x) => ((~f) ^ ~n / ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2)) * Antiderivative((~f * ~x) ^ (~m - ~n) * (~a * ~e + ~c * ~d * (~x) ^ ~n) * (~a + ~b * (~x) ^ ~n + ~c * (~x) ^ (2 * ~n)) ^ ~p, ~x) - ((~d * ~e * (~f) ^ ~n) / ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2)) * Antiderivative(((~f * ~x) ^ (~m - ~n) * (~a + ~b * (~x) ^ ~n + ~c * (~x) ^ (2 * ~n)) ^ (~p + 1)) / (~d + ~e * (~x) ^ ~n), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f], ~x) && (EqQ(~n2, 2 * ~n) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (IGtQ(~n, 0) && (LtQ(~p, -1) && GtQ(~m, 0)))))
    @apply_utils Antiderivative(((~(f') * ~x) ^ ~(m') * (~a + ~(c') * (~x) ^ ~(n2')) ^ ~p) / (~(d') + ~(e') * (~x) ^ ~n), ~x) => ((~f) ^ ~n / (~c * (~d) ^ 2 + ~a * (~e) ^ 2)) * Antiderivative((~f * ~x) ^ (~m - ~n) * (~a * ~e + ~c * ~d * (~x) ^ ~n) * (~a + ~c * (~x) ^ (2 * ~n)) ^ ~p, ~x) - ((~d * ~e * (~f) ^ ~n) / (~c * (~d) ^ 2 + ~a * (~e) ^ 2)) * Antiderivative(((~f * ~x) ^ (~m - ~n) * (~a + ~c * (~x) ^ (2 * ~n)) ^ (~p + 1)) / (~d + ~e * (~x) ^ ~n), ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f], ~x) && (EqQ(~n2, 2 * ~n) && (IGtQ(~n, 0) && (LtQ(~p, -1) && GtQ(~m, 0))))
    @apply_utils Antiderivative((~(f') * ~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) ^ ~(q') * (~a + ~(b') * (~x) ^ ~n + ~(c') * (~x) ^ ~(n2')) ^ ~(p'), ~x) => Antiderivative(ExpandIntegrand((~a + ~b * (~x) ^ ~n + ~c * (~x) ^ (2 * ~n)) ^ ~p, (~f * ~x) ^ ~m * (~d + ~e * (~x) ^ ~n) ^ ~q, ~x), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~m, ~q], ~x) && (EqQ(~n2, 2 * ~n) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (IGtQ(~n, 0) && (IGtQ(~q, 0) || IntegersQ(~m, ~q)))))
    @apply_utils Antiderivative((~(f') * ~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) ^ ~(q') * (~a + ~(c') * (~x) ^ ~(n2')) ^ ~(p'), ~x) => Antiderivative(ExpandIntegrand((~a + ~c * (~x) ^ (2 * ~n)) ^ ~p, (~f * ~x) ^ ~m * (~d + ~e * (~x) ^ ~n) ^ ~q, ~x), ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~m, ~q], ~x) && (EqQ(~n2, 2 * ~n) && (IGtQ(~n, 0) && IGtQ(~q, 0)))
    @apply_utils Antiderivative((~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) ^ ~(q') * (~a + ~(b') * (~x) ^ ~n + ~(c') * (~x) ^ ~(n2')) ^ ~p, ~x) => -(Subst(Antiderivative(((~d + ~e * (~x) ^ -(~n)) ^ ~q * (~a + ~b * (~x) ^ -(~n) + ~c * (~x) ^ (-2 * ~n)) ^ ~p) / (~x) ^ (~m + 2), ~x), ~x, 1 / ~x)) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~p, ~q], ~x) && (EqQ(~n2, 2 * ~n) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (ILtQ(~n, 0) && IntegerQ(~m))))
    @apply_utils Antiderivative((~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) ^ ~(q') * (~a + ~(c') * (~x) ^ ~(n2')) ^ ~p, ~x) => -(Subst(Antiderivative(((~d + ~e * (~x) ^ -(~n)) ^ ~q * (~a + ~c * (~x) ^ (-2 * ~n)) ^ ~p) / (~x) ^ (~m + 2), ~x), ~x, 1 / ~x)) <-- FreeQ([~a, ~c, ~d, ~e, ~p, ~q], ~x) && (EqQ(~n2, 2 * ~n) && (ILtQ(~n, 0) && IntegerQ(~m)))
    @apply_utils Antiderivative((~(f') * ~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) ^ ~(q') * (~a + ~(b') * (~x) ^ ~n + ~(c') * (~x) ^ ~(n2')) ^ ~p, ~x) => With([g = Denominator(~m)], (-g / ~f) * Subst(Antiderivative(((~d + ~e * (~f) ^ -(~n) * (~x) ^ (-g * ~n)) ^ ~q * (~a + ~b * (~f) ^ -(~n) * (~x) ^ (-g * ~n) + ~c * (~f) ^ (-2 * ~n) * (~x) ^ (-2 * g * ~n)) ^ ~p) / (~x) ^ (g * (~m + 1) + 1), ~x), ~x, 1 / (~f * ~x) ^ (1 / g))) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~p, ~q], ~x) && (EqQ(~n2, 2 * ~n) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (ILtQ(~n, 0) && FractionQ(~m))))
    @apply_utils Antiderivative((~(f') * ~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) ^ ~(q') * (~a + ~(c') * (~x) ^ ~(n2')) ^ ~p, ~x) => With([g = Denominator(~m)], (-g / ~f) * Subst(Antiderivative(((~d + ~e * (~f) ^ -(~n) * (~x) ^ (-g * ~n)) ^ ~q * (~a + ~c * (~f) ^ (-2 * ~n) * (~x) ^ (-2 * g * ~n)) ^ ~p) / (~x) ^ (g * (~m + 1) + 1), ~x), ~x, 1 / (~f * ~x) ^ (1 / g))) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~p, ~q], ~x) && (EqQ(~n2, 2 * ~n) && (ILtQ(~n, 0) && FractionQ(~m)))
    @apply_utils Antiderivative((~(f') * ~x) ^ ~m * (~d + ~(e') * (~x) ^ ~n) ^ ~(q') * (~a + ~(b') * (~x) ^ ~n + ~(c') * (~x) ^ ~(n2')) ^ ~p, ~x) => -((~f) ^ IntPart(~m)) * (~f * ~x) ^ FracPart(~m) * ((~x) ^ -1) ^ FracPart(~m) * Subst(Antiderivative(((~d + ~e * (~x) ^ -(~n)) ^ ~q * (~a + ~b * (~x) ^ -(~n) + ~c * (~x) ^ (-2 * ~n)) ^ ~p) / (~x) ^ (~m + 2), ~x), ~x, 1 / ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~m, ~p, ~q], ~x) && (EqQ(~n2, 2 * ~n) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (ILtQ(~n, 0) && Not(RationalQ(~m)))))
    @apply_utils Antiderivative((~(f') * ~x) ^ ~m * (~d + ~(e') * (~x) ^ ~n) ^ ~(q') * (~a + ~(c') * (~x) ^ ~(n2')) ^ ~p, ~x) => -((~f) ^ IntPart(~m)) * (~f * ~x) ^ FracPart(~m) * ((~x) ^ -1) ^ FracPart(~m) * Subst(Antiderivative(((~d + ~e * (~x) ^ -(~n)) ^ ~q * (~a + ~c * (~x) ^ (-2 * ~n)) ^ ~p) / (~x) ^ (~m + 2), ~x), ~x, 1 / ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~m, ~p, ~q], ~x) && (EqQ(~n2, 2 * ~n) && (ILtQ(~n, 0) && Not(RationalQ(~m))))
    @apply_utils Antiderivative((~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) ^ ~(q') * (~a + ~(b') * (~x) ^ ~n + ~(c') * (~x) ^ ~(n2')) ^ ~p, ~x) => With([g = Denominator(~n)], g * Subst(Antiderivative((~x) ^ (g * (~m + 1) - 1) * (~d + ~e * (~x) ^ (g * ~n)) ^ ~q * (~a + ~b * (~x) ^ (g * ~n) + ~c * (~x) ^ (2 * g * ~n)) ^ ~p, ~x), ~x, (~x) ^ (1 / g))) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~m, ~p, ~q], ~x) && (EqQ(~n2, 2 * ~n) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && FractionQ(~n)))
    @apply_utils Antiderivative((~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) ^ ~(q') * (~a + ~(c') * (~x) ^ ~(n2')) ^ ~p, ~x) => With([g = Denominator(~n)], g * Subst(Antiderivative((~x) ^ (g * (~m + 1) - 1) * (~d + ~e * (~x) ^ (g * ~n)) ^ ~q * (~a + ~c * (~x) ^ (2 * g * ~n)) ^ ~p, ~x), ~x, (~x) ^ (1 / g))) <-- FreeQ([~a, ~c, ~d, ~e, ~m, ~p, ~q], ~x) && (EqQ(~n2, 2 * ~n) && FractionQ(~n))
    @apply_utils Antiderivative((~f * ~x) ^ ~m * (~d + ~(e') * (~x) ^ ~n) ^ ~(q') * (~a + ~(b') * (~x) ^ ~n + ~(c') * (~x) ^ ~(n2')) ^ ~p, ~x) => (((~f) ^ IntPart(~m) * (~f * ~x) ^ FracPart(~m)) / (~x) ^ FracPart(~m)) * Antiderivative((~x) ^ ~m * (~d + ~e * (~x) ^ ~n) ^ ~q * (~a + ~b * (~x) ^ ~n + ~c * (~x) ^ (2 * ~n)) ^ ~p, ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~m, ~p, ~q], ~x) && (EqQ(~n2, 2 * ~n) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && FractionQ(~n)))
    @apply_utils Antiderivative((~f * ~x) ^ ~m * (~d + ~(e') * (~x) ^ ~n) ^ ~(q') * (~a + ~(c') * (~x) ^ ~(n2')) ^ ~p, ~x) => (((~f) ^ IntPart(~m) * (~f * ~x) ^ FracPart(~m)) / (~x) ^ FracPart(~m)) * Antiderivative((~x) ^ ~m * (~d + ~e * (~x) ^ ~n) ^ ~q * (~a + ~c * (~x) ^ (2 * ~n)) ^ ~p, ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~m, ~p, ~q], ~x) && (EqQ(~n2, 2 * ~n) && FractionQ(~n))
    @apply_utils Antiderivative((~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) ^ ~(q') * (~a + ~(b') * (~x) ^ ~n + ~(c') * (~x) ^ ~(n2')) ^ ~p, ~x) => (1 / (~m + 1)) * Subst(Antiderivative((~d + ~e * (~x) ^ Simplify(~n / (~m + 1))) ^ ~q * (~a + ~b * (~x) ^ Simplify(~n / (~m + 1)) + ~c * (~x) ^ Simplify((2 * ~n) / (~m + 1))) ^ ~p, ~x), ~x, (~x) ^ (~m + 1)) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~m, ~n, ~p, ~q], ~x) && (EqQ(~n2, 2 * ~n) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (IntegerQ(Simplify(~n / (~m + 1))) && Not(IntegerQ(~n)))))
    @apply_utils Antiderivative((~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) ^ ~(q') * (~a + ~(c') * (~x) ^ ~(n2')) ^ ~p, ~x) => (1 / (~m + 1)) * Subst(Antiderivative((~d + ~e * (~x) ^ Simplify(~n / (~m + 1))) ^ ~q * (~a + ~c * (~x) ^ Simplify((2 * ~n) / (~m + 1))) ^ ~p, ~x), ~x, (~x) ^ (~m + 1)) <-- FreeQ([~a, ~c, ~d, ~e, ~m, ~n, ~p, ~q], ~x) && (EqQ(~n2, 2 * ~n) && (IntegerQ(Simplify(~n / (~m + 1))) && Not(IntegerQ(~n))))
    @apply_utils Antiderivative((~f * ~x) ^ ~m * (~d + ~(e') * (~x) ^ ~n) ^ ~(q') * (~a + ~(b') * (~x) ^ ~n + ~(c') * (~x) ^ ~(n2')) ^ ~p, ~x) => (((~f) ^ IntPart(~m) * (~f * ~x) ^ FracPart(~m)) / (~x) ^ FracPart(~m)) * Antiderivative((~x) ^ ~m * (~d + ~e * (~x) ^ ~n) ^ ~q * (~a + ~b * (~x) ^ ~n + ~c * (~x) ^ (2 * ~n)) ^ ~p, ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~m, ~p, ~q], ~x) && (EqQ(~n2, 2 * ~n) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (IntegerQ(Simplify(~n / (~m + 1))) && Not(IntegerQ(~n)))))
    @apply_utils Antiderivative((~f * ~x) ^ ~m * (~d + ~(e') * (~x) ^ ~n) ^ ~(q') * (~a + ~(c') * (~x) ^ ~(n2')) ^ ~p, ~x) => (((~f) ^ IntPart(~m) * (~f * ~x) ^ FracPart(~m)) / (~x) ^ FracPart(~m)) * Antiderivative((~x) ^ ~m * (~d + ~e * (~x) ^ ~n) ^ ~q * (~a + ~c * (~x) ^ (2 * ~n)) ^ ~p, ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~m, ~p, ~q], ~x) && (EqQ(~n2, 2 * ~n) && (IntegerQ(Simplify(~n / (~m + 1))) && Not(IntegerQ(~n))))
    @apply_utils Antiderivative(((~(f') * ~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) ^ ~q) / (~a + ~(b') * (~x) ^ ~n + ~(c') * (~x) ^ ~(n2')), ~x) => With([r = Rt((~b) ^ 2 - 4 * ~a * ~c, 2)], ((2 * ~c) / r) * Antiderivative(((~f * ~x) ^ ~m * (~d + ~e * (~x) ^ ~n) ^ ~q) / ((~b - r) + 2 * ~c * (~x) ^ ~n), ~x) - ((2 * ~c) / r) * Antiderivative(((~f * ~x) ^ ~m * (~d + ~e * (~x) ^ ~n) ^ ~q) / (~b + r + 2 * ~c * (~x) ^ ~n), ~x)) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~m, ~n, ~q], ~x) && (EqQ(~n2, 2 * ~n) && NeQ((~b) ^ 2 - 4 * ~a * ~c, 0))
    @apply_utils Antiderivative(((~(f') * ~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) ^ ~q) / (~a + ~(c') * (~x) ^ ~(n2')), ~x) => With([r = Rt(-(~a) * ~c, 2)], (-(~c) / (2r)) * Antiderivative(((~f * ~x) ^ ~m * (~d + ~e * (~x) ^ ~n) ^ ~q) / (r - ~c * (~x) ^ ~n), ~x) - (~c / (2r)) * Antiderivative(((~f * ~x) ^ ~m * (~d + ~e * (~x) ^ ~n) ^ ~q) / (r + ~c * (~x) ^ ~n), ~x)) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~m, ~n, ~q], ~x) && EqQ(~n2, 2 * ~n)
    @apply_utils Antiderivative((~(f') * ~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) * (~a + ~(b') * (~x) ^ ~n + ~(c') * (~x) ^ ~n2) ^ ~p, ~x) => (-((~f * ~x) ^ (~m + 1)) * (~a + ~b * (~x) ^ ~n + ~c * (~x) ^ (2 * ~n)) ^ (~p + 1) * ((~d * ((~b) ^ 2 - 2 * ~a * ~c) - ~a * ~b * ~e) + (~b * ~d - 2 * ~a * ~e) * ~c * (~x) ^ ~n)) / (~a * ~f * ~n * (~p + 1) * ((~b) ^ 2 - 4 * ~a * ~c)) + (1 / (~a * ~n * (~p + 1) * ((~b) ^ 2 - 4 * ~a * ~c))) * Antiderivative((~f * ~x) ^ ~m * (~a + ~b * (~x) ^ ~n + ~c * (~x) ^ (2 * ~n)) ^ (~p + 1) * Simp((~d * ((~b) ^ 2 * (~m + ~n * (~p + 1) + 1) - 2 * ~a * ~c * (~m + 2 * ~n * (~p + 1) + 1)) - ~a * ~b * ~e * (~m + 1)) + (~m + ~n * (2 * ~p + 3) + 1) * (~b * ~d - 2 * ~a * ~e) * ~c * (~x) ^ ~n, ~x), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~m, ~n], ~x) && (EqQ(~n2, 2 * ~n) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && ILtQ(~p + 1, 0)))
    @apply_utils Antiderivative((~(f') * ~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) * (~a + ~(c') * (~x) ^ ~n2) ^ ~p, ~x) => (-((~f * ~x) ^ (~m + 1)) * (~a + ~c * (~x) ^ (2 * ~n)) ^ (~p + 1) * (~d + ~e * (~x) ^ ~n)) / (2 * ~a * ~f * ~n * (~p + 1)) + (1 / (2 * ~a * ~n * (~p + 1))) * Antiderivative((~f * ~x) ^ ~m * (~a + ~c * (~x) ^ (2 * ~n)) ^ (~p + 1) * Simp(~d * (~m + 2 * ~n * (~p + 1) + 1) + ~e * (~m + ~n * (2 * ~p + 3) + 1) * (~x) ^ ~n, ~x), ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~m, ~n], ~x) && (EqQ(~n2, 2 * ~n) && ILtQ(~p + 1, 0))
    @apply_utils Antiderivative((~(f') * ~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) ^ ~(q') * (~a + ~(b') * (~x) ^ ~n + ~(c') * (~x) ^ ~(n2')) ^ ~(p'), ~x) => Antiderivative(ExpandIntegrand((~f * ~x) ^ ~m * (~d + ~e * (~x) ^ ~n) ^ ~q * (~a + ~b * (~x) ^ ~n + ~c * (~x) ^ (2 * ~n)) ^ ~p, ~x), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~m, ~n, ~p, ~q], ~x) && (EqQ(~n2, 2 * ~n) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (IGtQ(~p, 0) || IGtQ(~q, 0))))
    @apply_utils Antiderivative((~(f') * ~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) ^ ~(q') * (~a + ~(c') * (~x) ^ ~(n2')) ^ ~(p'), ~x) => Antiderivative(ExpandIntegrand((~f * ~x) ^ ~m * (~d + ~e * (~x) ^ ~n) ^ ~q * (~a + ~c * (~x) ^ (2 * ~n)) ^ ~p, ~x), ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~m, ~n, ~p, ~q], ~x) && (EqQ(~n2, 2 * ~n) && (IGtQ(~p, 0) || IGtQ(~q, 0)))
    @apply_utils Antiderivative((~(f') * ~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) ^ ~q * (~a + ~(c') * (~x) ^ ~n2) ^ ~p, ~x) => ((~f * ~x) ^ ~m / (~x) ^ ~m) * Antiderivative(ExpandIntegrand((~x) ^ ~m * (~a + ~c * (~x) ^ (2 * ~n)) ^ ~p, (~d / ((~d) ^ 2 - (~e) ^ 2 * (~x) ^ (2 * ~n)) - (~e * (~x) ^ ~n) / ((~d) ^ 2 - (~e) ^ 2 * (~x) ^ (2 * ~n))) ^ -(~q), ~x), ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~m, ~n, ~p], ~x) && (EqQ(~n2, 2 * ~n) && (Not(IntegerQ(~p)) && ILtQ(~q, 0)))
    @apply_utils Antiderivative((~(f') * ~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) ^ ~(q') * (~a + ~(b') * (~x) ^ ~n + ~(c') * (~x) ^ ~(n2')) ^ ~(p'), ~x) => Unintegrable((~f * ~x) ^ ~m * (~d + ~e * (~x) ^ ~n) ^ ~q * (~a + ~b * (~x) ^ ~n + ~c * (~x) ^ (2 * ~n)) ^ ~p, ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~m, ~n, ~p, ~q], ~x) && EqQ(~n2, 2 * ~n)
    @apply_utils Antiderivative((~(f') * ~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) ^ ~(q') * (~a + ~(c') * (~x) ^ ~(n2')) ^ ~(p'), ~x) => Unintegrable((~f * ~x) ^ ~m * (~d + ~e * (~x) ^ ~n) ^ ~q * (~a + ~c * (~x) ^ (2 * ~n)) ^ ~p, ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~m, ~n, ~p, ~q], ~x) && EqQ(~n2, 2 * ~n)
    @apply_utils Antiderivative((~u) ^ ~(m') * (~d + ~(e') * (~v) ^ ~n) ^ ~(q') * (~a + ~(b') * (~v) ^ ~n + ~(c') * (~v) ^ ~(n2')) ^ ~(p'), ~x) => ((~u) ^ ~m / (Coefficient(~v, ~x, 1) * (~v) ^ ~m)) * Subst(Antiderivative((~x) ^ ~m * (~d + ~e * (~x) ^ ~n) ^ ~q * (~a + ~b * (~x) ^ ~n + ~c * (~x) ^ (2 * ~n)) ^ ~p, ~x), ~x, ~v) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~m, ~n, ~p, ~q], ~x) && (EqQ(~n2, 2 * ~n) && (LinearPairQ(~u, ~v, ~x) && NeQ(~v, ~x)))
    @apply_utils Antiderivative((~u) ^ ~(m') * (~d + ~(e') * (~v) ^ ~n) ^ ~(q') * (~a + ~(c') * (~v) ^ ~(n2')) ^ ~(p'), ~x) => ((~u) ^ ~m / (Coefficient(~v, ~x, 1) * (~v) ^ ~m)) * Subst(Antiderivative((~x) ^ ~m * (~d + ~e * (~x) ^ ~n) ^ ~q * (~a + ~c * (~x) ^ (2 * ~n)) ^ ~p, ~x), ~x, ~v) <-- FreeQ([~a, ~c, ~d, ~e, ~m, ~n, ~p], ~x) && (EqQ(~n2, 2 * ~n) && (LinearPairQ(~u, ~v, ~x) && NeQ(~v, ~x)))
    @apply_utils Antiderivative((~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~(mn')) ^ ~(q') * (~(a') + ~(b') * (~x) ^ ~(n') + ~(c') * (~x) ^ ~(n2')) ^ ~(p'), ~x) => Antiderivative((~x) ^ (~m - ~n * ~q) * (~e + ~d * (~x) ^ ~n) ^ ~q * (~a + ~b * (~x) ^ ~n + ~c * (~x) ^ (2 * ~n)) ^ ~p, ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~m, ~n, ~p], ~x) && (EqQ(~n2, 2 * ~n) && (EqQ(~mn, -(~n)) && (IntegerQ(~q) && (PosQ(~n) || Not(IntegerQ(~p))))))
    @apply_utils Antiderivative((~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~(mn')) ^ ~(q') * (~a + ~(c') * (~x) ^ ~(n2')) ^ ~(p'), ~x) => Antiderivative((~x) ^ (~m + ~mn * ~q) * (~e + ~d * (~x) ^ -(~mn)) ^ ~q * (~a + ~c * (~x) ^ ~n2) ^ ~p, ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~m, ~mn, ~p], ~x) && (EqQ(~n2, -2 * ~mn) && (IntegerQ(~q) && (PosQ(~n2) || Not(IntegerQ(~p)))))
    @apply_utils Antiderivative((~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~(n')) ^ ~(q') * (~(a') + ~(b') * (~x) ^ ~(mn') + ~(c') * (~x) ^ ~(mn2')) ^ ~(p'), ~x) => Antiderivative((~x) ^ (~m - 2 * ~n * ~p) * (~d + ~e * (~x) ^ ~n) ^ ~q * (~c + ~b * (~x) ^ ~n + ~a * (~x) ^ (2 * ~n)) ^ ~p, ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~m, ~n, ~q], ~x) && (EqQ(~mn, -(~n)) && (EqQ(~mn2, 2 * ~mn) && IntegerQ(~p)))
    @apply_utils Antiderivative((~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~(n')) ^ ~(q') * (~(a') + ~(c') * (~x) ^ ~(mn2')) ^ ~(p'), ~x) => Antiderivative((~x) ^ (~m - 2 * ~n * ~p) * (~d + ~e * (~x) ^ ~n) ^ ~q * (~c + ~a * (~x) ^ (2 * ~n)) ^ ~p, ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~m, ~n, ~q], ~x) && (EqQ(~mn2, -2 * ~n) && IntegerQ(~p))
    @apply_utils Antiderivative((~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~(mn')) ^ ~q * (~(a') + ~(b') * (~x) ^ ~(n') + ~(c') * (~x) ^ ~(n2')) ^ ~(p'), ~x) => (((~e) ^ IntPart(~q) * (~x) ^ (~n * FracPart(~q)) * (~d + ~e * (~x) ^ -(~n)) ^ FracPart(~q)) / (1 + (~d * (~x) ^ ~n) / ~e) ^ FracPart(~q)) * Antiderivative((~x) ^ (~m - ~n * ~q) * (1 + (~d * (~x) ^ ~n) / ~e) ^ ~q * (~a + ~b * (~x) ^ ~n + ~c * (~x) ^ (2 * ~n)) ^ ~p, ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~m, ~n, ~p, ~q], ~x) && (EqQ(~n2, 2 * ~n) && (EqQ(~mn, -(~n)) && (Not(IntegerQ(~p)) && (Not(IntegerQ(~q)) && PosQ(~n)))))
    @apply_utils Antiderivative((~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~(mn')) ^ ~q * (~a + ~(c') * (~x) ^ ~(n2')) ^ ~(p'), ~x) => (((~e) ^ IntPart(~q) * (~x) ^ (-(~mn) * FracPart(~q)) * (~d + ~e * (~x) ^ ~mn) ^ FracPart(~q)) / (1 + (~d * (~x) ^ -(~mn)) / ~e) ^ FracPart(~q)) * Antiderivative((~x) ^ (~m + ~mn * ~q) * (1 + (~d * (~x) ^ -(~mn)) / ~e) ^ ~q * (~a + ~c * (~x) ^ ~n2) ^ ~p, ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~m, ~mn, ~p, ~q], ~x) && (EqQ(~n2, -2 * ~mn) && (Not(IntegerQ(~p)) && (Not(IntegerQ(~q)) && PosQ(~n2))))
    #= Antiderivative((~x)^(~m')*((~d)+(~e')*(~x)^(~mn'))^(~q)*((~a')+(~b')*(~x)^(~n')+(~c')*(~x)^(~n2'))^(~p'),(~x)*Symbol) :=  x^(n*FracPart(q))*(d+e*x^(-n))^FracPart(q)/(e+d*x^n)^FracPart(q)*Antiderivative( x^(m-n*q)*(e+d*x^n)^q*(a+b*x^n+c*x^(2*n))^p,x) <--  FreeQ([a,b,c,d,e,m,n,p,q],x) && EqQ(n2,2*n) && EqQ(mn,-n) &&  Not(IntegerQ(p)) && Not(IntegerQ(q)) && PosQ(n) =#
    #= Antiderivative((~x)^(~m')*((~d)+(~e')*(~x)^(~mn'))^(~q)*((~a)+(~c')*(~x)^(~n2'))^(~p'),~x) :=  x^(-mn*FracPart(q))*(d+e*x^mn)^FracPart(q)/(e+d*x^(-mn))^FracPart(q)* Antiderivative(x^(m+mn*q)*(e+d*x^(-mn))^q*(a+c*x^n2)^p,x) <--  FreeQ([a,c,d,e,m,mn,p,q],x) && EqQ(n2,-2*mn) && Not(IntegerQ(p)) &&  Not(IntegerQ(q)) && PosQ(n2) =#
    @apply_utils Antiderivative((~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~(n')) ^ ~(q') * (~(a') + ~(b') * (~x) ^ ~(mn') + ~(c') * (~x) ^ ~(mn2')) ^ ~p, ~x) => (((~x) ^ (2 * ~n * FracPart(~p)) * (~a + ~b * (~x) ^ -(~n) + ~c * (~x) ^ (-2 * ~n)) ^ FracPart(~p)) / (~c + ~b * (~x) ^ ~n + ~a * (~x) ^ (2 * ~n)) ^ FracPart(~p)) * Antiderivative((~x) ^ (~m - 2 * ~n * ~p) * (~d + ~e * (~x) ^ ~n) ^ ~q * (~c + ~b * (~x) ^ ~n + ~a * (~x) ^ (2 * ~n)) ^ ~p, ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~m, ~n, ~p, ~q], ~x) && (EqQ(~mn, -(~n)) && (EqQ(~mn2, 2 * ~mn) && (Not(IntegerQ(~p)) && (Not(IntegerQ(~q)) && PosQ(~n)))))
    @apply_utils Antiderivative((~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~(n')) ^ ~(q') * (~(a') + ~(c') * (~x) ^ ~(mn2')) ^ ~p, ~x) => (((~x) ^ (2 * ~n * FracPart(~p)) * (~a + ~c * (~x) ^ (-2 * ~n)) ^ FracPart(~p)) / (~c + ~a * (~x) ^ (2 * ~n)) ^ FracPart(~p)) * Antiderivative((~x) ^ (~m - 2 * ~n * ~p) * (~d + ~e * (~x) ^ ~n) ^ ~q * (~c + ~a * (~x) ^ (2 * ~n)) ^ ~p, ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~m, ~n, ~p, ~q], ~x) && (EqQ(~mn2, -2 * ~n) && (Not(IntegerQ(~p)) && (Not(IntegerQ(~q)) && PosQ(~n))))
    @apply_utils Antiderivative((~f * ~x) ^ ~m * (~d + ~(e') * (~x) ^ ~(mn')) ^ ~(q') * (~(a') + ~(b') * (~x) ^ ~(n') + ~(c') * (~x) ^ ~(n2')) ^ ~(p'), ~x) => (((~f) ^ IntPart(~m) * (~f * ~x) ^ FracPart(~m)) / (~x) ^ FracPart(~m)) * Antiderivative((~x) ^ ~m * (~d + ~e * (~x) ^ ~mn) ^ ~q * (~a + ~b * (~x) ^ ~n + ~c * (~x) ^ (2 * ~n)) ^ ~p, ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~m, ~n, ~p, ~q], ~x) && (EqQ(~n2, 2 * ~n) && EqQ(~mn, -(~n)))
    @apply_utils Antiderivative((~f * ~x) ^ ~m * (~d + ~(e') * (~x) ^ ~(mn')) ^ ~(q') * (~a + ~(c') * (~x) ^ ~(n2')) ^ ~(p'), ~x) => (((~f) ^ IntPart(~m) * (~f * ~x) ^ FracPart(~m)) / (~x) ^ FracPart(~m)) * Antiderivative((~x) ^ ~m * (~d + ~e * (~x) ^ ~mn) ^ ~q * (~a + ~c * (~x) ^ ~n2) ^ ~p, ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~m, ~mn, ~p, ~q], ~x) && EqQ(~n2, -2 * ~mn)
    @apply_utils Antiderivative((~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) ^ ~(q') * (~a + ~(b') * (~x) ^ ~mn + ~(c') * (~x) ^ ~(n')) ^ ~(p'), ~x) => Antiderivative((~x) ^ (~m - ~n * ~p) * (~d + ~e * (~x) ^ ~n) ^ ~q * (~b + ~a * (~x) ^ ~n + ~c * (~x) ^ (2 * ~n)) ^ ~p, ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~m, ~n, ~q], ~x) && (EqQ(~mn, -(~n)) && IntegerQ(~p))
    @apply_utils Antiderivative((~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) ^ ~(q') * (~a + ~(b') * (~x) ^ ~mn + ~(c') * (~x) ^ ~(n')) ^ ~(p'), ~x) => (((~x) ^ (~n * FracPart(~p)) * (~a + ~b / (~x) ^ ~n + ~c * (~x) ^ ~n) ^ FracPart(~p)) / (~b + ~a * (~x) ^ ~n + ~c * (~x) ^ (2 * ~n)) ^ FracPart(~p)) * Antiderivative((~x) ^ (~m - ~n * ~p) * (~d + ~e * (~x) ^ ~n) ^ ~q * (~b + ~a * (~x) ^ ~n + ~c * (~x) ^ (2 * ~n)) ^ ~p, ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~m, ~n, ~p, ~q], ~x) && (EqQ(~mn, -(~n)) && Not(IntegerQ(~p)))
    @apply_utils Antiderivative((~f * ~x) ^ ~(m') * (~d + ~(e') * (~x) ^ ~n) ^ ~(q') * (~a + ~(b') * (~x) ^ ~mn + ~(c') * (~x) ^ ~(n')) ^ ~(p'), ~x) => (((~f) ^ IntPart(~m) * (~f * ~x) ^ FracPart(~m)) / (~x) ^ FracPart(~m)) * Antiderivative((~x) ^ ~m * (~d + ~e * (~x) ^ ~n) ^ ~q * (~a + ~b * (~x) ^ -(~n) + ~c * (~x) ^ ~n) ^ ~p, ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~m, ~n, ~p, ~q], ~x) && EqQ(~mn, -(~n))
    @apply_utils Antiderivative((~(f') * ~x) ^ ~(m') * (~d1 + ~(e1') * (~x) ^ ~(non2')) ^ ~(q') * (~d2 + ~(e2') * (~x) ^ ~(non2')) ^ ~(q') * (~(a') + ~(b') * (~x) ^ ~n + ~(c') * (~x) ^ ~n2) ^ ~(p'), ~x) => Antiderivative((~f * ~x) ^ ~m * (~d1 * ~d2 + ~e1 * ~e2 * (~x) ^ ~n) ^ ~q * (~a + ~b * (~x) ^ ~n + ~c * (~x) ^ (2 * ~n)) ^ ~p, ~x) <-- FreeQ([~a, ~b, ~c, ~d1, ~e1, ~d2, ~e2, ~f, ~n, ~p, ~q], ~x) && (EqQ(~n2, 2 * ~n) && (EqQ(~non2, ~n / 2) && (EqQ(~d2 * ~e1 + ~d1 * ~e2, 0) && (IntegerQ(~q) || GtQ(~d1, 0) && GtQ(~d2, 0)))))
    @apply_utils Antiderivative((~(f') * ~x) ^ ~(m') * (~d1 + ~(e1') * (~x) ^ ~(non2')) ^ ~(q') * (~d2 + ~(e2') * (~x) ^ ~(non2')) ^ ~(q') * (~(a') + ~(b') * (~x) ^ ~n + ~(c') * (~x) ^ ~n2) ^ ~(p'), ~x) => (((~d1 + ~e1 * (~x) ^ (~n / 2)) ^ FracPart(~q) * (~d2 + ~e2 * (~x) ^ (~n / 2)) ^ FracPart(~q)) / (~d1 * ~d2 + ~e1 * ~e2 * (~x) ^ ~n) ^ FracPart(~q)) * Antiderivative((~f * ~x) ^ ~m * (~d1 * ~d2 + ~e1 * ~e2 * (~x) ^ ~n) ^ ~q * (~a + ~b * (~x) ^ ~n + ~c * (~x) ^ (2 * ~n)) ^ ~p, ~x) <-- FreeQ([~a, ~b, ~c, ~d1, ~e1, ~d2, ~e2, ~f, ~n, ~p, ~q], ~x) && (EqQ(~n2, 2 * ~n) && (EqQ(~non2, ~n / 2) && EqQ(~d2 * ~e1 + ~d1 * ~e2, 0)))
end

max_stars_repo_path: src/rules/1 Algebraic functions/1.2 Trinomial products/1.2.3 General/1.2.3.4 (f x)^m (d+e x^n)^q (a+b x^n+c x^(2 n))^p.jl


text:
const _parse_s = Base.Meta.parse
const _parse_t = Base.parse

"""
    count_locations_and_transitions(root_sxmodel)

Returns the number of locations and transitions for each component.

### Input

- `root_sxmodel` -- the root element of a SpaceExParser file

### Output

Two vectors of integers `(lcount, tcount)`, where the i-th entry of `lcount` and
`tcount` are the number of locations and transitions, respectively, of the i-th component.
"""
function count_locations_and_transitions(root_sxmodel)
    lcount = Vector{Int}() # num locations for each component
    tcount = Vector{Int}() # num transitions for each component
    id_component = 0 # index of the current component

    for component in eachelement(root_sxmodel)
        if nodename(component) == "component"
            id_component += 1
            push!(lcount, 0)
            push!(tcount, 0)
            for field in eachelement(component)
                if nodename(field) == "location"
                    lcount[id_component] += 1
                elseif nodename(field) == "transition"
                    tcount[id_component] += 1
                end
            end
        end
    end
    return (lcount, tcount)
end

"""
    parse_sxmath(s; assignment=false)

Returns the list of expressions corresponding to a given SpaceExParser string.

### Input

- `s`          -- string
- `assignment` -- (optional, default: `false`)

### Output

Vector of expressions, equations or inequalities.

### Examples

```jldoctest parse_sxmath
julia> using SpaceExParser: parse_sxmath

julia> parse_sxmath("x >= 0")
1-element Vector{Expr}:
 :(x >= 0)

julia> parse_sxmath("x' == x & v' == -0.75*v")
2-element Vector{Expr}:
 :(x' = x)
 :(v' = -0.75v)

julia> parse_sxmath("x == 0 & v <= 0")
2-element Vector{Expr}:
 :(x = 0)
 :(v <= 0)
```

Parentheses are ignored:

```jldoctest parse_sxmath
julia> parse_sxmath("(x == 0) & (v <= 0)")
2-element Vector{Expr}:
 :(x = 0)
 :(v <= 0)
```

Splitting is also performend over double ampersand symbols:

```jldoctest parse_sxmath
julia> parse_sxmath("x == 0 && v <= 0")
2-element Vector{Expr}:
 :(x = 0)
 :(v <= 0)
```

If you want to parse an assignment, use the `assignment` flag:

```jldoctest parse_sxmath
julia> parse_sxmath("x := -x*0.1", assignment=true)
1-element Vector{Expr}:
 :(x = -x * 0.1)
```

 Check that we can parse expressions involving parentheses:

```jldoctest parse_sxmath
julia> parse_sxmath("(t <= 125 & y>= -100)")
2-element Vector{Expr}:
 :(t <= 125)
 :(y >= -100)
julia> parse_sxmath("t <= 125 & (y>= -100)")
2-element Vector{Expr}:
 :(t <= 125)
 :(y >= -100)
```

### Algorithm

First a sanity check (assertion) is made that the expression makes a coherent use
of parentheses.

Then, the following steps are done (in the given order):

- split the string with the `&` key, or `&&`
- remove trailing whitespace of each substring
- replace double `==` with single `=`
- detect unbalanced parentheses (beginning and final subexpressions) and in that case delete them
- cast to a Julia expression with `parse`

### Notes

For assignments, the nomenclature `:=` is also valid and here it is replaced
to `=`, but you need to set `assignment=true` for this replacement to take effect.

The characters `'('` and `')'` are deleted (replaced by the empty character),
whenever it is found that there are unbalanced parentheses after the expression is
splitted into subexpressions.
"""
function parse_sxmath(s; assignment=false)

    count_left_parentheses = s -> count(c -> c == '(', collect(s))
    count_right_parentheses = s -> count(c -> c == ')', collect(s))
    @assert count_left_parentheses(s) == count_right_parentheses(s) "the expression $(s) is not well formed"

    expr = strip.(split(replace(s, "&&" => "&"), "&"))
    if assignment
        expr = replace.(expr, Ref(":=" => "="))
    end
    expr = replace.(expr, Ref("==" => "="))

    # remove "true" statements
    filter!(expri -> expri != "true", expr)

    # remove irrelevant parentheses from the beginning and the end
    for (i, expri) in enumerate(expr)
        m = count_left_parentheses(expri)
        n = count_right_parentheses(expri)
        if m == n
            nothing
        elseif m > n && expri[1] == '('
            expr[i] = expri[2:end]
        elseif m < n && expri[end] == ')'
            expr[i] = expri[1:end-1]
        else
            error("malformed subexpression $(expri)")
        end
    end
    return _parse_s.(expr)
end

"""
    parse_sxmodel!(root_sxmodel, HDict)

### Input

- `root_sxmodel` -- root element of an XML document
- `HDict`        -- dictionary that wraps the hybrid model and contains the keys
                    `(automaton, variables, transitionlabels, invariants, flows,
                    assignments, guards, switchings, nlocations, ntransitions)`

### Output

The `HDict` dictionary.

### Notes

1) Edge labels are not used and their symbol is (arbitrarily) set to the integer 1.
2) Location identifications ("id" field) are assumed to be integers.
3) The switchings types are assumed to be autonomous. See Switching in *Systems
   and Control*, D. Liberzon, for further details on the classification of switchings.
4) We add fresh varaibles for each component (`id_variable += 1`). In general
   variables can be shared among components if the bindings are defined. Currently,
   we make the simplifying assumption that the model has only one component and
   we don't take bindings into account.
"""
function parse_sxmodel!(root_sxmodel, HDict)

    # edge labels
    σ = 1

    # counter for the variables
    id_variable = 0

    # counter for the transitions
    id_transition = 0

    for component in eachelement(root_sxmodel)
        for field in eachelement(component)
            if nodename(field) == "param"
                if field["type"] == "real" || field["type"] == "bool"
                    id_variable += 1
                    add_variable!(HDict["variables"], field, id_variable)
                elseif field["type"] == "label"
                    add_transition_label!(HDict["transitionlabels"], field)
                else
                    error("param type $(field["type"]) unknown")
                end
            elseif nodename(field) == "location"
                (id_location, i, f) = parse_location(field)
                HDict["invariants"][id_location] = i
                HDict["flows"][id_location] = f
            elseif nodename(field) == "transition"
                id_transition += 1
                (q, r, guard, assignment) = parse_transition(field)
                add_transition!(HDict["automaton"], q, r, σ)
                HDict["switchings"][id_transition] = AutonomousSwitching()
                HDict["assignments"][id_transition] = assignment
                HDict["guards"][id_transition] = guard
            else
                error("node $(nodename(field)) unknown")
            end
        end
    end
    return HDict
end

"""
    add_variable!(variables, field, id=1)

### Input

- `variables` -- vector of symbolic variables
- `field`     -- an `EzXML.Node` node with containing information about a `param` field
- `id`        -- (optional, default: 1) integer that identifies the variable

### Output

The updated vector of symbolic variables.

### Notes

Parameters can be either variable names (type "real") or labels (type "label").
"""
function add_variable!(variables, field, id=1)
    @assert field["type"] == "real" || field["type"] == "bool"

    # d1 and d2 are the dimensions (d1=d2=1 for scalars)
    @assert field["d1"] == "1" && field["d2"] == "1"

    varname = _parse_s(field["name"])
    islocal = haskey(field, "local") ? _parse_s(field["local"]) : false
    iscontrolled = haskey(field, "controlled") ? _parse_s(field["controlled"]) : true
    dynamicstype = haskey(field, "dynamics") ? field["dynamics"] : "any"

    variables[varname] = Dict("local"=>islocal,
                              "controlled"=>iscontrolled,
                              "dynamics"=>dynamicstype,
                              "id"=>id)
    return variables
end

"""
    add_transition_label!(labels, field)

### Input

- `labels` -- vector of transition labels
- `field`  -- node with a `param` label field

### Output

The updated vector of transition labels.
"""
function add_transition_label!(labels, field)
    @assert field["type"] == "label"
    push!(labels, field["name"])
    return labels
end

"""
    parse_location(field)

### Input

- `field`  -- location node

### Output

The tuple `(id, invariant, flow)` where:

- `id` is the integer that identifies the location,
- `invariant` is the list of subexpressions that determine that invariant for this location,
-  `flow` is the list of ODEs that define the flow for this location.

Both the invariant and the flow are vectors of symbolic expressions `Expr`.
"""
function parse_location(field)
    id = _parse_t(Int, field["id"])

    # if it happens that no invariant (or no flow) is defined in the component,
    # then this function will return an empty list of expressions
    invariant, flow = Expr[:()], Expr[:()]
    for element in eachelement(field)
        if nodename(element) == "invariant"
            invariant = parse_sxmath(nodecontent(element))
        elseif nodename(element) == "flow"
            flow = parse_sxmath(nodecontent(element))
        else
            @warn("field $(nodename(element)) in location $(field["id"]) is ignored")
        end
    end
    return (id, invariant, flow)
end

"""
    parse_transition(field)

### Input

- `field`  -- transition node

### Output

The tuple `(q, r, G, A)` where `q` and `r` are the source mode and target mode
respectively for this transition, `G` is the list of guards for this transition,
and `A` is the list of assignments. `G` and `A` are vectors of
symbolic expressions `Expr`.

### Notes

It is assumed that the "source" and "target" fields can be cast to integers.

It can happen that the given transition does not contain the "guard" field (or
the "assignment", or both); in that case this function returns an empty of
expressions for those cases.
"""
function parse_transition(field)
    q, r = _parse_t(Int, field["source"]), _parse_t(Int, field["target"])
    G = Vector{Expr}()
    A = Vector{Expr}()
    for element in eachelement(field)
        if nodename(element) == "guard"
            G = parse_sxmath(nodecontent(element))
        elseif nodename(element) == "assignment"
            A = parse_sxmath(nodecontent(element), assignment=true)
        else
            @warn("field $(nodename(element)) in transition $(field["source"]) → $(field["target"]) is ignored")
        end
    end
    return (q, r, G, A)
end

ext: jl


text:
using TransportLayerSecurity
using Base.Test

isdefined(TransportLayerSecurity, :setup!)
isdefined(TransportLayerSecurity, :associate!)
isdefined(TransportLayerSecurity, :handshake!)


text:
function get_auxiliary_elements(obj::ForceModelContext)
    return jcall(obj, "getAuxiliaryElements", AuxiliaryElements, ())
end

function get_co2ab(obj::AbstractGaussianContributionContext)
    return jcall(obj, "getCo2AB", jdouble, ())
end

function get_mean_motion(obj::AbstractGaussianContributionContext)
    return jcall(obj, "getMeanMotion", jdouble, ())
end

function get_mu(obj::AbstractGaussianContributionContext)
    return jcall(obj, "getMu", jdouble, ())
end

function get_oo_bpo(obj::AbstractGaussianContributionContext)
    return jcall(obj, "getOoBpo", jdouble, ())
end

function get_oo_mu(obj::AbstractGaussianContributionContext)
    return jcall(obj, "getOoMU", jdouble, ())
end

function get_ooa(obj::AbstractGaussianContributionContext)
    return jcall(obj, "getOOA", jdouble, ())
end

function get_ooab(obj::AbstractGaussianContributionContext)
    return jcall(obj, "getOOAB", jdouble, ())
end

function get_ton2a(obj::AbstractGaussianContributionContext)
    return jcall(obj, "getTon2a", jdouble, ())
end


text:
"""
$(TYPEDEF)

two sample test for mean

Constructors
------------
* `TwoSampleMean(mu1::Real, mu2::Real, k::Real, stdunknown::Bool)`

Arguments
---------
* `mu1`: Mean of group 1

* `mu2`: Mean of group 2

* `k`: Allocation ratio of the groups, k = n(group1) / n(group 2)

* `stdunknown`: If the population standard deviation is known, default = false,
when the population parameter is known, the power / sample size are calculated based
on a standard normal distribution, otherwise a t distribution will be used

Fields
------
$(FIELDS)
"""
type TwoSampleMean <: TrialTest
    mu1::Real
    mu2::Real
    k::Real
    stdunknown::Bool

    # Validator
    function TwoSampleMean(mu1, mu2, k, stdunknown = false)

        if !((-Inf < mu1 < Inf) & (-Inf < mu2 < Inf))

            error("Mean values must be in (-Inf, Inf)")

        end # end if

        if !(0 < k < Inf)

            error("Allocation ratio must be in (0, Inf)")

        end # end if
        new(mu1, mu2, k, stdunknown)

    end # end function

end # end type

# Two-sample test for mean, if the standard devaition is the same for the two groups
function hypotheses{T <: TwoSampleMean}(test::T, n::Real, std::Real, alpha::Real, side::String)

    diff = test.mu1 - test.mu2
    se = sqrt(1 / n + 1 / (test.k * n)) * std
    ts = diff / se
    if test.stdunknown == false

        if side == "two"

            p =  cdf(ZDIST, ts - quantile(ZDIST, 1 - alpha / 2)) + cdf(ZDIST, -ts - quantile(ZDIST, 1 - alpha / 2))

        else

            p = cdf(ZDIST, abs(ts) - quantile(ZDIST, 1 - alpha))

        end # end if

    else

        if side == "two"

            p =  cdf(TDist(n + test.k * n - 2), ts - quantile(TDist(n + test.k * n - 2), 1 - alpha / 2)) +
                 cdf(TDist(n + test.k * n - 2), -ts - quantile(TDist(n + test.k * n - 2), 1 - alpha / 2))

        else

            p = cdf(TDist(n + test.k * n - 2), abs(ts) - quantile(TDist(n + test.k * n - 2), 1 - alpha))

        end # end if

    end # end if
    # power_result(test, p)
    return p

end # end function

# Two-sample test for mean, if the standard devaition is not the same
function hypotheses{T <: TwoSampleMean}(test::T, n::Real, std::Tuple{Real, Real}, alpha::Real, side::String)

    diff = test.mu1 - test.mu2
    se = sqrt(std[1] ^ 2 / (test.k * n) + std[2] ^ 2 / n)
    ts = diff / se
    if test.stdunknown == false

        if side == "two"

            p =  cdf(ZDIST, ts - quantile(ZDIST, 1 - alpha / 2)) + cdf(ZDIST, -ts - quantile(ZDIST, 1 - alpha / 2))

        else

            p = cdf(ZDIST, abs(ts) - quantile(ZDIST, 1 - alpha))

        end # end if

    else

        if side == "two"

            p =  cdf(TDist(n + test.k * n - 2), ts - quantile(TDist(n + test.k * n - 2), 1 - alpha / 2)) +
                 cdf(TDist(n + test.k * n - 2), -ts - quantile(TDist(n + test.k * n - 2), 1 - alpha / 2))

        else

            p = cdf(TDist(n + test.k * n - 2), abs(ts) - quantile(TDist(n + test.k * n - 2), 1 - alpha))

        end # end if

    end # end if
    # power_result(test, p)
    return p

end # end function