\(\int x (a+b \arctan (c x)) (d+e \log (f+g x^2)) \, dx\) [1295]

Optimal result
Mathematica [B] (warning: unable to verify)
Rubi [A] (verified)
Maple [F]
Fricas [F]
Sympy [F(-1)]
Maxima [F]
Giac [F]
Mupad [F(-1)]
Reduce [F]

Optimal result

Integrand size = 22, antiderivative size = 562 \[ \int x (a+b \arctan (c x)) \left (d+e \log \left (f+g x^2\right )\right ) \, dx=-\frac {b (d-e) x}{2 c}+\frac {b e x}{c}+\frac {b (d-e) \arctan (c x)}{2 c^2}+\frac {1}{2} d x^2 (a+b \arctan (c x))-\frac {1}{2} e x^2 (a+b \arctan (c x))-\frac {b e \sqrt {f} \arctan \left (\frac {\sqrt {g} x}{\sqrt {f}}\right )}{c \sqrt {g}}-\frac {b e \left (c^2 f-g\right ) \arctan (c x) \log \left (\frac {2}{1-i c x}\right )}{c^2 g}+\frac {b e \left (c^2 f-g\right ) \arctan (c x) \log \left (\frac {2 c \left (\sqrt {-f}-\sqrt {g} x\right )}{\left (c \sqrt {-f}-i \sqrt {g}\right ) (1-i c x)}\right )}{2 c^2 g}+\frac {b e \left (c^2 f-g\right ) \arctan (c x) \log \left (\frac {2 c \left (\sqrt {-f}+\sqrt {g} x\right )}{\left (c \sqrt {-f}+i \sqrt {g}\right ) (1-i c x)}\right )}{2 c^2 g}-\frac {b e x \log \left (f+g x^2\right )}{2 c}-\frac {b e \left (c^2 f-g\right ) \arctan (c x) \log \left (f+g x^2\right )}{2 c^2 g}+\frac {e \left (f+g x^2\right ) (a+b \arctan (c x)) \log \left (f+g x^2\right )}{2 g}+\frac {i b e \left (c^2 f-g\right ) \operatorname {PolyLog}\left (2,1-\frac {2}{1-i c x}\right )}{2 c^2 g}-\frac {i b e \left (c^2 f-g\right ) \operatorname {PolyLog}\left (2,1-\frac {2 c \left (\sqrt {-f}-\sqrt {g} x\right )}{\left (c \sqrt {-f}-i \sqrt {g}\right ) (1-i c x)}\right )}{4 c^2 g}-\frac {i b e \left (c^2 f-g\right ) \operatorname {PolyLog}\left (2,1-\frac {2 c \left (\sqrt {-f}+\sqrt {g} x\right )}{\left (c \sqrt {-f}+i \sqrt {g}\right ) (1-i c x)}\right )}{4 c^2 g} \] Output:

-1/2*b*(d-e)*x/c+b*e*x/c+1/2*b*(d-e)*arctan(c*x)/c^2+1/2*d*x^2*(a+b*arctan 
(c*x))-1/2*e*x^2*(a+b*arctan(c*x))-b*e*f^(1/2)*arctan(g^(1/2)*x/f^(1/2))/c 
/g^(1/2)-b*e*(c^2*f-g)*arctan(c*x)*ln(2/(1-I*c*x))/c^2/g+1/2*b*e*(c^2*f-g) 
*arctan(c*x)*ln(2*c*((-f)^(1/2)-g^(1/2)*x)/(c*(-f)^(1/2)-I*g^(1/2))/(1-I*c 
*x))/c^2/g+1/2*b*e*(c^2*f-g)*arctan(c*x)*ln(2*c*((-f)^(1/2)+g^(1/2)*x)/(c* 
(-f)^(1/2)+I*g^(1/2))/(1-I*c*x))/c^2/g-1/2*b*e*x*ln(g*x^2+f)/c-1/2*b*e*(c^ 
2*f-g)*arctan(c*x)*ln(g*x^2+f)/c^2/g+1/2*e*(g*x^2+f)*(a+b*arctan(c*x))*ln( 
g*x^2+f)/g+1/2*I*b*e*(c^2*f-g)*polylog(2,1-2/(1-I*c*x))/c^2/g-1/4*I*b*e*(c 
^2*f-g)*polylog(2,1-2*c*((-f)^(1/2)-g^(1/2)*x)/(c*(-f)^(1/2)-I*g^(1/2))/(1 
-I*c*x))/c^2/g-1/4*I*b*e*(c^2*f-g)*polylog(2,1-2*c*((-f)^(1/2)+g^(1/2)*x)/ 
(c*(-f)^(1/2)+I*g^(1/2))/(1-I*c*x))/c^2/g
 

Mathematica [B] (warning: unable to verify)

Both result and optimal contain complex but leaf count is larger than twice the leaf count of optimal. \(1140\) vs. \(2(562)=1124\).

Time = 6.14 (sec) , antiderivative size = 1140, normalized size of antiderivative = 2.03 \[ \int x (a+b \arctan (c x)) \left (d+e \log \left (f+g x^2\right )\right ) \, dx =\text {Too large to display} \] Input:

Integrate[x*(a + b*ArcTan[c*x])*(d + e*Log[f + g*x^2]),x]
 

Output:

(-2*b*c*d*g*x + 6*b*c*e*g*x + 2*a*c^2*d*g*x^2 - 2*a*c^2*e*g*x^2 + 2*b*d*g* 
ArcTan[c*x] - 2*b*e*g*ArcTan[c*x] + 2*b*c^2*d*g*x^2*ArcTan[c*x] - 2*b*c^2* 
e*g*x^2*ArcTan[c*x] - 4*b*c*e*Sqrt[f]*Sqrt[g]*ArcTan[(Sqrt[g]*x)/Sqrt[f]] 
+ (4*I)*b*c^2*e*f*ArcSin[Sqrt[(c^2*f)/(c^2*f - g)]]*ArcTan[(c*g*x)/Sqrt[c^ 
2*f*g]] - (4*I)*b*e*g*ArcSin[Sqrt[(c^2*f)/(c^2*f - g)]]*ArcTan[(c*g*x)/Sqr 
t[c^2*f*g]] - 4*b*c^2*e*f*ArcTan[c*x]*Log[1 + E^((2*I)*ArcTan[c*x])] + 4*b 
*e*g*ArcTan[c*x]*Log[1 + E^((2*I)*ArcTan[c*x])] + 2*b*c^2*e*f*ArcSin[Sqrt[ 
(c^2*f)/(c^2*f - g)]]*Log[(c^2*(1 + E^((2*I)*ArcTan[c*x]))*f + (-1 + E^((2 
*I)*ArcTan[c*x]))*g - 2*E^((2*I)*ArcTan[c*x])*Sqrt[c^2*f*g])/(c^2*f - g)] 
- 2*b*e*g*ArcSin[Sqrt[(c^2*f)/(c^2*f - g)]]*Log[(c^2*(1 + E^((2*I)*ArcTan[ 
c*x]))*f + (-1 + E^((2*I)*ArcTan[c*x]))*g - 2*E^((2*I)*ArcTan[c*x])*Sqrt[c 
^2*f*g])/(c^2*f - g)] + 2*b*c^2*e*f*ArcTan[c*x]*Log[(c^2*(1 + E^((2*I)*Arc 
Tan[c*x]))*f + (-1 + E^((2*I)*ArcTan[c*x]))*g - 2*E^((2*I)*ArcTan[c*x])*Sq 
rt[c^2*f*g])/(c^2*f - g)] - 2*b*e*g*ArcTan[c*x]*Log[(c^2*(1 + E^((2*I)*Arc 
Tan[c*x]))*f + (-1 + E^((2*I)*ArcTan[c*x]))*g - 2*E^((2*I)*ArcTan[c*x])*Sq 
rt[c^2*f*g])/(c^2*f - g)] - 2*b*c^2*e*f*ArcSin[Sqrt[(c^2*f)/(c^2*f - g)]]* 
Log[1 + (E^((2*I)*ArcTan[c*x])*(c^2*f + g + 2*Sqrt[c^2*f*g]))/(c^2*f - g)] 
 + 2*b*e*g*ArcSin[Sqrt[(c^2*f)/(c^2*f - g)]]*Log[1 + (E^((2*I)*ArcTan[c*x] 
)*(c^2*f + g + 2*Sqrt[c^2*f*g]))/(c^2*f - g)] + 2*b*c^2*e*f*ArcTan[c*x]*Lo 
g[1 + (E^((2*I)*ArcTan[c*x])*(c^2*f + g + 2*Sqrt[c^2*f*g]))/(c^2*f - g)...
 

Rubi [A] (verified)

Time = 0.97 (sec) , antiderivative size = 554, normalized size of antiderivative = 0.99, number of steps used = 2, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.091, Rules used = {5554, 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 x (a+b \arctan (c x)) \left (d+e \log \left (f+g x^2\right )\right ) \, dx\)

\(\Big \downarrow \) 5554

\(\displaystyle -b c \int \left (\frac {(d-e) x^2}{2 \left (c^2 x^2+1\right )}+\frac {e \left (g x^2+f\right ) \log \left (g x^2+f\right )}{2 g \left (c^2 x^2+1\right )}\right )dx+\frac {1}{2} d x^2 (a+b \arctan (c x))+\frac {e \left (f+g x^2\right ) \log \left (f+g x^2\right ) (a+b \arctan (c x))}{2 g}-\frac {1}{2} e x^2 (a+b \arctan (c x))\)

\(\Big \downarrow \) 2009

\(\displaystyle \frac {1}{2} d x^2 (a+b \arctan (c x))+\frac {e \left (f+g x^2\right ) \log \left (f+g x^2\right ) (a+b \arctan (c x))}{2 g}-\frac {1}{2} e x^2 (a+b \arctan (c x))-b c \left (-\frac {(d-e) \arctan (c x)}{2 c^3}+\frac {e \sqrt {f} \arctan \left (\frac {\sqrt {g} x}{\sqrt {f}}\right )}{c^2 \sqrt {g}}+\frac {e \arctan (c x) \left (c^2 f-g\right ) \log \left (f+g x^2\right )}{2 c^3 g}+\frac {e \arctan (c x) \left (c^2 f-g\right ) \log \left (\frac {2}{1-i c x}\right )}{c^3 g}-\frac {e \arctan (c x) \left (c^2 f-g\right ) \log \left (\frac {2 c \left (\sqrt {-f}-\sqrt {g} x\right )}{(1-i c x) \left (c \sqrt {-f}-i \sqrt {g}\right )}\right )}{2 c^3 g}-\frac {e \arctan (c x) \left (c^2 f-g\right ) \log \left (\frac {2 c \left (\sqrt {-f}+\sqrt {g} x\right )}{(1-i c x) \left (c \sqrt {-f}+i \sqrt {g}\right )}\right )}{2 c^3 g}+\frac {x (d-e)}{2 c^2}+\frac {e x \log \left (f+g x^2\right )}{2 c^2}-\frac {e x}{c^2}-\frac {i e \left (c^2 f-g\right ) \operatorname {PolyLog}\left (2,1-\frac {2}{1-i c x}\right )}{2 c^3 g}+\frac {i e \left (c^2 f-g\right ) \operatorname {PolyLog}\left (2,1-\frac {2 c \left (\sqrt {-f}-\sqrt {g} x\right )}{\left (c \sqrt {-f}-i \sqrt {g}\right ) (1-i c x)}\right )}{4 c^3 g}+\frac {i e \left (c^2 f-g\right ) \operatorname {PolyLog}\left (2,1-\frac {2 c \left (\sqrt {g} x+\sqrt {-f}\right )}{\left (\sqrt {-f} c+i \sqrt {g}\right ) (1-i c x)}\right )}{4 c^3 g}\right )\)

Input:

Int[x*(a + b*ArcTan[c*x])*(d + e*Log[f + g*x^2]),x]
 

Output:

(d*x^2*(a + b*ArcTan[c*x]))/2 - (e*x^2*(a + b*ArcTan[c*x]))/2 + (e*(f + g* 
x^2)*(a + b*ArcTan[c*x])*Log[f + g*x^2])/(2*g) - b*c*(((d - e)*x)/(2*c^2) 
- (e*x)/c^2 - ((d - e)*ArcTan[c*x])/(2*c^3) + (e*Sqrt[f]*ArcTan[(Sqrt[g]*x 
)/Sqrt[f]])/(c^2*Sqrt[g]) + (e*(c^2*f - g)*ArcTan[c*x]*Log[2/(1 - I*c*x)]) 
/(c^3*g) - (e*(c^2*f - g)*ArcTan[c*x]*Log[(2*c*(Sqrt[-f] - Sqrt[g]*x))/((c 
*Sqrt[-f] - I*Sqrt[g])*(1 - I*c*x))])/(2*c^3*g) - (e*(c^2*f - g)*ArcTan[c* 
x]*Log[(2*c*(Sqrt[-f] + Sqrt[g]*x))/((c*Sqrt[-f] + I*Sqrt[g])*(1 - I*c*x)) 
])/(2*c^3*g) + (e*x*Log[f + g*x^2])/(2*c^2) + (e*(c^2*f - g)*ArcTan[c*x]*L 
og[f + g*x^2])/(2*c^3*g) - ((I/2)*e*(c^2*f - g)*PolyLog[2, 1 - 2/(1 - I*c* 
x)])/(c^3*g) + ((I/4)*e*(c^2*f - g)*PolyLog[2, 1 - (2*c*(Sqrt[-f] - Sqrt[g 
]*x))/((c*Sqrt[-f] - I*Sqrt[g])*(1 - I*c*x))])/(c^3*g) + ((I/4)*e*(c^2*f - 
 g)*PolyLog[2, 1 - (2*c*(Sqrt[-f] + Sqrt[g]*x))/((c*Sqrt[-f] + I*Sqrt[g])* 
(1 - I*c*x))])/(c^3*g))
 

Defintions of rubi rules used

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

rule 5554
Int[((a_.) + ArcTan[(c_.)*(x_)]*(b_.))*((d_.) + Log[(f_.) + (g_.)*(x_)^2]*( 
e_.))*(x_)^(m_.), x_Symbol] :> With[{u = IntHide[x^m*(d + e*Log[f + g*x^2]) 
, x]}, Simp[(a + b*ArcTan[c*x])   u, x] - Simp[b*c   Int[ExpandIntegrand[u/ 
(1 + c^2*x^2), x], x], x]] /; FreeQ[{a, b, c, d, e, f, g}, x] && IGtQ[(m + 
1)/2, 0]
 
Maple [F]

\[\int x \left (a +b \arctan \left (c x \right )\right ) \left (d +e \ln \left (g \,x^{2}+f \right )\right )d x\]

Input:

int(x*(a+b*arctan(c*x))*(d+e*ln(g*x^2+f)),x)
 

Output:

int(x*(a+b*arctan(c*x))*(d+e*ln(g*x^2+f)),x)
 

Fricas [F]

\[ \int x (a+b \arctan (c x)) \left (d+e \log \left (f+g x^2\right )\right ) \, dx=\int { {\left (b \arctan \left (c x\right ) + a\right )} {\left (e \log \left (g x^{2} + f\right ) + d\right )} x \,d x } \] Input:

integrate(x*(a+b*arctan(c*x))*(d+e*log(g*x^2+f)),x, algorithm="fricas")
 

Output:

integral(b*d*x*arctan(c*x) + a*d*x + (b*e*x*arctan(c*x) + a*e*x)*log(g*x^2 
 + f), x)
 

Sympy [F(-1)]

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

integrate(x*(a+b*atan(c*x))*(d+e*ln(g*x**2+f)),x)
 

Output:

Timed out
 

Maxima [F]

\[ \int x (a+b \arctan (c x)) \left (d+e \log \left (f+g x^2\right )\right ) \, dx=\int { {\left (b \arctan \left (c x\right ) + a\right )} {\left (e \log \left (g x^{2} + f\right ) + d\right )} x \,d x } \] Input:

integrate(x*(a+b*arctan(c*x))*(d+e*log(g*x^2+f)),x, algorithm="maxima")
 

Output:

1/2*a*d*x^2 + 1/2*(x^2*arctan(c*x) - c*(x/c^2 - arctan(c*x)/c^3))*b*d - 1/ 
2*(g*x^2 - (g*x^2 + f)*log(g*x^2 + f) + f)*a*e/g - 1/2*(2*c*f*arctan(g*x/s 
qrt(f*g)) + (4*c^4*g*integrate(1/2*x^3*arctan(c*x)/(c^2*g*x^2 + c^2*f), x) 
 + 4*c^2*g*integrate(1/2*x*arctan(c*x)/(c^2*g*x^2 + c^2*f), x) - 2*c*x + ( 
c*x - (c^2*x^2 + 1)*arctan(c*x))*log(g*x^2 + f))*sqrt(f*g))*b*e/(sqrt(f*g) 
*c^2)
 

Giac [F]

\[ \int x (a+b \arctan (c x)) \left (d+e \log \left (f+g x^2\right )\right ) \, dx=\int { {\left (b \arctan \left (c x\right ) + a\right )} {\left (e \log \left (g x^{2} + f\right ) + d\right )} x \,d x } \] Input:

integrate(x*(a+b*arctan(c*x))*(d+e*log(g*x^2+f)),x, algorithm="giac")
 

Output:

integrate((b*arctan(c*x) + a)*(e*log(g*x^2 + f) + d)*x, x)
 

Mupad [F(-1)]

Timed out. \[ \int x (a+b \arctan (c x)) \left (d+e \log \left (f+g x^2\right )\right ) \, dx=\int x\,\left (a+b\,\mathrm {atan}\left (c\,x\right )\right )\,\left (d+e\,\ln \left (g\,x^2+f\right )\right ) \,d x \] Input:

int(x*(a + b*atan(c*x))*(d + e*log(f + g*x^2)),x)
 

Output:

int(x*(a + b*atan(c*x))*(d + e*log(f + g*x^2)), x)
 

Reduce [F]

\[ \int x (a+b \arctan (c x)) \left (d+e \log \left (f+g x^2\right )\right ) \, dx=\frac {-2 \sqrt {g}\, \sqrt {f}\, \mathit {atan} \left (\frac {g x}{\sqrt {g}\, \sqrt {f}}\right ) b c e +\mathit {atan} \left (c x \right ) \mathrm {log}\left (g \,x^{2}+f \right ) b \,c^{2} e f +\mathit {atan} \left (c x \right ) \mathrm {log}\left (g \,x^{2}+f \right ) b \,c^{2} e g \,x^{2}+\mathit {atan} \left (c x \right ) b \,c^{2} d g \,x^{2}-\mathit {atan} \left (c x \right ) b \,c^{2} e g \,x^{2}+\mathit {atan} \left (c x \right ) b d g -\mathit {atan} \left (c x \right ) b e g -\left (\int \frac {\mathrm {log}\left (g \,x^{2}+f \right )}{c^{2} x^{2}+1}d x \right ) b \,c^{3} e f +\left (\int \frac {\mathrm {log}\left (g \,x^{2}+f \right )}{c^{2} x^{2}+1}d x \right ) b c e g +\mathrm {log}\left (g \,x^{2}+f \right ) a \,c^{2} e f +\mathrm {log}\left (g \,x^{2}+f \right ) a \,c^{2} e g \,x^{2}-\mathrm {log}\left (g \,x^{2}+f \right ) b c e g x +a \,c^{2} d g \,x^{2}-a \,c^{2} e g \,x^{2}-b c d g x +3 b c e g x}{2 c^{2} g} \] Input:

int(x*(a+b*atan(c*x))*(d+e*log(g*x^2+f)),x)
 

Output:

( - 2*sqrt(g)*sqrt(f)*atan((g*x)/(sqrt(g)*sqrt(f)))*b*c*e + atan(c*x)*log( 
f + g*x**2)*b*c**2*e*f + atan(c*x)*log(f + g*x**2)*b*c**2*e*g*x**2 + atan( 
c*x)*b*c**2*d*g*x**2 - atan(c*x)*b*c**2*e*g*x**2 + atan(c*x)*b*d*g - atan( 
c*x)*b*e*g - int(log(f + g*x**2)/(c**2*x**2 + 1),x)*b*c**3*e*f + int(log(f 
 + g*x**2)/(c**2*x**2 + 1),x)*b*c*e*g + log(f + g*x**2)*a*c**2*e*f + log(f 
 + g*x**2)*a*c**2*e*g*x**2 - log(f + g*x**2)*b*c*e*g*x + a*c**2*d*g*x**2 - 
 a*c**2*e*g*x**2 - b*c*d*g*x + 3*b*c*e*g*x)/(2*c**2*g)