\(\int (a \cosh (x)+b \sinh (x))^2 \, dx\) [581]

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

Optimal result

Integrand size = 11, antiderivative size = 37 \[ \int (a \cosh (x)+b \sinh (x))^2 \, dx=\frac {1}{2} \left (a^2-b^2\right ) x+\frac {1}{2} (b \cosh (x)+a \sinh (x)) (a \cosh (x)+b \sinh (x)) \]

[Out]

1/2*(a^2-b^2)*x+1/2*(b*cosh(x)+a*sinh(x))*(a*cosh(x)+b*sinh(x))

Rubi [A] (verified)

Time = 0.01 (sec) , antiderivative size = 37, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.182, Rules used = {3152, 8} \[ \int (a \cosh (x)+b \sinh (x))^2 \, dx=\frac {1}{2} x \left (a^2-b^2\right )+\frac {1}{2} (a \sinh (x)+b \cosh (x)) (a \cosh (x)+b \sinh (x)) \]

[In]

Int[(a*Cosh[x] + b*Sinh[x])^2,x]

[Out]

((a^2 - b^2)*x)/2 + ((b*Cosh[x] + a*Sinh[x])*(a*Cosh[x] + b*Sinh[x]))/2

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 3152

Int[(cos[(c_.) + (d_.)*(x_)]*(a_.) + (b_.)*sin[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[(-(b*Cos[c + d*x]
- a*Sin[c + d*x]))*((a*Cos[c + d*x] + b*Sin[c + d*x])^(n - 1)/(d*n)), x] + Dist[(n - 1)*((a^2 + b^2)/n), Int[(
a*Cos[c + d*x] + b*Sin[c + d*x])^(n - 2), x], x] /; FreeQ[{a, b, c, d}, x] && NeQ[a^2 + b^2, 0] &&  !IntegerQ[
(n - 1)/2] && GtQ[n, 1]

Rubi steps \begin{align*} \text {integral}& = \frac {1}{2} (b \cosh (x)+a \sinh (x)) (a \cosh (x)+b \sinh (x))+\frac {1}{2} \left (a^2-b^2\right ) \int 1 \, dx \\ & = \frac {1}{2} \left (a^2-b^2\right ) x+\frac {1}{2} (b \cosh (x)+a \sinh (x)) (a \cosh (x)+b \sinh (x)) \\ \end{align*}

Mathematica [A] (verified)

Time = 0.05 (sec) , antiderivative size = 36, normalized size of antiderivative = 0.97 \[ \int (a \cosh (x)+b \sinh (x))^2 \, dx=\frac {1}{4} \left (2 (a-b) (a+b) x+2 a b \cosh (2 x)+\left (a^2+b^2\right ) \sinh (2 x)\right ) \]

[In]

Integrate[(a*Cosh[x] + b*Sinh[x])^2,x]

[Out]

(2*(a - b)*(a + b)*x + 2*a*b*Cosh[2*x] + (a^2 + b^2)*Sinh[2*x])/4

Maple [A] (verified)

Time = 1.00 (sec) , antiderivative size = 37, normalized size of antiderivative = 1.00

method result size
default \(a^{2} \left (\frac {\cosh \left (x \right ) \sinh \left (x \right )}{2}+\frac {x}{2}\right )+a b \cosh \left (x \right )^{2}+b^{2} \left (\frac {\cosh \left (x \right ) \sinh \left (x \right )}{2}-\frac {x}{2}\right )\) \(37\)
parts \(a^{2} \left (\frac {\cosh \left (x \right ) \sinh \left (x \right )}{2}+\frac {x}{2}\right )+a b \cosh \left (x \right )^{2}+b^{2} \left (\frac {\cosh \left (x \right ) \sinh \left (x \right )}{2}-\frac {x}{2}\right )\) \(37\)
risch \(\frac {a^{2} x}{2}-\frac {b^{2} x}{2}+\frac {a^{2} {\mathrm e}^{2 x}}{8}+\frac {b \,{\mathrm e}^{2 x} a}{4}+\frac {b^{2} {\mathrm e}^{2 x}}{8}-\frac {{\mathrm e}^{-2 x} a^{2}}{8}+\frac {{\mathrm e}^{-2 x} a b}{4}-\frac {{\mathrm e}^{-2 x} b^{2}}{8}\) \(66\)

[In]

int((a*cosh(x)+b*sinh(x))^2,x,method=_RETURNVERBOSE)

[Out]

a^2*(1/2*cosh(x)*sinh(x)+1/2*x)+a*b*cosh(x)^2+b^2*(1/2*cosh(x)*sinh(x)-1/2*x)

Fricas [A] (verification not implemented)

none

Time = 0.26 (sec) , antiderivative size = 42, normalized size of antiderivative = 1.14 \[ \int (a \cosh (x)+b \sinh (x))^2 \, dx=\frac {1}{2} \, a b \cosh \left (x\right )^{2} + \frac {1}{2} \, a b \sinh \left (x\right )^{2} + \frac {1}{2} \, {\left (a^{2} + b^{2}\right )} \cosh \left (x\right ) \sinh \left (x\right ) + \frac {1}{2} \, {\left (a^{2} - b^{2}\right )} x \]

[In]

integrate((a*cosh(x)+b*sinh(x))^2,x, algorithm="fricas")

[Out]

1/2*a*b*cosh(x)^2 + 1/2*a*b*sinh(x)^2 + 1/2*(a^2 + b^2)*cosh(x)*sinh(x) + 1/2*(a^2 - b^2)*x

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 78 vs. \(2 (34) = 68\).

Time = 0.09 (sec) , antiderivative size = 78, normalized size of antiderivative = 2.11 \[ \int (a \cosh (x)+b \sinh (x))^2 \, dx=- \frac {a^{2} x \sinh ^{2}{\left (x \right )}}{2} + \frac {a^{2} x \cosh ^{2}{\left (x \right )}}{2} + \frac {a^{2} \sinh {\left (x \right )} \cosh {\left (x \right )}}{2} + a b \cosh ^{2}{\left (x \right )} + \frac {b^{2} x \sinh ^{2}{\left (x \right )}}{2} - \frac {b^{2} x \cosh ^{2}{\left (x \right )}}{2} + \frac {b^{2} \sinh {\left (x \right )} \cosh {\left (x \right )}}{2} \]

[In]

integrate((a*cosh(x)+b*sinh(x))**2,x)

[Out]

-a**2*x*sinh(x)**2/2 + a**2*x*cosh(x)**2/2 + a**2*sinh(x)*cosh(x)/2 + a*b*cosh(x)**2 + b**2*x*sinh(x)**2/2 - b
**2*x*cosh(x)**2/2 + b**2*sinh(x)*cosh(x)/2

Maxima [A] (verification not implemented)

none

Time = 0.20 (sec) , antiderivative size = 46, normalized size of antiderivative = 1.24 \[ \int (a \cosh (x)+b \sinh (x))^2 \, dx=a b \cosh \left (x\right )^{2} + \frac {1}{8} \, a^{2} {\left (4 \, x + e^{\left (2 \, x\right )} - e^{\left (-2 \, x\right )}\right )} - \frac {1}{8} \, b^{2} {\left (4 \, x - e^{\left (2 \, x\right )} + e^{\left (-2 \, x\right )}\right )} \]

[In]

integrate((a*cosh(x)+b*sinh(x))^2,x, algorithm="maxima")

[Out]

a*b*cosh(x)^2 + 1/8*a^2*(4*x + e^(2*x) - e^(-2*x)) - 1/8*b^2*(4*x - e^(2*x) + e^(-2*x))

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 74 vs. \(2 (33) = 66\).

Time = 0.26 (sec) , antiderivative size = 74, normalized size of antiderivative = 2.00 \[ \int (a \cosh (x)+b \sinh (x))^2 \, dx=\frac {1}{8} \, a^{2} e^{\left (2 \, x\right )} + \frac {1}{4} \, a b e^{\left (2 \, x\right )} + \frac {1}{8} \, b^{2} e^{\left (2 \, x\right )} + \frac {1}{2} \, {\left (a^{2} - b^{2}\right )} x - \frac {1}{8} \, {\left (2 \, a^{2} e^{\left (2 \, x\right )} - 2 \, b^{2} e^{\left (2 \, x\right )} + a^{2} - 2 \, a b + b^{2}\right )} e^{\left (-2 \, x\right )} \]

[In]

integrate((a*cosh(x)+b*sinh(x))^2,x, algorithm="giac")

[Out]

1/8*a^2*e^(2*x) + 1/4*a*b*e^(2*x) + 1/8*b^2*e^(2*x) + 1/2*(a^2 - b^2)*x - 1/8*(2*a^2*e^(2*x) - 2*b^2*e^(2*x) +
 a^2 - 2*a*b + b^2)*e^(-2*x)

Mupad [B] (verification not implemented)

Time = 2.32 (sec) , antiderivative size = 39, normalized size of antiderivative = 1.05 \[ \int (a \cosh (x)+b \sinh (x))^2 \, dx=\frac {a^2\,\mathrm {sinh}\left (2\,x\right )}{4}+\frac {b^2\,\mathrm {sinh}\left (2\,x\right )}{4}+\frac {a^2\,x}{2}-\frac {b^2\,x}{2}+\frac {a\,b\,\mathrm {cosh}\left (2\,x\right )}{2} \]

[In]

int((a*cosh(x) + b*sinh(x))^2,x)

[Out]

(a^2*sinh(2*x))/4 + (b^2*sinh(2*x))/4 + (a^2*x)/2 - (b^2*x)/2 + (a*b*cosh(2*x))/2