### 3.581 $$\int (a \cosh (x)+b \sinh (x))^2 \, dx$$

Optimal. Leaf size=37 $\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))$

[Out]

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

________________________________________________________________________________________

Rubi [A]  time = 0.01757, antiderivative size = 37, normalized size of antiderivative = 1., number of steps used = 2, number of rules used = 2, integrand size = 11, $$\frac{\text{number of rules}}{\text{integrand size}}$$ = 0.182, Rules used = {3073, 8} $\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))$

Antiderivative was successfully veriﬁed.

[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 3073

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]

Rule 8

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

Rubi steps

\begin{align*} \int (a \cosh (x)+b \sinh (x))^2 \, dx &=\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]  time = 0.0541152, size = 36, normalized size = 0.97 $\frac{1}{4} \left (\left (a^2+b^2\right ) \sinh (2 x)+2 x (a-b) (a+b)+2 a b \cosh (2 x)\right )$

Antiderivative was successfully veriﬁed.

[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]  time = 0.02, size = 37, normalized size = 1. \begin{align*}{b}^{2} \left ({\frac{\cosh \left ( x \right ) \sinh \left ( x \right ) }{2}}-{\frac{x}{2}} \right ) +ab \left ( \cosh \left ( x \right ) \right ) ^{2}+{a}^{2} \left ({\frac{\cosh \left ( x \right ) \sinh \left ( x \right ) }{2}}+{\frac{x}{2}} \right ) \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Maxima [A]  time = 1.04819, size = 62, normalized size = 1.68 \begin{align*} 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 )} \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[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))

________________________________________________________________________________________

Fricas [A]  time = 2.18391, size = 126, normalized size = 3.41 \begin{align*} \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 \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[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]  time = 0.243936, size = 78, normalized size = 2.11 \begin{align*} - \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 \sinh ^{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} \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[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*sinh(x)**2 + b**2*x*sinh(x)**2/2 - b
**2*x*cosh(x)**2/2 + b**2*sinh(x)*cosh(x)/2

________________________________________________________________________________________

Giac [B]  time = 1.1521, size = 100, normalized size = 2.7 \begin{align*} \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 )} \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[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)