\(\int (f+g x)^3 (A+B \log (e (\frac {a+b x}{c+d x})^n)) \, dx\) [58]

Optimal result
Mathematica [A] (verified)
Rubi [A] (verified)
Maple [B] (verified)
Fricas [B] (verification not implemented)
Sympy [F(-1)]
Maxima [A] (verification not implemented)
Giac [B] (verification not implemented)
Mupad [B] (verification not implemented)
Reduce [B] (verification not implemented)

Optimal result

Integrand size = 30, antiderivative size = 235 \[ \int (f+g x)^3 \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right ) \, dx=-\frac {B (b c-a d) g \left (a^2 d^2 g^2-a b d g (4 d f-c g)+b^2 \left (6 d^2 f^2-4 c d f g+c^2 g^2\right )\right ) n x}{4 b^3 d^3}-\frac {B (b c-a d) g^2 (4 b d f-b c g-a d g) n x^2}{8 b^2 d^2}-\frac {B (b c-a d) g^3 n x^3}{12 b d}-\frac {B (b f-a g)^4 n \log (a+b x)}{4 b^4 g}+\frac {(f+g x)^4 \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right )}{4 g}+\frac {B (d f-c g)^4 n \log (c+d x)}{4 d^4 g} \] Output:

-1/4*B*(-a*d+b*c)*g*(a^2*d^2*g^2-a*b*d*g*(-c*g+4*d*f)+b^2*(c^2*g^2-4*c*d*f 
*g+6*d^2*f^2))*n*x/b^3/d^3-1/8*B*(-a*d+b*c)*g^2*(-a*d*g-b*c*g+4*b*d*f)*n*x 
^2/b^2/d^2-1/12*B*(-a*d+b*c)*g^3*n*x^3/b/d-1/4*B*(-a*g+b*f)^4*n*ln(b*x+a)/ 
b^4/g+1/4*(g*x+f)^4*(A+B*ln(e*((b*x+a)/(d*x+c))^n))/g+1/4*B*(-c*g+d*f)^4*n 
*ln(d*x+c)/d^4/g
 

Mathematica [A] (verified)

Time = 0.32 (sec) , antiderivative size = 219, normalized size of antiderivative = 0.93 \[ \int (f+g x)^3 \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right ) \, dx=\frac {(f+g x)^4 \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right )-\frac {B n \left (6 b d (b c-a d) g^2 \left (a^2 d^2 g^2+a b d g (-4 d f+c g)+b^2 \left (6 d^2 f^2-4 c d f g+c^2 g^2\right )\right ) x+3 b^2 d^2 (b c-a d) g^3 (4 b d f-b c g-a d g) x^2+2 b^3 d^3 (b c-a d) g^4 x^3+6 d^4 (b f-a g)^4 \log (a+b x)-6 b^4 (d f-c g)^4 \log (c+d x)\right )}{6 b^4 d^4}}{4 g} \] Input:

Integrate[(f + g*x)^3*(A + B*Log[e*((a + b*x)/(c + d*x))^n]),x]
 

Output:

((f + g*x)^4*(A + B*Log[e*((a + b*x)/(c + d*x))^n]) - (B*n*(6*b*d*(b*c - a 
*d)*g^2*(a^2*d^2*g^2 + a*b*d*g*(-4*d*f + c*g) + b^2*(6*d^2*f^2 - 4*c*d*f*g 
 + c^2*g^2))*x + 3*b^2*d^2*(b*c - a*d)*g^3*(4*b*d*f - b*c*g - a*d*g)*x^2 + 
 2*b^3*d^3*(b*c - a*d)*g^4*x^3 + 6*d^4*(b*f - a*g)^4*Log[a + b*x] - 6*b^4* 
(d*f - c*g)^4*Log[c + d*x]))/(6*b^4*d^4))/(4*g)
 

Rubi [A] (verified)

Time = 0.52 (sec) , antiderivative size = 227, normalized size of antiderivative = 0.97, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.100, Rules used = {2947, 93, 2009}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int (f+g x)^3 \left (B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )+A\right ) \, dx\)

\(\Big \downarrow \) 2947

\(\displaystyle \frac {(f+g x)^4 \left (B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )+A\right )}{4 g}-\frac {B n (b c-a d) \int \frac {(f+g x)^4}{(a+b x) (c+d x)}dx}{4 g}\)

\(\Big \downarrow \) 93

\(\displaystyle \frac {(f+g x)^4 \left (B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )+A\right )}{4 g}-\frac {B n (b c-a d) \int \left (\frac {x^2 g^4}{b d}+\frac {(4 b d f-b c g-a d g) x g^3}{b^2 d^2}+\frac {\left (\left (6 d^2 f^2-4 c d g f+c^2 g^2\right ) b^2-a d g (4 d f-c g) b+a^2 d^2 g^2\right ) g^2}{b^3 d^3}+\frac {(b f-a g)^4}{b^3 (b c-a d) (a+b x)}+\frac {(d f-c g)^4}{d^3 (a d-b c) (c+d x)}\right )dx}{4 g}\)

\(\Big \downarrow \) 2009

\(\displaystyle \frac {(f+g x)^4 \left (B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )+A\right )}{4 g}-\frac {B n (b c-a d) \left (\frac {g^2 x \left (a^2 d^2 g^2-a b d g (4 d f-c g)+b^2 \left (c^2 g^2-4 c d f g+6 d^2 f^2\right )\right )}{b^3 d^3}+\frac {(b f-a g)^4 \log (a+b x)}{b^4 (b c-a d)}+\frac {g^3 x^2 (-a d g-b c g+4 b d f)}{2 b^2 d^2}-\frac {(d f-c g)^4 \log (c+d x)}{d^4 (b c-a d)}+\frac {g^4 x^3}{3 b d}\right )}{4 g}\)

Input:

Int[(f + g*x)^3*(A + B*Log[e*((a + b*x)/(c + d*x))^n]),x]
 

Output:

((f + g*x)^4*(A + B*Log[e*((a + b*x)/(c + d*x))^n]))/(4*g) - (B*(b*c - a*d 
)*n*((g^2*(a^2*d^2*g^2 - a*b*d*g*(4*d*f - c*g) + b^2*(6*d^2*f^2 - 4*c*d*f* 
g + c^2*g^2))*x)/(b^3*d^3) + (g^3*(4*b*d*f - b*c*g - a*d*g)*x^2)/(2*b^2*d^ 
2) + (g^4*x^3)/(3*b*d) + ((b*f - a*g)^4*Log[a + b*x])/(b^4*(b*c - a*d)) - 
((d*f - c*g)^4*Log[c + d*x])/(d^4*(b*c - a*d))))/(4*g)
 

Defintions of rubi rules used

rule 93
Int[((e_.) + (f_.)*(x_))^(p_)/(((a_.) + (b_.)*(x_))*((c_.) + (d_.)*(x_))), 
x_] :> Int[ExpandIntegrand[(e + f*x)^p/((a + b*x)*(c + d*x)), x], x] /; Fre 
eQ[{a, b, c, d, e, f}, x] && IntegerQ[p]
 

rule 2009
Int[u_, x_Symbol] :> Simp[IntSum[u, x], x] /; SumQ[u]
 

rule 2947
Int[((A_.) + Log[(e_.)*(((a_.) + (b_.)*(x_))/((c_.) + (d_.)*(x_)))^(n_.)]*( 
B_.))*((f_.) + (g_.)*(x_))^(m_.), x_Symbol] :> Simp[(f + g*x)^(m + 1)*((A + 
 B*Log[e*((a + b*x)/(c + d*x))^n])/(g*(m + 1))), x] - Simp[B*n*((b*c - a*d) 
/(g*(m + 1)))   Int[(f + g*x)^(m + 1)/((a + b*x)*(c + d*x)), x], x] /; Free 
Q[{a, b, c, d, e, f, g, A, B, m, n}, x] && NeQ[b*c - a*d, 0] && NeQ[m, -1] 
&& NeQ[m, -2]
 
Maple [B] (verified)

Leaf count of result is larger than twice the leaf count of optimal. \(975\) vs. \(2(223)=446\).

Time = 1.95 (sec) , antiderivative size = 976, normalized size of antiderivative = 4.15

method result size
parallelrisch \(\frac {-36 B \ln \left (e \left (\frac {b x +a}{d x +c}\right )^{n}\right ) b^{4} c^{2} d^{2} f^{2} g n +24 A x \,b^{4} d^{4} f^{3} n -6 B \,a^{4} d^{4} g^{3} n^{2}+6 B \,b^{4} c^{4} g^{3} n^{2}+24 B \ln \left (b x +a \right ) a^{3} b \,d^{4} f \,g^{2} n^{2}-36 B \ln \left (b x +a \right ) a^{2} b^{2} d^{4} f^{2} g \,n^{2}-24 B \ln \left (b x +a \right ) b^{4} c^{3} d f \,g^{2} n^{2}+36 B \ln \left (b x +a \right ) b^{4} c^{2} d^{2} f^{2} g \,n^{2}+12 B \,a^{2} b^{2} c \,d^{3} f \,g^{2} n^{2}-12 B a \,b^{3} c^{2} d^{2} f \,g^{2} n^{2}-36 A a \,b^{3} c \,d^{3} f^{2} g n -24 A a \,b^{3} d^{4} f^{3} n -24 A \,b^{4} c \,d^{3} f^{3} n +24 B \,a^{3} b \,d^{4} f \,g^{2} n^{2}-36 B \,a^{2} b^{2} d^{4} f^{2} g \,n^{2}-24 B \,b^{4} c^{3} d f \,g^{2} n^{2}+36 B \,b^{4} c^{2} d^{2} f^{2} g \,n^{2}+24 A \,x^{3} b^{4} d^{4} f \,g^{2} n +6 A \,x^{4} b^{4} d^{4} g^{3} n -6 B \ln \left (e \left (\frac {b x +a}{d x +c}\right )^{n}\right ) b^{4} c^{4} g^{3} n -6 B \ln \left (b x +a \right ) a^{4} d^{4} g^{3} n^{2}+6 B \ln \left (b x +a \right ) b^{4} c^{4} g^{3} n^{2}-3 B \,a^{3} b c \,d^{3} g^{3} n^{2}+3 B a \,b^{3} c^{3} d \,g^{3} n^{2}+6 B \,x^{4} \ln \left (e \left (\frac {b x +a}{d x +c}\right )^{n}\right ) b^{4} d^{4} g^{3} n +2 B \,x^{3} a \,b^{3} d^{4} g^{3} n^{2}-2 B \,x^{3} b^{4} c \,d^{3} g^{3} n^{2}-3 B \,x^{2} a^{2} b^{2} d^{4} g^{3} n^{2}+3 B \,x^{2} b^{4} c^{2} d^{2} g^{3} n^{2}+6 B x \,a^{3} b \,d^{4} g^{3} n^{2}-6 B x \,b^{4} c^{3} d \,g^{3} n^{2}+36 A \,x^{2} b^{4} d^{4} f^{2} g n +24 B x \ln \left (e \left (\frac {b x +a}{d x +c}\right )^{n}\right ) b^{4} d^{4} f^{3} n +24 B \ln \left (e \left (\frac {b x +a}{d x +c}\right )^{n}\right ) b^{4} c \,d^{3} f^{3} n -24 B \ln \left (b x +a \right ) b^{4} c \,d^{3} f^{3} n^{2}+24 B \ln \left (b x +a \right ) a \,b^{3} d^{4} f^{3} n^{2}+24 B \,x^{3} \ln \left (e \left (\frac {b x +a}{d x +c}\right )^{n}\right ) b^{4} d^{4} f \,g^{2} n +36 B \,x^{2} \ln \left (e \left (\frac {b x +a}{d x +c}\right )^{n}\right ) b^{4} d^{4} f^{2} g n +12 B \,x^{2} a \,b^{3} d^{4} f \,g^{2} n^{2}-12 B \,x^{2} b^{4} c \,d^{3} f \,g^{2} n^{2}-24 B x \,a^{2} b^{2} d^{4} f \,g^{2} n^{2}+36 B x a \,b^{3} d^{4} f^{2} g \,n^{2}+24 B x \,b^{4} c^{2} d^{2} f \,g^{2} n^{2}-36 B x \,b^{4} c \,d^{3} f^{2} g \,n^{2}+24 B \ln \left (e \left (\frac {b x +a}{d x +c}\right )^{n}\right ) b^{4} c^{3} d f \,g^{2} n}{24 b^{4} d^{4} n}\) \(976\)

Input:

int((g*x+f)^3*(A+B*ln(e*((b*x+a)/(d*x+c))^n)),x,method=_RETURNVERBOSE)
 

Output:

1/24*(-36*B*ln(e*((b*x+a)/(d*x+c))^n)*b^4*c^2*d^2*f^2*g*n+24*A*x*b^4*d^4*f 
^3*n-6*B*a^4*d^4*g^3*n^2+6*B*b^4*c^4*g^3*n^2+24*B*ln(b*x+a)*a^3*b*d^4*f*g^ 
2*n^2-36*B*ln(b*x+a)*a^2*b^2*d^4*f^2*g*n^2-24*B*ln(b*x+a)*b^4*c^3*d*f*g^2* 
n^2+36*B*ln(b*x+a)*b^4*c^2*d^2*f^2*g*n^2+12*B*a^2*b^2*c*d^3*f*g^2*n^2-12*B 
*a*b^3*c^2*d^2*f*g^2*n^2-36*A*a*b^3*c*d^3*f^2*g*n-24*A*a*b^3*d^4*f^3*n-24* 
A*b^4*c*d^3*f^3*n+24*B*a^3*b*d^4*f*g^2*n^2-36*B*a^2*b^2*d^4*f^2*g*n^2-24*B 
*b^4*c^3*d*f*g^2*n^2+36*B*b^4*c^2*d^2*f^2*g*n^2+24*A*x^3*b^4*d^4*f*g^2*n+6 
*A*x^4*b^4*d^4*g^3*n-6*B*ln(e*((b*x+a)/(d*x+c))^n)*b^4*c^4*g^3*n-6*B*ln(b* 
x+a)*a^4*d^4*g^3*n^2+6*B*ln(b*x+a)*b^4*c^4*g^3*n^2-3*B*a^3*b*c*d^3*g^3*n^2 
+3*B*a*b^3*c^3*d*g^3*n^2+6*B*x^4*ln(e*((b*x+a)/(d*x+c))^n)*b^4*d^4*g^3*n+2 
*B*x^3*a*b^3*d^4*g^3*n^2-2*B*x^3*b^4*c*d^3*g^3*n^2-3*B*x^2*a^2*b^2*d^4*g^3 
*n^2+3*B*x^2*b^4*c^2*d^2*g^3*n^2+6*B*x*a^3*b*d^4*g^3*n^2-6*B*x*b^4*c^3*d*g 
^3*n^2+36*A*x^2*b^4*d^4*f^2*g*n+24*B*x*ln(e*((b*x+a)/(d*x+c))^n)*b^4*d^4*f 
^3*n+24*B*ln(e*((b*x+a)/(d*x+c))^n)*b^4*c*d^3*f^3*n-24*B*ln(b*x+a)*b^4*c*d 
^3*f^3*n^2+24*B*ln(b*x+a)*a*b^3*d^4*f^3*n^2+24*B*x^3*ln(e*((b*x+a)/(d*x+c) 
)^n)*b^4*d^4*f*g^2*n+36*B*x^2*ln(e*((b*x+a)/(d*x+c))^n)*b^4*d^4*f^2*g*n+12 
*B*x^2*a*b^3*d^4*f*g^2*n^2-12*B*x^2*b^4*c*d^3*f*g^2*n^2-24*B*x*a^2*b^2*d^4 
*f*g^2*n^2+36*B*x*a*b^3*d^4*f^2*g*n^2+24*B*x*b^4*c^2*d^2*f*g^2*n^2-36*B*x* 
b^4*c*d^3*f^2*g*n^2+24*B*ln(e*((b*x+a)/(d*x+c))^n)*b^4*c^3*d*f*g^2*n)/b^4/ 
d^4/n
 

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 521 vs. \(2 (223) = 446\).

Time = 0.22 (sec) , antiderivative size = 521, normalized size of antiderivative = 2.22 \[ \int (f+g x)^3 \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right ) \, dx=\frac {6 \, A b^{4} d^{4} g^{3} x^{4} + 2 \, {\left (12 \, A b^{4} d^{4} f g^{2} - {\left (B b^{4} c d^{3} - B a b^{3} d^{4}\right )} g^{3} n\right )} x^{3} + 3 \, {\left (12 \, A b^{4} d^{4} f^{2} g - {\left (4 \, {\left (B b^{4} c d^{3} - B a b^{3} d^{4}\right )} f g^{2} - {\left (B b^{4} c^{2} d^{2} - B a^{2} b^{2} d^{4}\right )} g^{3}\right )} n\right )} x^{2} + 6 \, {\left (4 \, B a b^{3} d^{4} f^{3} - 6 \, B a^{2} b^{2} d^{4} f^{2} g + 4 \, B a^{3} b d^{4} f g^{2} - B a^{4} d^{4} g^{3}\right )} n \log \left (b x + a\right ) - 6 \, {\left (4 \, B b^{4} c d^{3} f^{3} - 6 \, B b^{4} c^{2} d^{2} f^{2} g + 4 \, B b^{4} c^{3} d f g^{2} - B b^{4} c^{4} g^{3}\right )} n \log \left (d x + c\right ) + 6 \, {\left (4 \, A b^{4} d^{4} f^{3} - {\left (6 \, {\left (B b^{4} c d^{3} - B a b^{3} d^{4}\right )} f^{2} g - 4 \, {\left (B b^{4} c^{2} d^{2} - B a^{2} b^{2} d^{4}\right )} f g^{2} + {\left (B b^{4} c^{3} d - B a^{3} b d^{4}\right )} g^{3}\right )} n\right )} x + 6 \, {\left (B b^{4} d^{4} g^{3} x^{4} + 4 \, B b^{4} d^{4} f g^{2} x^{3} + 6 \, B b^{4} d^{4} f^{2} g x^{2} + 4 \, B b^{4} d^{4} f^{3} x\right )} \log \left (e\right ) + 6 \, {\left (B b^{4} d^{4} g^{3} n x^{4} + 4 \, B b^{4} d^{4} f g^{2} n x^{3} + 6 \, B b^{4} d^{4} f^{2} g n x^{2} + 4 \, B b^{4} d^{4} f^{3} n x\right )} \log \left (\frac {b x + a}{d x + c}\right )}{24 \, b^{4} d^{4}} \] Input:

integrate((g*x+f)^3*(A+B*log(e*((b*x+a)/(d*x+c))^n)),x, algorithm="fricas" 
)
 

Output:

1/24*(6*A*b^4*d^4*g^3*x^4 + 2*(12*A*b^4*d^4*f*g^2 - (B*b^4*c*d^3 - B*a*b^3 
*d^4)*g^3*n)*x^3 + 3*(12*A*b^4*d^4*f^2*g - (4*(B*b^4*c*d^3 - B*a*b^3*d^4)* 
f*g^2 - (B*b^4*c^2*d^2 - B*a^2*b^2*d^4)*g^3)*n)*x^2 + 6*(4*B*a*b^3*d^4*f^3 
 - 6*B*a^2*b^2*d^4*f^2*g + 4*B*a^3*b*d^4*f*g^2 - B*a^4*d^4*g^3)*n*log(b*x 
+ a) - 6*(4*B*b^4*c*d^3*f^3 - 6*B*b^4*c^2*d^2*f^2*g + 4*B*b^4*c^3*d*f*g^2 
- B*b^4*c^4*g^3)*n*log(d*x + c) + 6*(4*A*b^4*d^4*f^3 - (6*(B*b^4*c*d^3 - B 
*a*b^3*d^4)*f^2*g - 4*(B*b^4*c^2*d^2 - B*a^2*b^2*d^4)*f*g^2 + (B*b^4*c^3*d 
 - B*a^3*b*d^4)*g^3)*n)*x + 6*(B*b^4*d^4*g^3*x^4 + 4*B*b^4*d^4*f*g^2*x^3 + 
 6*B*b^4*d^4*f^2*g*x^2 + 4*B*b^4*d^4*f^3*x)*log(e) + 6*(B*b^4*d^4*g^3*n*x^ 
4 + 4*B*b^4*d^4*f*g^2*n*x^3 + 6*B*b^4*d^4*f^2*g*n*x^2 + 4*B*b^4*d^4*f^3*n* 
x)*log((b*x + a)/(d*x + c)))/(b^4*d^4)
 

Sympy [F(-1)]

Timed out. \[ \int (f+g x)^3 \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right ) \, dx=\text {Timed out} \] Input:

integrate((g*x+f)**3*(A+B*ln(e*((b*x+a)/(d*x+c))**n)),x)
 

Output:

Timed out
 

Maxima [A] (verification not implemented)

Time = 0.05 (sec) , antiderivative size = 443, normalized size of antiderivative = 1.89 \[ \int (f+g x)^3 \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right ) \, dx=\frac {1}{4} \, B g^{3} x^{4} \log \left (e {\left (\frac {b x}{d x + c} + \frac {a}{d x + c}\right )}^{n}\right ) + \frac {1}{4} \, A g^{3} x^{4} + B f g^{2} x^{3} \log \left (e {\left (\frac {b x}{d x + c} + \frac {a}{d x + c}\right )}^{n}\right ) + A f g^{2} x^{3} + \frac {3}{2} \, B f^{2} g x^{2} \log \left (e {\left (\frac {b x}{d x + c} + \frac {a}{d x + c}\right )}^{n}\right ) + \frac {3}{2} \, A f^{2} g x^{2} - \frac {1}{24} \, B g^{3} n {\left (\frac {6 \, a^{4} \log \left (b x + a\right )}{b^{4}} - \frac {6 \, c^{4} \log \left (d x + c\right )}{d^{4}} + \frac {2 \, {\left (b^{3} c d^{2} - a b^{2} d^{3}\right )} x^{3} - 3 \, {\left (b^{3} c^{2} d - a^{2} b d^{3}\right )} x^{2} + 6 \, {\left (b^{3} c^{3} - a^{3} d^{3}\right )} x}{b^{3} d^{3}}\right )} + \frac {1}{2} \, B f g^{2} n {\left (\frac {2 \, a^{3} \log \left (b x + a\right )}{b^{3}} - \frac {2 \, c^{3} \log \left (d x + c\right )}{d^{3}} - \frac {{\left (b^{2} c d - a b d^{2}\right )} x^{2} - 2 \, {\left (b^{2} c^{2} - a^{2} d^{2}\right )} x}{b^{2} d^{2}}\right )} - \frac {3}{2} \, B f^{2} g n {\left (\frac {a^{2} \log \left (b x + a\right )}{b^{2}} - \frac {c^{2} \log \left (d x + c\right )}{d^{2}} + \frac {{\left (b c - a d\right )} x}{b d}\right )} + B f^{3} n {\left (\frac {a \log \left (b x + a\right )}{b} - \frac {c \log \left (d x + c\right )}{d}\right )} + B f^{3} x \log \left (e {\left (\frac {b x}{d x + c} + \frac {a}{d x + c}\right )}^{n}\right ) + A f^{3} x \] Input:

integrate((g*x+f)^3*(A+B*log(e*((b*x+a)/(d*x+c))^n)),x, algorithm="maxima" 
)
 

Output:

1/4*B*g^3*x^4*log(e*(b*x/(d*x + c) + a/(d*x + c))^n) + 1/4*A*g^3*x^4 + B*f 
*g^2*x^3*log(e*(b*x/(d*x + c) + a/(d*x + c))^n) + A*f*g^2*x^3 + 3/2*B*f^2* 
g*x^2*log(e*(b*x/(d*x + c) + a/(d*x + c))^n) + 3/2*A*f^2*g*x^2 - 1/24*B*g^ 
3*n*(6*a^4*log(b*x + a)/b^4 - 6*c^4*log(d*x + c)/d^4 + (2*(b^3*c*d^2 - a*b 
^2*d^3)*x^3 - 3*(b^3*c^2*d - a^2*b*d^3)*x^2 + 6*(b^3*c^3 - a^3*d^3)*x)/(b^ 
3*d^3)) + 1/2*B*f*g^2*n*(2*a^3*log(b*x + a)/b^3 - 2*c^3*log(d*x + c)/d^3 - 
 ((b^2*c*d - a*b*d^2)*x^2 - 2*(b^2*c^2 - a^2*d^2)*x)/(b^2*d^2)) - 3/2*B*f^ 
2*g*n*(a^2*log(b*x + a)/b^2 - c^2*log(d*x + c)/d^2 + (b*c - a*d)*x/(b*d)) 
+ B*f^3*n*(a*log(b*x + a)/b - c*log(d*x + c)/d) + B*f^3*x*log(e*(b*x/(d*x 
+ c) + a/(d*x + c))^n) + A*f^3*x
 

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 6772 vs. \(2 (223) = 446\).

Time = 0.89 (sec) , antiderivative size = 6772, normalized size of antiderivative = 28.82 \[ \int (f+g x)^3 \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right ) \, dx=\text {Too large to display} \] Input:

integrate((g*x+f)^3*(A+B*log(e*((b*x+a)/(d*x+c))^n)),x, algorithm="giac")
 

Output:

1/24*(6*(4*B*b^5*c^2*d^3*f^3*n - 8*B*a*b^4*c*d^4*f^3*n - 12*(b*x + a)*B*b^ 
4*c^2*d^4*f^3*n/(d*x + c) + 4*B*a^2*b^3*d^5*f^3*n + 24*(b*x + a)*B*a*b^3*c 
*d^5*f^3*n/(d*x + c) + 12*(b*x + a)^2*B*b^3*c^2*d^5*f^3*n/(d*x + c)^2 - 12 
*(b*x + a)*B*a^2*b^2*d^6*f^3*n/(d*x + c) - 24*(b*x + a)^2*B*a*b^2*c*d^6*f^ 
3*n/(d*x + c)^2 - 4*(b*x + a)^3*B*b^2*c^2*d^6*f^3*n/(d*x + c)^3 + 12*(b*x 
+ a)^2*B*a^2*b*d^7*f^3*n/(d*x + c)^2 + 8*(b*x + a)^3*B*a*b*c*d^7*f^3*n/(d* 
x + c)^3 - 4*(b*x + a)^3*B*a^2*d^8*f^3*n/(d*x + c)^3 - 6*B*b^5*c^3*d^2*f^2 
*g*n + 6*B*a*b^4*c^2*d^3*f^2*g*n + 24*(b*x + a)*B*b^4*c^3*d^3*f^2*g*n/(d*x 
 + c) + 6*B*a^2*b^3*c*d^4*f^2*g*n - 36*(b*x + a)*B*a*b^3*c^2*d^4*f^2*g*n/( 
d*x + c) - 30*(b*x + a)^2*B*b^3*c^3*d^4*f^2*g*n/(d*x + c)^2 - 6*B*a^3*b^2* 
d^5*f^2*g*n + 54*(b*x + a)^2*B*a*b^2*c^2*d^5*f^2*g*n/(d*x + c)^2 + 12*(b*x 
 + a)^3*B*b^2*c^3*d^5*f^2*g*n/(d*x + c)^3 + 12*(b*x + a)*B*a^3*b*d^6*f^2*g 
*n/(d*x + c) - 18*(b*x + a)^2*B*a^2*b*c*d^6*f^2*g*n/(d*x + c)^2 - 24*(b*x 
+ a)^3*B*a*b*c^2*d^6*f^2*g*n/(d*x + c)^3 - 6*(b*x + a)^2*B*a^3*d^7*f^2*g*n 
/(d*x + c)^2 + 12*(b*x + a)^3*B*a^2*c*d^7*f^2*g*n/(d*x + c)^3 + 4*B*b^5*c^ 
4*d*f*g^2*n - 4*B*a*b^4*c^3*d^2*f*g^2*n - 16*(b*x + a)*B*b^4*c^4*d^2*f*g^2 
*n/(d*x + c) + 16*(b*x + a)*B*a*b^3*c^3*d^3*f*g^2*n/(d*x + c) + 24*(b*x + 
a)^2*B*b^3*c^4*d^3*f*g^2*n/(d*x + c)^2 - 4*B*a^3*b^2*c*d^4*f*g^2*n + 12*(b 
*x + a)*B*a^2*b^2*c^2*d^4*f*g^2*n/(d*x + c) - 36*(b*x + a)^2*B*a*b^2*c^3*d 
^4*f*g^2*n/(d*x + c)^2 - 12*(b*x + a)^3*B*b^2*c^4*d^4*f*g^2*n/(d*x + c)...
 

Mupad [B] (verification not implemented)

Time = 26.15 (sec) , antiderivative size = 766, normalized size of antiderivative = 3.26 \[ \int (f+g x)^3 \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right ) \, dx=x\,\left (\frac {4\,A\,b\,d\,f^3+12\,A\,a\,c\,f\,g^2+12\,A\,a\,d\,f^2\,g+12\,A\,b\,c\,f^2\,g+6\,B\,a\,d\,f^2\,g\,n-6\,B\,b\,c\,f^2\,g\,n}{4\,b\,d}+\frac {\left (4\,a\,d+4\,b\,c\right )\,\left (\frac {\left (\frac {4\,A\,a\,d\,g^3+4\,A\,b\,c\,g^3+12\,A\,b\,d\,f\,g^2+B\,a\,d\,g^3\,n-B\,b\,c\,g^3\,n}{4\,b\,d}-\frac {A\,g^3\,\left (4\,a\,d+4\,b\,c\right )}{4\,b\,d}\right )\,\left (4\,a\,d+4\,b\,c\right )}{4\,b\,d}-\frac {4\,A\,a\,c\,g^3+12\,A\,a\,d\,f\,g^2+12\,A\,b\,c\,f\,g^2+12\,A\,b\,d\,f^2\,g+4\,B\,a\,d\,f\,g^2\,n-4\,B\,b\,c\,f\,g^2\,n}{4\,b\,d}+\frac {A\,a\,c\,g^3}{b\,d}\right )}{4\,b\,d}-\frac {a\,c\,\left (\frac {4\,A\,a\,d\,g^3+4\,A\,b\,c\,g^3+12\,A\,b\,d\,f\,g^2+B\,a\,d\,g^3\,n-B\,b\,c\,g^3\,n}{4\,b\,d}-\frac {A\,g^3\,\left (4\,a\,d+4\,b\,c\right )}{4\,b\,d}\right )}{b\,d}\right )-x^2\,\left (\frac {\left (\frac {4\,A\,a\,d\,g^3+4\,A\,b\,c\,g^3+12\,A\,b\,d\,f\,g^2+B\,a\,d\,g^3\,n-B\,b\,c\,g^3\,n}{4\,b\,d}-\frac {A\,g^3\,\left (4\,a\,d+4\,b\,c\right )}{4\,b\,d}\right )\,\left (4\,a\,d+4\,b\,c\right )}{8\,b\,d}-\frac {4\,A\,a\,c\,g^3+12\,A\,a\,d\,f\,g^2+12\,A\,b\,c\,f\,g^2+12\,A\,b\,d\,f^2\,g+4\,B\,a\,d\,f\,g^2\,n-4\,B\,b\,c\,f\,g^2\,n}{8\,b\,d}+\frac {A\,a\,c\,g^3}{2\,b\,d}\right )+x^3\,\left (\frac {4\,A\,a\,d\,g^3+4\,A\,b\,c\,g^3+12\,A\,b\,d\,f\,g^2+B\,a\,d\,g^3\,n-B\,b\,c\,g^3\,n}{12\,b\,d}-\frac {A\,g^3\,\left (4\,a\,d+4\,b\,c\right )}{12\,b\,d}\right )+\ln \left (e\,{\left (\frac {a+b\,x}{c+d\,x}\right )}^n\right )\,\left (B\,f^3\,x+\frac {3\,B\,f^2\,g\,x^2}{2}+B\,f\,g^2\,x^3+\frac {B\,g^3\,x^4}{4}\right )+\frac {A\,g^3\,x^4}{4}-\frac {\ln \left (a+b\,x\right )\,\left (B\,n\,a^4\,g^3-4\,B\,n\,a^3\,b\,f\,g^2+6\,B\,n\,a^2\,b^2\,f^2\,g-4\,B\,n\,a\,b^3\,f^3\right )}{4\,b^4}+\frac {\ln \left (c+d\,x\right )\,\left (B\,n\,c^4\,g^3-4\,B\,n\,c^3\,d\,f\,g^2+6\,B\,n\,c^2\,d^2\,f^2\,g-4\,B\,n\,c\,d^3\,f^3\right )}{4\,d^4} \] Input:

int((f + g*x)^3*(A + B*log(e*((a + b*x)/(c + d*x))^n)),x)
 

Output:

x*((4*A*b*d*f^3 + 12*A*a*c*f*g^2 + 12*A*a*d*f^2*g + 12*A*b*c*f^2*g + 6*B*a 
*d*f^2*g*n - 6*B*b*c*f^2*g*n)/(4*b*d) + ((4*a*d + 4*b*c)*((((4*A*a*d*g^3 + 
 4*A*b*c*g^3 + 12*A*b*d*f*g^2 + B*a*d*g^3*n - B*b*c*g^3*n)/(4*b*d) - (A*g^ 
3*(4*a*d + 4*b*c))/(4*b*d))*(4*a*d + 4*b*c))/(4*b*d) - (4*A*a*c*g^3 + 12*A 
*a*d*f*g^2 + 12*A*b*c*f*g^2 + 12*A*b*d*f^2*g + 4*B*a*d*f*g^2*n - 4*B*b*c*f 
*g^2*n)/(4*b*d) + (A*a*c*g^3)/(b*d)))/(4*b*d) - (a*c*((4*A*a*d*g^3 + 4*A*b 
*c*g^3 + 12*A*b*d*f*g^2 + B*a*d*g^3*n - B*b*c*g^3*n)/(4*b*d) - (A*g^3*(4*a 
*d + 4*b*c))/(4*b*d)))/(b*d)) - x^2*((((4*A*a*d*g^3 + 4*A*b*c*g^3 + 12*A*b 
*d*f*g^2 + B*a*d*g^3*n - B*b*c*g^3*n)/(4*b*d) - (A*g^3*(4*a*d + 4*b*c))/(4 
*b*d))*(4*a*d + 4*b*c))/(8*b*d) - (4*A*a*c*g^3 + 12*A*a*d*f*g^2 + 12*A*b*c 
*f*g^2 + 12*A*b*d*f^2*g + 4*B*a*d*f*g^2*n - 4*B*b*c*f*g^2*n)/(8*b*d) + (A* 
a*c*g^3)/(2*b*d)) + x^3*((4*A*a*d*g^3 + 4*A*b*c*g^3 + 12*A*b*d*f*g^2 + B*a 
*d*g^3*n - B*b*c*g^3*n)/(12*b*d) - (A*g^3*(4*a*d + 4*b*c))/(12*b*d)) + log 
(e*((a + b*x)/(c + d*x))^n)*((B*g^3*x^4)/4 + B*f^3*x + (3*B*f^2*g*x^2)/2 + 
 B*f*g^2*x^3) + (A*g^3*x^4)/4 - (log(a + b*x)*(B*a^4*g^3*n - 4*B*a*b^3*f^3 
*n - 4*B*a^3*b*f*g^2*n + 6*B*a^2*b^2*f^2*g*n))/(4*b^4) + (log(c + d*x)*(B* 
c^4*g^3*n - 4*B*c*d^3*f^3*n - 4*B*c^3*d*f*g^2*n + 6*B*c^2*d^2*f^2*g*n))/(4 
*d^4)
 

Reduce [B] (verification not implemented)

Time = 0.15 (sec) , antiderivative size = 680, normalized size of antiderivative = 2.89 \[ \int (f+g x)^3 \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right ) \, dx=\frac {-6 \,\mathrm {log}\left (\frac {\left (b x +a \right )^{n} e}{\left (d x +c \right )^{n}}\right ) a^{4} d^{4} g^{3}-6 \,\mathrm {log}\left (d x +c \right ) a^{4} d^{4} g^{3} n +6 \,\mathrm {log}\left (d x +c \right ) b^{4} c^{4} g^{3} n +24 \,\mathrm {log}\left (\frac {\left (b x +a \right )^{n} e}{\left (d x +c \right )^{n}}\right ) a \,b^{3} d^{4} f^{3}+24 \,\mathrm {log}\left (\frac {\left (b x +a \right )^{n} e}{\left (d x +c \right )^{n}}\right ) b^{4} d^{4} f^{3} x +6 \,\mathrm {log}\left (\frac {\left (b x +a \right )^{n} e}{\left (d x +c \right )^{n}}\right ) b^{4} d^{4} g^{3} x^{4}+24 a \,b^{3} d^{4} f^{3} x +6 a \,b^{3} d^{4} g^{3} x^{4}+24 \,\mathrm {log}\left (d x +c \right ) a^{3} b \,d^{4} f \,g^{2} n -36 \,\mathrm {log}\left (d x +c \right ) a^{2} b^{2} d^{4} f^{2} g n -24 \,\mathrm {log}\left (d x +c \right ) b^{4} c^{3} d f \,g^{2} n +36 \,\mathrm {log}\left (d x +c \right ) b^{4} c^{2} d^{2} f^{2} g n -24 a^{2} b^{2} d^{4} f \,g^{2} n x +36 a \,b^{3} d^{4} f^{2} g n x +12 a \,b^{3} d^{4} f \,g^{2} n \,x^{2}+24 b^{4} c^{2} d^{2} f \,g^{2} n x -36 b^{4} c \,d^{3} f^{2} g n x -12 b^{4} c \,d^{3} f \,g^{2} n \,x^{2}+24 \,\mathrm {log}\left (d x +c \right ) a \,b^{3} d^{4} f^{3} n -24 \,\mathrm {log}\left (d x +c \right ) b^{4} c \,d^{3} f^{3} n +24 \,\mathrm {log}\left (\frac {\left (b x +a \right )^{n} e}{\left (d x +c \right )^{n}}\right ) a^{3} b \,d^{4} f \,g^{2}-36 \,\mathrm {log}\left (\frac {\left (b x +a \right )^{n} e}{\left (d x +c \right )^{n}}\right ) a^{2} b^{2} d^{4} f^{2} g +36 \,\mathrm {log}\left (\frac {\left (b x +a \right )^{n} e}{\left (d x +c \right )^{n}}\right ) b^{4} d^{4} f^{2} g \,x^{2}+24 \,\mathrm {log}\left (\frac {\left (b x +a \right )^{n} e}{\left (d x +c \right )^{n}}\right ) b^{4} d^{4} f \,g^{2} x^{3}+6 a^{3} b \,d^{4} g^{3} n x -3 a^{2} b^{2} d^{4} g^{3} n \,x^{2}+36 a \,b^{3} d^{4} f^{2} g \,x^{2}+24 a \,b^{3} d^{4} f \,g^{2} x^{3}+2 a \,b^{3} d^{4} g^{3} n \,x^{3}-6 b^{4} c^{3} d \,g^{3} n x +3 b^{4} c^{2} d^{2} g^{3} n \,x^{2}-2 b^{4} c \,d^{3} g^{3} n \,x^{3}}{24 b^{3} d^{4}} \] Input:

int((g*x+f)^3*(A+B*log(e*((b*x+a)/(d*x+c))^n)),x)
 

Output:

( - 6*log(c + d*x)*a**4*d**4*g**3*n + 24*log(c + d*x)*a**3*b*d**4*f*g**2*n 
 - 36*log(c + d*x)*a**2*b**2*d**4*f**2*g*n + 24*log(c + d*x)*a*b**3*d**4*f 
**3*n + 6*log(c + d*x)*b**4*c**4*g**3*n - 24*log(c + d*x)*b**4*c**3*d*f*g* 
*2*n + 36*log(c + d*x)*b**4*c**2*d**2*f**2*g*n - 24*log(c + d*x)*b**4*c*d* 
*3*f**3*n - 6*log(((a + b*x)**n*e)/(c + d*x)**n)*a**4*d**4*g**3 + 24*log(( 
(a + b*x)**n*e)/(c + d*x)**n)*a**3*b*d**4*f*g**2 - 36*log(((a + b*x)**n*e) 
/(c + d*x)**n)*a**2*b**2*d**4*f**2*g + 24*log(((a + b*x)**n*e)/(c + d*x)** 
n)*a*b**3*d**4*f**3 + 24*log(((a + b*x)**n*e)/(c + d*x)**n)*b**4*d**4*f**3 
*x + 36*log(((a + b*x)**n*e)/(c + d*x)**n)*b**4*d**4*f**2*g*x**2 + 24*log( 
((a + b*x)**n*e)/(c + d*x)**n)*b**4*d**4*f*g**2*x**3 + 6*log(((a + b*x)**n 
*e)/(c + d*x)**n)*b**4*d**4*g**3*x**4 + 6*a**3*b*d**4*g**3*n*x - 24*a**2*b 
**2*d**4*f*g**2*n*x - 3*a**2*b**2*d**4*g**3*n*x**2 + 24*a*b**3*d**4*f**3*x 
 + 36*a*b**3*d**4*f**2*g*n*x + 36*a*b**3*d**4*f**2*g*x**2 + 12*a*b**3*d**4 
*f*g**2*n*x**2 + 24*a*b**3*d**4*f*g**2*x**3 + 2*a*b**3*d**4*g**3*n*x**3 + 
6*a*b**3*d**4*g**3*x**4 - 6*b**4*c**3*d*g**3*n*x + 24*b**4*c**2*d**2*f*g** 
2*n*x + 3*b**4*c**2*d**2*g**3*n*x**2 - 36*b**4*c*d**3*f**2*g*n*x - 12*b**4 
*c*d**3*f*g**2*n*x**2 - 2*b**4*c*d**3*g**3*n*x**3)/(24*b**3*d**4)