\(\int \frac {(c+d x)^2}{a+a \cosh (e+f x)} \, dx\) [112]

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

Optimal result

Integrand size = 20, antiderivative size = 88 \[ \int \frac {(c+d x)^2}{a+a \cosh (e+f x)} \, dx=\frac {(c+d x)^2}{a f}-\frac {4 d (c+d x) \log \left (1+e^{e+f x}\right )}{a f^2}-\frac {4 d^2 \operatorname {PolyLog}\left (2,-e^{e+f x}\right )}{a f^3}+\frac {(c+d x)^2 \tanh \left (\frac {e}{2}+\frac {f x}{2}\right )}{a f} \] Output:

(d*x+c)^2/a/f-4*d*(d*x+c)*ln(1+exp(f*x+e))/a/f^2-4*d^2*polylog(2,-exp(f*x+ 
e))/a/f^3+(d*x+c)^2*tanh(1/2*f*x+1/2*e)/a/f
 

Mathematica [A] (verified)

Time = 0.62 (sec) , antiderivative size = 133, normalized size of antiderivative = 1.51 \[ \int \frac {(c+d x)^2}{a+a \cosh (e+f x)} \, dx=\frac {2 \cosh \left (\frac {1}{2} (e+f x)\right ) \left (-\frac {2 \cosh \left (\frac {1}{2} (e+f x)\right ) \left (f (c+d x) \left (f (c+d x)+2 d \left (1+e^e\right ) \log \left (1+e^{-e-f x}\right )\right )-2 d^2 \left (1+e^e\right ) \operatorname {PolyLog}\left (2,-e^{-e-f x}\right )\right )}{\left (1+e^e\right ) f^2}+(c+d x)^2 \text {sech}\left (\frac {e}{2}\right ) \sinh \left (\frac {f x}{2}\right )\right )}{a f (1+\cosh (e+f x))} \] Input:

Integrate[(c + d*x)^2/(a + a*Cosh[e + f*x]),x]
 

Output:

(2*Cosh[(e + f*x)/2]*((-2*Cosh[(e + f*x)/2]*(f*(c + d*x)*(f*(c + d*x) + 2* 
d*(1 + E^e)*Log[1 + E^(-e - f*x)]) - 2*d^2*(1 + E^e)*PolyLog[2, -E^(-e - f 
*x)]))/((1 + E^e)*f^2) + (c + d*x)^2*Sech[e/2]*Sinh[(f*x)/2]))/(a*f*(1 + C 
osh[e + f*x]))
 

Rubi [C] (verified)

Result contains complex when optimal does not.

Time = 0.59 (sec) , antiderivative size = 98, normalized size of antiderivative = 1.11, number of steps used = 12, number of rules used = 11, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.550, Rules used = {3042, 3799, 3042, 4672, 26, 3042, 26, 4201, 2620, 2715, 2838}

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 \frac {(c+d x)^2}{a \cosh (e+f x)+a} \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {(c+d x)^2}{a+a \sin \left (i e+i f x+\frac {\pi }{2}\right )}dx\)

\(\Big \downarrow \) 3799

\(\displaystyle \frac {\int (c+d x)^2 \text {sech}^2\left (\frac {e}{2}+\frac {f x}{2}\right )dx}{2 a}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {\int (c+d x)^2 \csc \left (\frac {i e}{2}+\frac {i f x}{2}+\frac {\pi }{2}\right )^2dx}{2 a}\)

\(\Big \downarrow \) 4672

\(\displaystyle \frac {\frac {2 (c+d x)^2 \tanh \left (\frac {e}{2}+\frac {f x}{2}\right )}{f}-\frac {4 i d \int -i (c+d x) \tanh \left (\frac {e}{2}+\frac {f x}{2}\right )dx}{f}}{2 a}\)

\(\Big \downarrow \) 26

\(\displaystyle \frac {\frac {2 (c+d x)^2 \tanh \left (\frac {e}{2}+\frac {f x}{2}\right )}{f}-\frac {4 d \int (c+d x) \tanh \left (\frac {e}{2}+\frac {f x}{2}\right )dx}{f}}{2 a}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {\frac {2 (c+d x)^2 \tanh \left (\frac {e}{2}+\frac {f x}{2}\right )}{f}-\frac {4 d \int -i (c+d x) \tan \left (\frac {i e}{2}+\frac {i f x}{2}\right )dx}{f}}{2 a}\)

\(\Big \downarrow \) 26

\(\displaystyle \frac {\frac {2 (c+d x)^2 \tanh \left (\frac {e}{2}+\frac {f x}{2}\right )}{f}+\frac {4 i d \int (c+d x) \tan \left (\frac {i e}{2}+\frac {i f x}{2}\right )dx}{f}}{2 a}\)

\(\Big \downarrow \) 4201

\(\displaystyle \frac {\frac {2 (c+d x)^2 \tanh \left (\frac {e}{2}+\frac {f x}{2}\right )}{f}+\frac {4 i d \left (2 i \int \frac {e^{e+f x} (c+d x)}{1+e^{e+f x}}dx-\frac {i (c+d x)^2}{2 d}\right )}{f}}{2 a}\)

\(\Big \downarrow \) 2620

\(\displaystyle \frac {\frac {2 (c+d x)^2 \tanh \left (\frac {e}{2}+\frac {f x}{2}\right )}{f}+\frac {4 i d \left (2 i \left (\frac {(c+d x) \log \left (e^{e+f x}+1\right )}{f}-\frac {d \int \log \left (1+e^{e+f x}\right )dx}{f}\right )-\frac {i (c+d x)^2}{2 d}\right )}{f}}{2 a}\)

\(\Big \downarrow \) 2715

\(\displaystyle \frac {\frac {2 (c+d x)^2 \tanh \left (\frac {e}{2}+\frac {f x}{2}\right )}{f}+\frac {4 i d \left (2 i \left (\frac {(c+d x) \log \left (e^{e+f x}+1\right )}{f}-\frac {d \int e^{-e-f x} \log \left (1+e^{e+f x}\right )de^{e+f x}}{f^2}\right )-\frac {i (c+d x)^2}{2 d}\right )}{f}}{2 a}\)

\(\Big \downarrow \) 2838

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

Input:

Int[(c + d*x)^2/(a + a*Cosh[e + f*x]),x]
 

Output:

(((4*I)*d*(((-1/2*I)*(c + d*x)^2)/d + (2*I)*(((c + d*x)*Log[1 + E^(e + f*x 
)])/f + (d*PolyLog[2, -E^(e + f*x)])/f^2)))/f + (2*(c + d*x)^2*Tanh[e/2 + 
(f*x)/2])/f)/(2*a)
 

Defintions of rubi rules used

rule 26
Int[(Complex[0, a_])*(Fx_), x_Symbol] :> Simp[(Complex[Identity[0], a])   I 
nt[Fx, x], x] /; FreeQ[a, x] && EqQ[a^2, 1]
 

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

rule 2715
Int[Log[(a_) + (b_.)*((F_)^((e_.)*((c_.) + (d_.)*(x_))))^(n_.)], x_Symbol] 
:> Simp[1/(d*e*n*Log[F])   Subst[Int[Log[a + b*x]/x, x], x, (F^(e*(c + d*x) 
))^n], x] /; FreeQ[{F, a, b, c, d, e, n}, x] && GtQ[a, 0]
 

rule 2838
Int[Log[(c_.)*((d_) + (e_.)*(x_)^(n_.))]/(x_), x_Symbol] :> Simp[-PolyLog[2 
, (-c)*e*x^n]/n, x] /; FreeQ[{c, d, e, n}, x] && EqQ[c*d, 1]
 

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

rule 3799
Int[((c_.) + (d_.)*(x_))^(m_.)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(n_.) 
, x_Symbol] :> Simp[(2*a)^n   Int[(c + d*x)^m*Sin[(1/2)*(e + Pi*(a/(2*b))) 
+ f*(x/2)]^(2*n), x], x] /; FreeQ[{a, b, c, d, e, f, m}, x] && EqQ[a^2 - b^ 
2, 0] && IntegerQ[n] && (GtQ[n, 0] || IGtQ[m, 0])
 

rule 4201
Int[((c_.) + (d_.)*(x_))^(m_.)*tan[(e_.) + (Complex[0, fz_])*(f_.)*(x_)], x 
_Symbol] :> Simp[(-I)*((c + d*x)^(m + 1)/(d*(m + 1))), x] + Simp[2*I   Int[ 
(c + d*x)^m*(E^(2*((-I)*e + f*fz*x))/(1 + E^(2*((-I)*e + f*fz*x)))), x], x] 
 /; FreeQ[{c, d, e, f, fz}, x] && IGtQ[m, 0]
 

rule 4672
Int[csc[(e_.) + (f_.)*(x_)]^2*((c_.) + (d_.)*(x_))^(m_.), x_Symbol] :> Simp 
[(-(c + d*x)^m)*(Cot[e + f*x]/f), x] + Simp[d*(m/f)   Int[(c + d*x)^(m - 1) 
*Cot[e + f*x], x], x] /; FreeQ[{c, d, e, f}, x] && GtQ[m, 0]
 
Maple [B] (verified)

Leaf count of result is larger than twice the leaf count of optimal. \(173\) vs. \(2(82)=164\).

Time = 0.46 (sec) , antiderivative size = 174, normalized size of antiderivative = 1.98

method result size
risch \(-\frac {2 \left (x^{2} d^{2}+2 c d x +c^{2}\right )}{f a \left ({\mathrm e}^{f x +e}+1\right )}+\frac {4 d c \ln \left ({\mathrm e}^{f x +e}\right )}{a \,f^{2}}-\frac {4 d c \ln \left ({\mathrm e}^{f x +e}+1\right )}{a \,f^{2}}+\frac {2 d^{2} x^{2}}{a f}+\frac {4 d^{2} e x}{a \,f^{2}}+\frac {2 d^{2} e^{2}}{a \,f^{3}}-\frac {4 d^{2} \ln \left ({\mathrm e}^{f x +e}+1\right ) x}{a \,f^{2}}-\frac {4 d^{2} \operatorname {polylog}\left (2, -{\mathrm e}^{f x +e}\right )}{a \,f^{3}}-\frac {4 d^{2} e \ln \left ({\mathrm e}^{f x +e}\right )}{a \,f^{3}}\) \(174\)

Input:

int((d*x+c)^2/(a+a*cosh(f*x+e)),x,method=_RETURNVERBOSE)
 

Output:

-2/f*(d^2*x^2+2*c*d*x+c^2)/a/(exp(f*x+e)+1)+4/a/f^2*d*c*ln(exp(f*x+e))-4/a 
/f^2*d*c*ln(exp(f*x+e)+1)+2/a/f*d^2*x^2+4/a/f^2*d^2*e*x+2/a/f^3*d^2*e^2-4/ 
a/f^2*d^2*ln(exp(f*x+e)+1)*x-4*d^2*polylog(2,-exp(f*x+e))/a/f^3-4/a/f^3*d^ 
2*e*ln(exp(f*x+e))
 

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 243 vs. \(2 (81) = 162\).

Time = 0.09 (sec) , antiderivative size = 243, normalized size of antiderivative = 2.76 \[ \int \frac {(c+d x)^2}{a+a \cosh (e+f x)} \, dx=-\frac {2 \, {\left (d^{2} e^{2} - 2 \, c d e f + c^{2} f^{2} - {\left (d^{2} f^{2} x^{2} + 2 \, c d f^{2} x - d^{2} e^{2} + 2 \, c d e f\right )} \cosh \left (f x + e\right ) + 2 \, {\left (d^{2} \cosh \left (f x + e\right ) + d^{2} \sinh \left (f x + e\right ) + d^{2}\right )} {\rm Li}_2\left (-\cosh \left (f x + e\right ) - \sinh \left (f x + e\right )\right ) + 2 \, {\left (d^{2} f x + c d f + {\left (d^{2} f x + c d f\right )} \cosh \left (f x + e\right ) + {\left (d^{2} f x + c d f\right )} \sinh \left (f x + e\right )\right )} \log \left (\cosh \left (f x + e\right ) + \sinh \left (f x + e\right ) + 1\right ) - {\left (d^{2} f^{2} x^{2} + 2 \, c d f^{2} x - d^{2} e^{2} + 2 \, c d e f\right )} \sinh \left (f x + e\right )\right )}}{a f^{3} \cosh \left (f x + e\right ) + a f^{3} \sinh \left (f x + e\right ) + a f^{3}} \] Input:

integrate((d*x+c)^2/(a+a*cosh(f*x+e)),x, algorithm="fricas")
 

Output:

-2*(d^2*e^2 - 2*c*d*e*f + c^2*f^2 - (d^2*f^2*x^2 + 2*c*d*f^2*x - d^2*e^2 + 
 2*c*d*e*f)*cosh(f*x + e) + 2*(d^2*cosh(f*x + e) + d^2*sinh(f*x + e) + d^2 
)*dilog(-cosh(f*x + e) - sinh(f*x + e)) + 2*(d^2*f*x + c*d*f + (d^2*f*x + 
c*d*f)*cosh(f*x + e) + (d^2*f*x + c*d*f)*sinh(f*x + e))*log(cosh(f*x + e) 
+ sinh(f*x + e) + 1) - (d^2*f^2*x^2 + 2*c*d*f^2*x - d^2*e^2 + 2*c*d*e*f)*s 
inh(f*x + e))/(a*f^3*cosh(f*x + e) + a*f^3*sinh(f*x + e) + a*f^3)
 

Sympy [F]

\[ \int \frac {(c+d x)^2}{a+a \cosh (e+f x)} \, dx=\frac {\int \frac {c^{2}}{\cosh {\left (e + f x \right )} + 1}\, dx + \int \frac {d^{2} x^{2}}{\cosh {\left (e + f x \right )} + 1}\, dx + \int \frac {2 c d x}{\cosh {\left (e + f x \right )} + 1}\, dx}{a} \] Input:

integrate((d*x+c)**2/(a+a*cosh(f*x+e)),x)
 

Output:

(Integral(c**2/(cosh(e + f*x) + 1), x) + Integral(d**2*x**2/(cosh(e + f*x) 
 + 1), x) + Integral(2*c*d*x/(cosh(e + f*x) + 1), x))/a
 

Maxima [F]

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

integrate((d*x+c)^2/(a+a*cosh(f*x+e)),x, algorithm="maxima")
 

Output:

-2*d^2*(x^2/(a*f*e^(f*x + e) + a*f) - 2*integrate(x/(a*f*e^(f*x + e) + a*f 
), x)) + 4*c*d*(x*e^(f*x + e)/(a*f*e^(f*x + e) + a*f) - log((e^(f*x + e) + 
 1)*e^(-e))/(a*f^2)) + 2*c^2/((a*e^(-f*x - e) + a)*f)
 

Giac [F]

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

integrate((d*x+c)^2/(a+a*cosh(f*x+e)),x, algorithm="giac")
 

Output:

integrate((d*x + c)^2/(a*cosh(f*x + e) + a), x)
 

Mupad [F(-1)]

Timed out. \[ \int \frac {(c+d x)^2}{a+a \cosh (e+f x)} \, dx=\int \frac {{\left (c+d\,x\right )}^2}{a+a\,\mathrm {cosh}\left (e+f\,x\right )} \,d x \] Input:

int((c + d*x)^2/(a + a*cosh(e + f*x)),x)
 

Output:

int((c + d*x)^2/(a + a*cosh(e + f*x)), x)
 

Reduce [F]

\[ \int \frac {(c+d x)^2}{a+a \cosh (e+f x)} \, dx=\frac {4 e^{f x +e} \left (\int \frac {x}{e^{2 f x +2 e}+2 e^{f x +e}+1}d x \right ) d^{2} f^{2}-4 e^{f x +e} \mathrm {log}\left (e^{f x +e}+1\right ) c d f -4 e^{f x +e} \mathrm {log}\left (e^{f x +e}+1\right ) d^{2}+2 e^{f x +e} c^{2} f^{2}+4 e^{f x +e} c d \,f^{2} x +4 e^{f x +e} d^{2} f x +4 \left (\int \frac {x}{e^{2 f x +2 e}+2 e^{f x +e}+1}d x \right ) d^{2} f^{2}-4 \,\mathrm {log}\left (e^{f x +e}+1\right ) c d f -4 \,\mathrm {log}\left (e^{f x +e}+1\right ) d^{2}-2 d^{2} f^{2} x^{2}}{a \,f^{3} \left (e^{f x +e}+1\right )} \] Input:

int((d*x+c)^2/(a+a*cosh(f*x+e)),x)
 

Output:

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