\(\int \log ^2(a+b \tan (c+d x)) \, dx\) [2]

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

Optimal result

Integrand size = 13, antiderivative size = 230 \[ \int \log ^2(a+b \tan (c+d x)) \, dx=-\frac {i \log \left (\frac {b (i-\tan (c+d x))}{a+i b}\right ) \log ^2(a+b \tan (c+d x))}{2 d}+\frac {i \log \left (-\frac {b (i+\tan (c+d x))}{a-i b}\right ) \log ^2(a+b \tan (c+d x))}{2 d}+\frac {i \log (a+b \tan (c+d x)) \operatorname {PolyLog}\left (2,\frac {a+b \tan (c+d x)}{a-i b}\right )}{d}-\frac {i \log (a+b \tan (c+d x)) \operatorname {PolyLog}\left (2,\frac {a+b \tan (c+d x)}{a+i b}\right )}{d}-\frac {i \operatorname {PolyLog}\left (3,\frac {a+b \tan (c+d x)}{a-i b}\right )}{d}+\frac {i \operatorname {PolyLog}\left (3,\frac {a+b \tan (c+d x)}{a+i b}\right )}{d} \] Output:

-1/2*I*ln(b*(I-tan(d*x+c))/(a+I*b))*ln(a+b*tan(d*x+c))^2/d+1/2*I*ln(-b*(I+ 
tan(d*x+c))/(a-I*b))*ln(a+b*tan(d*x+c))^2/d+I*ln(a+b*tan(d*x+c))*polylog(2 
,(a+b*tan(d*x+c))/(a-I*b))/d-I*ln(a+b*tan(d*x+c))*polylog(2,(a+b*tan(d*x+c 
))/(a+I*b))/d-I*polylog(3,(a+b*tan(d*x+c))/(a-I*b))/d+I*polylog(3,(a+b*tan 
(d*x+c))/(a+I*b))/d
 

Mathematica [A] (verified)

Time = 0.35 (sec) , antiderivative size = 203, normalized size of antiderivative = 0.88 \[ \int \log ^2(a+b \tan (c+d x)) \, dx=\frac {i \left (-\log \left (-\frac {b (-i+\tan (c+d x))}{a+i b}\right ) \log ^2(a+b \tan (c+d x))+\log \left (-\frac {b (i+\tan (c+d x))}{a-i b}\right ) \log ^2(a+b \tan (c+d x))+2 \log (a+b \tan (c+d x)) \operatorname {PolyLog}\left (2,\frac {a+b \tan (c+d x)}{a-i b}\right )-2 \log (a+b \tan (c+d x)) \operatorname {PolyLog}\left (2,\frac {a+b \tan (c+d x)}{a+i b}\right )-2 \operatorname {PolyLog}\left (3,\frac {a+b \tan (c+d x)}{a-i b}\right )+2 \operatorname {PolyLog}\left (3,\frac {a+b \tan (c+d x)}{a+i b}\right )\right )}{2 d} \] Input:

Integrate[Log[a + b*Tan[c + d*x]]^2,x]
 

Output:

((I/2)*(-(Log[-((b*(-I + Tan[c + d*x]))/(a + I*b))]*Log[a + b*Tan[c + d*x] 
]^2) + Log[-((b*(I + Tan[c + d*x]))/(a - I*b))]*Log[a + b*Tan[c + d*x]]^2 
+ 2*Log[a + b*Tan[c + d*x]]*PolyLog[2, (a + b*Tan[c + d*x])/(a - I*b)] - 2 
*Log[a + b*Tan[c + d*x]]*PolyLog[2, (a + b*Tan[c + d*x])/(a + I*b)] - 2*Po 
lyLog[3, (a + b*Tan[c + d*x])/(a - I*b)] + 2*PolyLog[3, (a + b*Tan[c + d*x 
])/(a + I*b)]))/d
 

Rubi [A] (verified)

Time = 0.73 (sec) , antiderivative size = 216, normalized size of antiderivative = 0.94, number of steps used = 4, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.231, Rules used = {4853, 2856, 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 \log ^2(a+b \tan (c+d x)) \, dx\)

\(\Big \downarrow \) 4853

\(\displaystyle \frac {\int \frac {\log ^2(a+b \tan (c+d x))}{\tan ^2(c+d x)+1}d\tan (c+d x)}{d}\)

\(\Big \downarrow \) 2856

\(\displaystyle \frac {\int \left (\frac {i \log ^2(a+b \tan (c+d x))}{2 (i-\tan (c+d x))}+\frac {i \log ^2(a+b \tan (c+d x))}{2 (\tan (c+d x)+i)}\right )d\tan (c+d x)}{d}\)

\(\Big \downarrow \) 2009

\(\displaystyle \frac {-i \operatorname {PolyLog}\left (3,\frac {a+b \tan (c+d x)}{a-i b}\right )+i \operatorname {PolyLog}\left (3,\frac {a+b \tan (c+d x)}{a+i b}\right )+i \operatorname {PolyLog}\left (2,\frac {a+b \tan (c+d x)}{a-i b}\right ) \log (a+b \tan (c+d x))-i \operatorname {PolyLog}\left (2,\frac {a+b \tan (c+d x)}{a+i b}\right ) \log (a+b \tan (c+d x))-\frac {1}{2} i \log \left (\frac {b (-\tan (c+d x)+i)}{a+i b}\right ) \log ^2(a+b \tan (c+d x))+\frac {1}{2} i \log \left (-\frac {b (\tan (c+d x)+i)}{a-i b}\right ) \log ^2(a+b \tan (c+d x))}{d}\)

Input:

Int[Log[a + b*Tan[c + d*x]]^2,x]
 

Output:

((-1/2*I)*Log[(b*(I - Tan[c + d*x]))/(a + I*b)]*Log[a + b*Tan[c + d*x]]^2 
+ (I/2)*Log[-((b*(I + Tan[c + d*x]))/(a - I*b))]*Log[a + b*Tan[c + d*x]]^2 
 + I*Log[a + b*Tan[c + d*x]]*PolyLog[2, (a + b*Tan[c + d*x])/(a - I*b)] - 
I*Log[a + b*Tan[c + d*x]]*PolyLog[2, (a + b*Tan[c + d*x])/(a + I*b)] - I*P 
olyLog[3, (a + b*Tan[c + d*x])/(a - I*b)] + I*PolyLog[3, (a + b*Tan[c + d* 
x])/(a + I*b)])/d
 

Defintions of rubi rules used

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

rule 2856
Int[((a_.) + Log[(c_.)*((d_) + (e_.)*(x_))^(n_.)]*(b_.))^(p_.)*((f_) + (g_. 
)*(x_)^(r_))^(q_.), x_Symbol] :> Int[ExpandIntegrand[(a + b*Log[c*(d + e*x) 
^n])^p, (f + g*x^r)^q, x], x] /; FreeQ[{a, b, c, d, e, f, g, n, r}, x] && I 
GtQ[p, 0] && IntegerQ[q] && (GtQ[q, 0] || (IntegerQ[r] && NeQ[r, 1]))
 

rule 4853
Int[u_, x_Symbol] :> With[{v = FunctionOfTrig[u, x]}, Simp[With[{d = FreeFa 
ctors[Tan[v], x]}, d/Coefficient[v, x, 1]   Subst[Int[SubstFor[1/(1 + d^2*x 
^2), Tan[v]/d, u, x], x], x, Tan[v]/d]], x] /;  !FalseQ[v] && FunctionOfQ[N 
onfreeFactors[Tan[v], x], u, x, True] && TryPureTanSubst[ActivateTrig[u], x 
]]
 
Maple [F]

\[\int \ln \left (a +b \tan \left (d x +c \right )\right )^{2}d x\]

Input:

int(ln(a+b*tan(d*x+c))^2,x)
 

Output:

int(ln(a+b*tan(d*x+c))^2,x)
 

Fricas [F]

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

integrate(log(a+b*tan(d*x+c))^2,x, algorithm="fricas")
 

Output:

integral(log(b*tan(d*x + c) + a)^2, x)
 

Sympy [F]

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

integrate(ln(a+b*tan(d*x+c))**2,x)
 

Output:

Integral(log(a + b*tan(c + d*x))**2, x)
 

Maxima [F(-2)]

Exception generated. \[ \int \log ^2(a+b \tan (c+d x)) \, dx=\text {Exception raised: RuntimeError} \] Input:

integrate(log(a+b*tan(d*x+c))^2,x, algorithm="maxima")
 

Output:

Exception raised: RuntimeError >> ECL says: BINDING-STACK overflow at size 
 10240. Stack can probably be resized.Proceed with caution.
 

Giac [F]

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

integrate(log(a+b*tan(d*x+c))^2,x, algorithm="giac")
 

Output:

integrate(log(b*tan(d*x + c) + a)^2, x)
 

Mupad [F(-1)]

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

int(log(a + b*tan(c + d*x))^2,x)
 

Output:

int(log(a + b*tan(c + d*x))^2, x)
 

Reduce [F]

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

int(log(a+b*tan(d*x+c))^2,x)
 

Output:

int(log(tan(c + d*x)*b + a)**2,x)