\(\int (e+f x) \text {arctanh}(\cot (a+b x)) \, dx\) [331]

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

Optimal result

Integrand size = 13, antiderivative size = 162 \[ \int (e+f x) \text {arctanh}(\cot (a+b x)) \, dx=\frac {i (e+f x)^2 \arctan \left (e^{2 i (a+b x)}\right )}{2 f}+\frac {(e+f x)^2 \text {arctanh}(\cot (a+b x))}{2 f}-\frac {i (e+f x) \operatorname {PolyLog}\left (2,-i e^{2 i (a+b x)}\right )}{4 b}+\frac {i (e+f x) \operatorname {PolyLog}\left (2,i e^{2 i (a+b x)}\right )}{4 b}+\frac {f \operatorname {PolyLog}\left (3,-i e^{2 i (a+b x)}\right )}{8 b^2}-\frac {f \operatorname {PolyLog}\left (3,i e^{2 i (a+b x)}\right )}{8 b^2} \] Output:

1/2*I*(f*x+e)^2*arctan(exp(2*I*(b*x+a)))/f+1/2*(f*x+e)^2*arctanh(cot(b*x+a 
))/f-1/4*I*(f*x+e)*polylog(2,-I*exp(2*I*(b*x+a)))/b+1/4*I*(f*x+e)*polylog( 
2,I*exp(2*I*(b*x+a)))/b+1/8*f*polylog(3,-I*exp(2*I*(b*x+a)))/b^2-1/8*f*pol 
ylog(3,I*exp(2*I*(b*x+a)))/b^2
 

Mathematica [A] (verified)

Time = 0.20 (sec) , antiderivative size = 295, normalized size of antiderivative = 1.82 \[ \int (e+f x) \text {arctanh}(\cot (a+b x)) \, dx=e x \text {arctanh}(\cot (a+b x))+\frac {1}{2} f x^2 \text {arctanh}(\cot (a+b x))-\frac {e \left ((-4 a+\pi -4 b x) \left (\log \left (1-i e^{-2 i (a+b x)}\right )-\log \left (1+i e^{-2 i (a+b x)}\right )\right )-(-4 a+\pi ) \log \left (\cot \left (a+\frac {\pi }{4}+b x\right )\right )+2 i \left (\operatorname {PolyLog}\left (2,-i e^{-2 i (a+b x)}\right )-\operatorname {PolyLog}\left (2,i e^{-2 i (a+b x)}\right )\right )\right )}{8 b}+\frac {f \left (4 i b^2 x^2 \arctan (\cos (2 (a+b x))+i \sin (2 (a+b x)))+2 i b x \operatorname {PolyLog}(2,i \cos (2 (a+b x))-\sin (2 (a+b x)))-2 i b x \operatorname {PolyLog}(2,-i \cos (2 (a+b x))+\sin (2 (a+b x)))-\operatorname {PolyLog}(3,i \cos (2 (a+b x))-\sin (2 (a+b x)))+\operatorname {PolyLog}(3,-i \cos (2 (a+b x))+\sin (2 (a+b x)))\right )}{8 b^2} \] Input:

Integrate[(e + f*x)*ArcTanh[Cot[a + b*x]],x]
 

Output:

e*x*ArcTanh[Cot[a + b*x]] + (f*x^2*ArcTanh[Cot[a + b*x]])/2 - (e*((-4*a + 
Pi - 4*b*x)*(Log[1 - I/E^((2*I)*(a + b*x))] - Log[1 + I/E^((2*I)*(a + b*x) 
)]) - (-4*a + Pi)*Log[Cot[a + Pi/4 + b*x]] + (2*I)*(PolyLog[2, (-I)/E^((2* 
I)*(a + b*x))] - PolyLog[2, I/E^((2*I)*(a + b*x))])))/(8*b) + (f*((4*I)*b^ 
2*x^2*ArcTan[Cos[2*(a + b*x)] + I*Sin[2*(a + b*x)]] + (2*I)*b*x*PolyLog[2, 
 I*Cos[2*(a + b*x)] - Sin[2*(a + b*x)]] - (2*I)*b*x*PolyLog[2, (-I)*Cos[2* 
(a + b*x)] + Sin[2*(a + b*x)]] - PolyLog[3, I*Cos[2*(a + b*x)] - Sin[2*(a 
+ b*x)]] + PolyLog[3, (-I)*Cos[2*(a + b*x)] + Sin[2*(a + b*x)]]))/(8*b^2)
 

Rubi [A] (verified)

Time = 0.64 (sec) , antiderivative size = 182, normalized size of antiderivative = 1.12, number of steps used = 7, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.462, Rules used = {6807, 3042, 4669, 3011, 2720, 7143}

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 (e+f x) \text {arctanh}(\cot (a+b x)) \, dx\)

\(\Big \downarrow \) 6807

\(\displaystyle \frac {(e+f x)^2 \text {arctanh}(\cot (a+b x))}{2 f}-\frac {b \int (e+f x)^2 \sec (2 a+2 b x)dx}{2 f}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {(e+f x)^2 \text {arctanh}(\cot (a+b x))}{2 f}-\frac {b \int (e+f x)^2 \csc \left (2 a+2 b x+\frac {\pi }{2}\right )dx}{2 f}\)

\(\Big \downarrow \) 4669

\(\displaystyle \frac {(e+f x)^2 \text {arctanh}(\cot (a+b x))}{2 f}-\frac {b \left (-\frac {f \int (e+f x) \log \left (1-i e^{2 i (a+b x)}\right )dx}{b}+\frac {f \int (e+f x) \log \left (1+i e^{2 i (a+b x)}\right )dx}{b}-\frac {i (e+f x)^2 \arctan \left (e^{2 i (a+b x)}\right )}{b}\right )}{2 f}\)

\(\Big \downarrow \) 3011

\(\displaystyle \frac {(e+f x)^2 \text {arctanh}(\cot (a+b x))}{2 f}-\frac {b \left (\frac {f \left (\frac {i (e+f x) \operatorname {PolyLog}\left (2,-i e^{2 i (a+b x)}\right )}{2 b}-\frac {i f \int \operatorname {PolyLog}\left (2,-i e^{2 i (a+b x)}\right )dx}{2 b}\right )}{b}-\frac {f \left (\frac {i (e+f x) \operatorname {PolyLog}\left (2,i e^{2 i (a+b x)}\right )}{2 b}-\frac {i f \int \operatorname {PolyLog}\left (2,i e^{2 i (a+b x)}\right )dx}{2 b}\right )}{b}-\frac {i (e+f x)^2 \arctan \left (e^{2 i (a+b x)}\right )}{b}\right )}{2 f}\)

\(\Big \downarrow \) 2720

\(\displaystyle \frac {(e+f x)^2 \text {arctanh}(\cot (a+b x))}{2 f}-\frac {b \left (\frac {f \left (\frac {i (e+f x) \operatorname {PolyLog}\left (2,-i e^{2 i (a+b x)}\right )}{2 b}-\frac {f \int e^{-2 i (a+b x)} \operatorname {PolyLog}\left (2,-i e^{2 i (a+b x)}\right )de^{2 i (a+b x)}}{4 b^2}\right )}{b}-\frac {f \left (\frac {i (e+f x) \operatorname {PolyLog}\left (2,i e^{2 i (a+b x)}\right )}{2 b}-\frac {f \int e^{-2 i (a+b x)} \operatorname {PolyLog}\left (2,i e^{2 i (a+b x)}\right )de^{2 i (a+b x)}}{4 b^2}\right )}{b}-\frac {i (e+f x)^2 \arctan \left (e^{2 i (a+b x)}\right )}{b}\right )}{2 f}\)

\(\Big \downarrow \) 7143

\(\displaystyle \frac {(e+f x)^2 \text {arctanh}(\cot (a+b x))}{2 f}-\frac {b \left (-\frac {i (e+f x)^2 \arctan \left (e^{2 i (a+b x)}\right )}{b}+\frac {f \left (\frac {i (e+f x) \operatorname {PolyLog}\left (2,-i e^{2 i (a+b x)}\right )}{2 b}-\frac {f \operatorname {PolyLog}\left (3,-i e^{2 i (a+b x)}\right )}{4 b^2}\right )}{b}-\frac {f \left (\frac {i (e+f x) \operatorname {PolyLog}\left (2,i e^{2 i (a+b x)}\right )}{2 b}-\frac {f \operatorname {PolyLog}\left (3,i e^{2 i (a+b x)}\right )}{4 b^2}\right )}{b}\right )}{2 f}\)

Input:

Int[(e + f*x)*ArcTanh[Cot[a + b*x]],x]
 

Output:

((e + f*x)^2*ArcTanh[Cot[a + b*x]])/(2*f) - (b*(((-I)*(e + f*x)^2*ArcTan[E 
^((2*I)*(a + b*x))])/b + (f*(((I/2)*(e + f*x)*PolyLog[2, (-I)*E^((2*I)*(a 
+ b*x))])/b - (f*PolyLog[3, (-I)*E^((2*I)*(a + b*x))])/(4*b^2)))/b - (f*(( 
(I/2)*(e + f*x)*PolyLog[2, I*E^((2*I)*(a + b*x))])/b - (f*PolyLog[3, I*E^( 
(2*I)*(a + b*x))])/(4*b^2)))/b))/(2*f)
 

Defintions of rubi rules used

rule 2720
Int[u_, x_Symbol] :> With[{v = FunctionOfExponential[u, x]}, Simp[v/D[v, x] 
   Subst[Int[FunctionOfExponentialFunction[u, x]/x, x], x, v], x]] /; Funct 
ionOfExponentialQ[u, x] &&  !MatchQ[u, (w_)*((a_.)*(v_)^(n_))^(m_) /; FreeQ 
[{a, m, n}, x] && IntegerQ[m*n]] &&  !MatchQ[u, E^((c_.)*((a_.) + (b_.)*x)) 
*(F_)[v_] /; FreeQ[{a, b, c}, x] && InverseFunctionQ[F[x]]]
 

rule 3011
Int[Log[1 + (e_.)*((F_)^((c_.)*((a_.) + (b_.)*(x_))))^(n_.)]*((f_.) + (g_.) 
*(x_))^(m_.), x_Symbol] :> Simp[(-(f + g*x)^m)*(PolyLog[2, (-e)*(F^(c*(a + 
b*x)))^n]/(b*c*n*Log[F])), x] + Simp[g*(m/(b*c*n*Log[F]))   Int[(f + g*x)^( 
m - 1)*PolyLog[2, (-e)*(F^(c*(a + b*x)))^n], x], x] /; FreeQ[{F, a, b, c, e 
, f, g, n}, x] && GtQ[m, 0]
 

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 4669
Int[csc[(e_.) + Pi*(k_.) + (f_.)*(x_)]*((c_.) + (d_.)*(x_))^(m_.), x_Symbol 
] :> Simp[-2*(c + d*x)^m*(ArcTanh[E^(I*k*Pi)*E^(I*(e + f*x))]/f), x] + (-Si 
mp[d*(m/f)   Int[(c + d*x)^(m - 1)*Log[1 - E^(I*k*Pi)*E^(I*(e + f*x))], x], 
 x] + Simp[d*(m/f)   Int[(c + d*x)^(m - 1)*Log[1 + E^(I*k*Pi)*E^(I*(e + f*x 
))], x], x]) /; FreeQ[{c, d, e, f}, x] && IntegerQ[2*k] && IGtQ[m, 0]
 

rule 6807
Int[ArcTanh[Cot[(a_.) + (b_.)*(x_)]]*((e_.) + (f_.)*(x_))^(m_.), x_Symbol] 
:> Simp[(e + f*x)^(m + 1)*(ArcTanh[Cot[a + b*x]]/(f*(m + 1))), x] - Simp[b/ 
(f*(m + 1))   Int[(e + f*x)^(m + 1)*Sec[2*a + 2*b*x], x], x] /; FreeQ[{a, b 
, e, f}, x] && IGtQ[m, 0]
 

rule 7143
Int[PolyLog[n_, (c_.)*((a_.) + (b_.)*(x_))^(p_.)]/((d_.) + (e_.)*(x_)), x_S 
ymbol] :> Simp[PolyLog[n + 1, c*(a + b*x)^p]/(e*p), x] /; FreeQ[{a, b, c, d 
, e, n, p}, x] && EqQ[b*d, a*e]
 
Maple [C] (warning: unable to verify)

Result contains higher order function than in optimal. Order 9 vs. order 4.

Time = 3.64 (sec) , antiderivative size = 1819, normalized size of antiderivative = 11.23

method result size
risch \(\text {Expression too large to display}\) \(1819\)

Input:

int((f*x+e)*arctanh(cot(b*x+a)),x,method=_RETURNVERBOSE)
 

Output:

-1/2*f/b^2*a^2*ln(1+exp(I*(b*x+a))*(-1)^(3/4))-1/2*f/b^2*a^2*ln(1-exp(I*(b 
*x+a))*(-1)^(3/4))-1/2*e/b*ln(((-I)^(1/2)-exp(I*(b*x+a)))/(-I)^(1/2))*a-1/ 
2*e/b*ln(((-I)^(1/2)+exp(I*(b*x+a)))/(-I)^(1/2))*a+1/2*I*e/b*dilog(((-I)^( 
1/2)-exp(I*(b*x+a)))/(-I)^(1/2))+1/2*I*e/b*dilog(((-I)^(1/2)+exp(I*(b*x+a) 
))/(-I)^(1/2))+1/2*f/b^2*a^2*ln(((-I)^(1/2)-exp(I*(b*x+a)))/(-I)^(1/2))+1/ 
2*f/b^2*a^2*ln(((-I)^(1/2)+exp(I*(b*x+a)))/(-I)^(1/2))-1/4/b^2*f*a^2*ln(ex 
p(2*I*(b*x+a))+I)+1/2/b*a*e*ln(exp(2*I*(b*x+a))+I)-1/4*ln(exp(2*I*(b*x+a)) 
-I)*f*x^2-1/2*ln(exp(2*I*(b*x+a))-I)*e*x-1/2*(-1/2*f*x^2-e*x)*ln(exp(2*I*( 
b*x+a))+I)+1/2*e/b*ln(1+exp(I*(b*x+a))*(-1)^(3/4))*a+1/2*e/b*ln(1-exp(I*(b 
*x+a))*(-1)^(3/4))*a-1/2*I*e/b*dilog(1+exp(I*(b*x+a))*(-1)^(3/4))-1/2*I*e/ 
b*dilog(1-exp(I*(b*x+a))*(-1)^(3/4))+1/4/b^2*f*ln(I*exp(2*I*(b*x+a))+1)*a^ 
2+1/8*f*polylog(3,-I*exp(2*I*(b*x+a)))/b^2-1/8*f*polylog(3,I*exp(2*I*(b*x+ 
a)))/b^2-1/4/b^2*f*ln(-I*exp(2*I*(b*x+a))+1)*a^2-1/2*e/b*a*ln(-exp(2*I*(b* 
x+a))+I)+1/4*f/b^2*a^2*ln(-exp(2*I*(b*x+a))+I)-1/4*I*Pi*(csgn(I*(exp(2*I*( 
b*x+a))+I)/(-1+exp(2*I*(b*x+a))))*csgn((1-I)*(exp(2*I*(b*x+a))+I)/(-1+exp( 
2*I*(b*x+a))))+csgn((1-I)*(exp(2*I*(b*x+a))+I)/(-1+exp(2*I*(b*x+a))))^2-cs 
gn(I*(exp(2*I*(b*x+a))-I))*csgn(I/(-1+exp(2*I*(b*x+a))))*csgn(I*(exp(2*I*( 
b*x+a))-I)/(-1+exp(2*I*(b*x+a))))+csgn(I*(exp(2*I*(b*x+a))-I))*csgn(I*(exp 
(2*I*(b*x+a))-I)/(-1+exp(2*I*(b*x+a))))^2+csgn(I*(exp(2*I*(b*x+a))+I))*csg 
n(I/(-1+exp(2*I*(b*x+a))))*csgn(I*(exp(2*I*(b*x+a))+I)/(-1+exp(2*I*(b*x...
 

Fricas [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 681 vs. \(2 (130) = 260\).

Time = 0.14 (sec) , antiderivative size = 681, normalized size of antiderivative = 4.20 \[ \int (e+f x) \text {arctanh}(\cot (a+b x)) \, dx =\text {Too large to display} \] Input:

integrate((f*x+e)*arctanh(cot(b*x+a)),x, algorithm="fricas")
 

Output:

-1/16*(2*(-I*b*f*x - I*b*e)*dilog(I*cos(2*b*x + 2*a) + sin(2*b*x + 2*a)) + 
 2*(-I*b*f*x - I*b*e)*dilog(I*cos(2*b*x + 2*a) - sin(2*b*x + 2*a)) + 2*(I* 
b*f*x + I*b*e)*dilog(-I*cos(2*b*x + 2*a) + sin(2*b*x + 2*a)) + 2*(I*b*f*x 
+ I*b*e)*dilog(-I*cos(2*b*x + 2*a) - sin(2*b*x + 2*a)) - 4*(b^2*f*x^2 + 2* 
b^2*e*x)*log(-(cos(2*b*x + 2*a) + sin(2*b*x + 2*a) + 1)/(cos(2*b*x + 2*a) 
- sin(2*b*x + 2*a) + 1)) - 2*(2*a*b*e - a^2*f)*log(cos(2*b*x + 2*a) + I*si 
n(2*b*x + 2*a) + I) + 2*(2*a*b*e - a^2*f)*log(cos(2*b*x + 2*a) - I*sin(2*b 
*x + 2*a) + I) + 2*(b^2*f*x^2 + 2*b^2*e*x + 2*a*b*e - a^2*f)*log(I*cos(2*b 
*x + 2*a) + sin(2*b*x + 2*a) + 1) - 2*(b^2*f*x^2 + 2*b^2*e*x + 2*a*b*e - a 
^2*f)*log(I*cos(2*b*x + 2*a) - sin(2*b*x + 2*a) + 1) + 2*(b^2*f*x^2 + 2*b^ 
2*e*x + 2*a*b*e - a^2*f)*log(-I*cos(2*b*x + 2*a) + sin(2*b*x + 2*a) + 1) - 
 2*(b^2*f*x^2 + 2*b^2*e*x + 2*a*b*e - a^2*f)*log(-I*cos(2*b*x + 2*a) - sin 
(2*b*x + 2*a) + 1) - 2*(2*a*b*e - a^2*f)*log(-cos(2*b*x + 2*a) + I*sin(2*b 
*x + 2*a) + I) + 2*(2*a*b*e - a^2*f)*log(-cos(2*b*x + 2*a) - I*sin(2*b*x + 
 2*a) + I) - f*polylog(3, I*cos(2*b*x + 2*a) + sin(2*b*x + 2*a)) + f*polyl 
og(3, I*cos(2*b*x + 2*a) - sin(2*b*x + 2*a)) - f*polylog(3, -I*cos(2*b*x + 
 2*a) + sin(2*b*x + 2*a)) + f*polylog(3, -I*cos(2*b*x + 2*a) - sin(2*b*x + 
 2*a)))/b^2
 

Sympy [F]

\[ \int (e+f x) \text {arctanh}(\cot (a+b x)) \, dx=\int \left (e + f x\right ) \operatorname {atanh}{\left (\cot {\left (a + b x \right )} \right )}\, dx \] Input:

integrate((f*x+e)*atanh(cot(b*x+a)),x)
 

Output:

Integral((e + f*x)*atanh(cot(a + b*x)), x)
 

Maxima [F]

\[ \int (e+f x) \text {arctanh}(\cot (a+b x)) \, dx=\int { {\left (f x + e\right )} \operatorname {artanh}\left (\cot \left (b x + a\right )\right ) \,d x } \] Input:

integrate((f*x+e)*arctanh(cot(b*x+a)),x, algorithm="maxima")
                                                                                    
                                                                                    
 

Output:

1/8*(f*x^2 + 2*e*x)*log(2*cos(2*b*x + 2*a)^2 + 2*sin(2*b*x + 2*a)^2 + 4*si 
n(2*b*x + 2*a) + 2) - 1/8*(f*x^2 + 2*e*x)*log(2*cos(2*b*x + 2*a)^2 + 2*sin 
(2*b*x + 2*a)^2 - 4*sin(2*b*x + 2*a) + 2) - integrate(((b*f*x^2 + 2*b*e*x) 
*cos(4*b*x + 4*a)*cos(2*b*x + 2*a) + (b*f*x^2 + 2*b*e*x)*sin(4*b*x + 4*a)* 
sin(2*b*x + 2*a) + (b*f*x^2 + 2*b*e*x)*cos(2*b*x + 2*a))/(cos(4*b*x + 4*a) 
^2 + sin(4*b*x + 4*a)^2 + 2*cos(4*b*x + 4*a) + 1), x)
 

Giac [F]

\[ \int (e+f x) \text {arctanh}(\cot (a+b x)) \, dx=\int { {\left (f x + e\right )} \operatorname {artanh}\left (\cot \left (b x + a\right )\right ) \,d x } \] Input:

integrate((f*x+e)*arctanh(cot(b*x+a)),x, algorithm="giac")
 

Output:

integrate((f*x + e)*arctanh(cot(b*x + a)), x)
 

Mupad [F(-1)]

Timed out. \[ \int (e+f x) \text {arctanh}(\cot (a+b x)) \, dx=\int \mathrm {atanh}\left (\mathrm {cot}\left (a+b\,x\right )\right )\,\left (e+f\,x\right ) \,d x \] Input:

int(atanh(cot(a + b*x))*(e + f*x),x)
 

Output:

int(atanh(cot(a + b*x))*(e + f*x), x)
 

Reduce [F]

\[ \int (e+f x) \text {arctanh}(\cot (a+b x)) \, dx=\left (\int \mathit {atanh} \left (\cot \left (b x +a \right )\right )d x \right ) e +\left (\int \mathit {atanh} \left (\cot \left (b x +a \right )\right ) x d x \right ) f \] Input:

int((f*x+e)*atanh(cot(b*x+a)),x)
 

Output:

int(atanh(cot(a + b*x)),x)*e + int(atanh(cot(a + b*x))*x,x)*f