3.8.27 \(\int \frac {A+B \cosh (x)}{b \cosh (x)+c \sinh (x)} \, dx\) [727]

Optimal. Leaf size=80 \[ \frac {b B x}{b^2-c^2}+\frac {A \text {ArcTan}\left (\frac {c \cosh (x)+b \sinh (x)}{\sqrt {b^2-c^2}}\right )}{\sqrt {b^2-c^2}}-\frac {B c \log (b \cosh (x)+c \sinh (x))}{b^2-c^2} \]

[Out]

b*B*x/(b^2-c^2)-B*c*ln(b*cosh(x)+c*sinh(x))/(b^2-c^2)+A*arctan((c*cosh(x)+b*sinh(x))/(b^2-c^2)^(1/2))/(b^2-c^2
)^(1/2)

________________________________________________________________________________________

Rubi [A]
time = 0.05, antiderivative size = 80, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, integrand size = 18, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.167, Rules used = {3217, 3153, 212} \begin {gather*} \frac {A \text {ArcTan}\left (\frac {b \sinh (x)+c \cosh (x)}{\sqrt {b^2-c^2}}\right )}{\sqrt {b^2-c^2}}+\frac {b B x}{b^2-c^2}-\frac {B c \log (b \cosh (x)+c \sinh (x))}{b^2-c^2} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(A + B*Cosh[x])/(b*Cosh[x] + c*Sinh[x]),x]

[Out]

(b*B*x)/(b^2 - c^2) + (A*ArcTan[(c*Cosh[x] + b*Sinh[x])/Sqrt[b^2 - c^2]])/Sqrt[b^2 - c^2] - (B*c*Log[b*Cosh[x]
 + c*Sinh[x]])/(b^2 - c^2)

Rule 212

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[-b, 2]))*ArcTanh[Rt[-b, 2]*(x/Rt[a, 2])], x]
 /; FreeQ[{a, b}, x] && NegQ[a/b] && (GtQ[a, 0] || LtQ[b, 0])

Rule 3153

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

Rule 3217

Int[((A_.) + cos[(d_.) + (e_.)*(x_)]*(B_.))/((a_.) + cos[(d_.) + (e_.)*(x_)]*(b_.) + (c_.)*sin[(d_.) + (e_.)*(
x_)]), x_Symbol] :> Simp[b*B*((d + e*x)/(e*(b^2 + c^2))), x] + (Dist[(A*(b^2 + c^2) - a*b*B)/(b^2 + c^2), Int[
1/(a + b*Cos[d + e*x] + c*Sin[d + e*x]), x], x] + Simp[c*B*(Log[a + b*Cos[d + e*x] + c*Sin[d + e*x]]/(e*(b^2 +
 c^2))), x]) /; FreeQ[{a, b, c, d, e, A, B}, x] && NeQ[b^2 + c^2, 0] && NeQ[A*(b^2 + c^2) - a*b*B, 0]

Rubi steps

\begin {align*} \int \frac {A+B \cosh (x)}{b \cosh (x)+c \sinh (x)} \, dx &=\frac {b B x}{b^2-c^2}-\frac {B c \log (b \cosh (x)+c \sinh (x))}{b^2-c^2}+A \int \frac {1}{b \cosh (x)+c \sinh (x)} \, dx\\ &=\frac {b B x}{b^2-c^2}-\frac {B c \log (b \cosh (x)+c \sinh (x))}{b^2-c^2}+(i A) \text {Subst}\left (\int \frac {1}{b^2-c^2-x^2} \, dx,x,-i c \cosh (x)-i b \sinh (x)\right )\\ &=\frac {b B x}{b^2-c^2}+\frac {A \tan ^{-1}\left (\frac {c \cosh (x)+b \sinh (x)}{\sqrt {b^2-c^2}}\right )}{\sqrt {b^2-c^2}}-\frac {B c \log (b \cosh (x)+c \sinh (x))}{b^2-c^2}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.11, size = 78, normalized size = 0.98 \begin {gather*} \frac {b B x+2 A \sqrt {b-c} \sqrt {b+c} \text {ArcTan}\left (\frac {c+b \tanh \left (\frac {x}{2}\right )}{\sqrt {b-c} \sqrt {b+c}}\right )-B c \log (b \cosh (x)+c \sinh (x))}{b^2-c^2} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[(A + B*Cosh[x])/(b*Cosh[x] + c*Sinh[x]),x]

[Out]

(b*B*x + 2*A*Sqrt[b - c]*Sqrt[b + c]*ArcTan[(c + b*Tanh[x/2])/(Sqrt[b - c]*Sqrt[b + c])] - B*c*Log[b*Cosh[x] +
 c*Sinh[x]])/(b^2 - c^2)

________________________________________________________________________________________

Maple [A]
time = 1.24, size = 126, normalized size = 1.58

method result size
default \(-\frac {2 B \ln \left (\tanh \left (\frac {x}{2}\right )-1\right )}{2 b +2 c}+\frac {-B c \ln \left (b \left (\tanh ^{2}\left (\frac {x}{2}\right )\right )+2 c \tanh \left (\frac {x}{2}\right )+b \right )+\frac {2 \left (A \,b^{2}-A \,c^{2}\right ) \arctan \left (\frac {2 b \tanh \left (\frac {x}{2}\right )+2 c}{2 \sqrt {b^{2}-c^{2}}}\right )}{\sqrt {b^{2}-c^{2}}}}{\left (b -c \right ) \left (b +c \right )}+\frac {2 B \ln \left (\tanh \left (\frac {x}{2}\right )+1\right )}{2 b -2 c}\) \(126\)
risch \(\frac {B x}{b +c}+\frac {2 x B \,b^{2} c}{b^{4}-2 b^{2} c^{2}+c^{4}}-\frac {2 x B \,c^{3}}{b^{4}-2 b^{2} c^{2}+c^{4}}-\frac {\ln \left ({\mathrm e}^{x}+\frac {\sqrt {-A^{2} b^{2}+A^{2} c^{2}}}{A \left (b +c \right )}\right ) B c}{\left (b +c \right ) \left (b -c \right )}+\frac {\ln \left ({\mathrm e}^{x}+\frac {\sqrt {-A^{2} b^{2}+A^{2} c^{2}}}{A \left (b +c \right )}\right ) \sqrt {-A^{2} b^{2}+A^{2} c^{2}}}{\left (b +c \right ) \left (b -c \right )}-\frac {\ln \left ({\mathrm e}^{x}-\frac {\sqrt {-A^{2} b^{2}+A^{2} c^{2}}}{A \left (b +c \right )}\right ) B c}{\left (b +c \right ) \left (b -c \right )}-\frac {\ln \left ({\mathrm e}^{x}-\frac {\sqrt {-A^{2} b^{2}+A^{2} c^{2}}}{A \left (b +c \right )}\right ) \sqrt {-A^{2} b^{2}+A^{2} c^{2}}}{\left (b +c \right ) \left (b -c \right )}\) \(280\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((A+B*cosh(x))/(b*cosh(x)+c*sinh(x)),x,method=_RETURNVERBOSE)

[Out]

-2*B/(2*b+2*c)*ln(tanh(1/2*x)-1)+2/(b-c)/(b+c)*(-1/2*B*c*ln(b*tanh(1/2*x)^2+2*c*tanh(1/2*x)+b)+(A*b^2-A*c^2)/(
b^2-c^2)^(1/2)*arctan(1/2*(2*b*tanh(1/2*x)+2*c)/(b^2-c^2)^(1/2)))+2*B/(2*b-2*c)*ln(tanh(1/2*x)+1)

________________________________________________________________________________________

Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: ValueError} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((A+B*cosh(x))/(b*cosh(x)+c*sinh(x)),x, algorithm="maxima")

[Out]

Exception raised: ValueError >> Computation failed since Maxima requested additional constraints; using the 'a
ssume' command before evaluation *may* help (example of legal syntax is 'assume(4*c^2-4*b^2>0)', see `assume?`
 for more de

________________________________________________________________________________________

Fricas [A]
time = 0.38, size = 234, normalized size = 2.92 \begin {gather*} \left [-\frac {B c \log \left (\frac {2 \, {\left (b \cosh \left (x\right ) + c \sinh \left (x\right )\right )}}{\cosh \left (x\right ) - \sinh \left (x\right )}\right ) + \sqrt {-b^{2} + c^{2}} A \log \left (\frac {{\left (b + c\right )} \cosh \left (x\right )^{2} + 2 \, {\left (b + c\right )} \cosh \left (x\right ) \sinh \left (x\right ) + {\left (b + c\right )} \sinh \left (x\right )^{2} - 2 \, \sqrt {-b^{2} + c^{2}} {\left (\cosh \left (x\right ) + \sinh \left (x\right )\right )} - b + c}{{\left (b + c\right )} \cosh \left (x\right )^{2} + 2 \, {\left (b + c\right )} \cosh \left (x\right ) \sinh \left (x\right ) + {\left (b + c\right )} \sinh \left (x\right )^{2} + b - c}\right ) - {\left (B b + B c\right )} x}{b^{2} - c^{2}}, -\frac {B c \log \left (\frac {2 \, {\left (b \cosh \left (x\right ) + c \sinh \left (x\right )\right )}}{\cosh \left (x\right ) - \sinh \left (x\right )}\right ) + 2 \, \sqrt {b^{2} - c^{2}} A \arctan \left (\frac {\sqrt {b^{2} - c^{2}}}{{\left (b + c\right )} \cosh \left (x\right ) + {\left (b + c\right )} \sinh \left (x\right )}\right ) - {\left (B b + B c\right )} x}{b^{2} - c^{2}}\right ] \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((A+B*cosh(x))/(b*cosh(x)+c*sinh(x)),x, algorithm="fricas")

[Out]

[-(B*c*log(2*(b*cosh(x) + c*sinh(x))/(cosh(x) - sinh(x))) + sqrt(-b^2 + c^2)*A*log(((b + c)*cosh(x)^2 + 2*(b +
 c)*cosh(x)*sinh(x) + (b + c)*sinh(x)^2 - 2*sqrt(-b^2 + c^2)*(cosh(x) + sinh(x)) - b + c)/((b + c)*cosh(x)^2 +
 2*(b + c)*cosh(x)*sinh(x) + (b + c)*sinh(x)^2 + b - c)) - (B*b + B*c)*x)/(b^2 - c^2), -(B*c*log(2*(b*cosh(x)
+ c*sinh(x))/(cosh(x) - sinh(x))) + 2*sqrt(b^2 - c^2)*A*arctan(sqrt(b^2 - c^2)/((b + c)*cosh(x) + (b + c)*sinh
(x))) - (B*b + B*c)*x)/(b^2 - c^2)]

________________________________________________________________________________________

Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 697 vs. \(2 (66) = 132\).
time = 30.74, size = 697, normalized size = 8.71 \begin {gather*} \begin {cases} \tilde {\infty } \left (A \log {\left (\tanh {\left (\frac {x}{2} \right )} \right )} + B x - 2 B \log {\left (\tanh {\left (\frac {x}{2} \right )} + 1 \right )} + B \log {\left (\tanh {\left (\frac {x}{2} \right )} \right )}\right ) & \text {for}\: b = 0 \wedge c = 0 \\\frac {A \log {\left (\tanh {\left (\frac {x}{2} \right )} \right )} + B x - 2 B \log {\left (\tanh {\left (\frac {x}{2} \right )} + 1 \right )} + B \log {\left (\tanh {\left (\frac {x}{2} \right )} \right )}}{c} & \text {for}\: b = 0 \\- \frac {2 A}{- 2 c \sinh {\left (x \right )} + 2 c \cosh {\left (x \right )}} + \frac {B x \sinh {\left (x \right )}}{- 2 c \sinh {\left (x \right )} + 2 c \cosh {\left (x \right )}} - \frac {B x \cosh {\left (x \right )}}{- 2 c \sinh {\left (x \right )} + 2 c \cosh {\left (x \right )}} - \frac {B \cosh {\left (x \right )}}{- 2 c \sinh {\left (x \right )} + 2 c \cosh {\left (x \right )}} & \text {for}\: b = - c \\- \frac {2 A}{2 c \sinh {\left (x \right )} + 2 c \cosh {\left (x \right )}} + \frac {B x \sinh {\left (x \right )}}{2 c \sinh {\left (x \right )} + 2 c \cosh {\left (x \right )}} + \frac {B x \cosh {\left (x \right )}}{2 c \sinh {\left (x \right )} + 2 c \cosh {\left (x \right )}} - \frac {B \cosh {\left (x \right )}}{2 c \sinh {\left (x \right )} + 2 c \cosh {\left (x \right )}} & \text {for}\: b = c \\\frac {A b^{2} \log {\left (\tanh {\left (\frac {x}{2} \right )} + \frac {c}{b} - \frac {\sqrt {- b^{2} + c^{2}}}{b} \right )}}{b^{2} \sqrt {- b^{2} + c^{2}} - c^{2} \sqrt {- b^{2} + c^{2}}} - \frac {A b^{2} \log {\left (\tanh {\left (\frac {x}{2} \right )} + \frac {c}{b} + \frac {\sqrt {- b^{2} + c^{2}}}{b} \right )}}{b^{2} \sqrt {- b^{2} + c^{2}} - c^{2} \sqrt {- b^{2} + c^{2}}} - \frac {A c^{2} \log {\left (\tanh {\left (\frac {x}{2} \right )} + \frac {c}{b} - \frac {\sqrt {- b^{2} + c^{2}}}{b} \right )}}{b^{2} \sqrt {- b^{2} + c^{2}} - c^{2} \sqrt {- b^{2} + c^{2}}} + \frac {A c^{2} \log {\left (\tanh {\left (\frac {x}{2} \right )} + \frac {c}{b} + \frac {\sqrt {- b^{2} + c^{2}}}{b} \right )}}{b^{2} \sqrt {- b^{2} + c^{2}} - c^{2} \sqrt {- b^{2} + c^{2}}} + \frac {B b x \sqrt {- b^{2} + c^{2}}}{b^{2} \sqrt {- b^{2} + c^{2}} - c^{2} \sqrt {- b^{2} + c^{2}}} - \frac {B c x \sqrt {- b^{2} + c^{2}}}{b^{2} \sqrt {- b^{2} + c^{2}} - c^{2} \sqrt {- b^{2} + c^{2}}} + \frac {2 B c \sqrt {- b^{2} + c^{2}} \log {\left (\tanh {\left (\frac {x}{2} \right )} + 1 \right )}}{b^{2} \sqrt {- b^{2} + c^{2}} - c^{2} \sqrt {- b^{2} + c^{2}}} - \frac {B c \sqrt {- b^{2} + c^{2}} \log {\left (\tanh {\left (\frac {x}{2} \right )} + \frac {c}{b} - \frac {\sqrt {- b^{2} + c^{2}}}{b} \right )}}{b^{2} \sqrt {- b^{2} + c^{2}} - c^{2} \sqrt {- b^{2} + c^{2}}} - \frac {B c \sqrt {- b^{2} + c^{2}} \log {\left (\tanh {\left (\frac {x}{2} \right )} + \frac {c}{b} + \frac {\sqrt {- b^{2} + c^{2}}}{b} \right )}}{b^{2} \sqrt {- b^{2} + c^{2}} - c^{2} \sqrt {- b^{2} + c^{2}}} & \text {otherwise} \end {cases} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((A+B*cosh(x))/(b*cosh(x)+c*sinh(x)),x)

[Out]

Piecewise((zoo*(A*log(tanh(x/2)) + B*x - 2*B*log(tanh(x/2) + 1) + B*log(tanh(x/2))), Eq(b, 0) & Eq(c, 0)), ((A
*log(tanh(x/2)) + B*x - 2*B*log(tanh(x/2) + 1) + B*log(tanh(x/2)))/c, Eq(b, 0)), (-2*A/(-2*c*sinh(x) + 2*c*cos
h(x)) + B*x*sinh(x)/(-2*c*sinh(x) + 2*c*cosh(x)) - B*x*cosh(x)/(-2*c*sinh(x) + 2*c*cosh(x)) - B*cosh(x)/(-2*c*
sinh(x) + 2*c*cosh(x)), Eq(b, -c)), (-2*A/(2*c*sinh(x) + 2*c*cosh(x)) + B*x*sinh(x)/(2*c*sinh(x) + 2*c*cosh(x)
) + B*x*cosh(x)/(2*c*sinh(x) + 2*c*cosh(x)) - B*cosh(x)/(2*c*sinh(x) + 2*c*cosh(x)), Eq(b, c)), (A*b**2*log(ta
nh(x/2) + c/b - sqrt(-b**2 + c**2)/b)/(b**2*sqrt(-b**2 + c**2) - c**2*sqrt(-b**2 + c**2)) - A*b**2*log(tanh(x/
2) + c/b + sqrt(-b**2 + c**2)/b)/(b**2*sqrt(-b**2 + c**2) - c**2*sqrt(-b**2 + c**2)) - A*c**2*log(tanh(x/2) +
c/b - sqrt(-b**2 + c**2)/b)/(b**2*sqrt(-b**2 + c**2) - c**2*sqrt(-b**2 + c**2)) + A*c**2*log(tanh(x/2) + c/b +
 sqrt(-b**2 + c**2)/b)/(b**2*sqrt(-b**2 + c**2) - c**2*sqrt(-b**2 + c**2)) + B*b*x*sqrt(-b**2 + c**2)/(b**2*sq
rt(-b**2 + c**2) - c**2*sqrt(-b**2 + c**2)) - B*c*x*sqrt(-b**2 + c**2)/(b**2*sqrt(-b**2 + c**2) - c**2*sqrt(-b
**2 + c**2)) + 2*B*c*sqrt(-b**2 + c**2)*log(tanh(x/2) + 1)/(b**2*sqrt(-b**2 + c**2) - c**2*sqrt(-b**2 + c**2))
 - B*c*sqrt(-b**2 + c**2)*log(tanh(x/2) + c/b - sqrt(-b**2 + c**2)/b)/(b**2*sqrt(-b**2 + c**2) - c**2*sqrt(-b*
*2 + c**2)) - B*c*sqrt(-b**2 + c**2)*log(tanh(x/2) + c/b + sqrt(-b**2 + c**2)/b)/(b**2*sqrt(-b**2 + c**2) - c*
*2*sqrt(-b**2 + c**2)), True))

________________________________________________________________________________________

Giac [A]
time = 0.41, size = 80, normalized size = 1.00 \begin {gather*} -\frac {B c \log \left (b e^{\left (2 \, x\right )} + c e^{\left (2 \, x\right )} + b - c\right )}{b^{2} - c^{2}} + \frac {2 \, A \arctan \left (\frac {b e^{x} + c e^{x}}{\sqrt {b^{2} - c^{2}}}\right )}{\sqrt {b^{2} - c^{2}}} + \frac {B x}{b - c} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((A+B*cosh(x))/(b*cosh(x)+c*sinh(x)),x, algorithm="giac")

[Out]

-B*c*log(b*e^(2*x) + c*e^(2*x) + b - c)/(b^2 - c^2) + 2*A*arctan((b*e^x + c*e^x)/sqrt(b^2 - c^2))/sqrt(b^2 - c
^2) + B*x/(b - c)

________________________________________________________________________________________

Mupad [B]
time = 3.05, size = 177, normalized size = 2.21 \begin {gather*} \frac {2\,\mathrm {atan}\left (\frac {A\,{\mathrm {e}}^x\,\sqrt {b^2-c^2}}{b\,\sqrt {A^2}-c\,\sqrt {A^2}}\right )\,\sqrt {A^2}}{\sqrt {b^2-c^2}}+\frac {B\,x}{b-c}+\frac {B\,c^3\,\ln \left (4\,A^2\,b-4\,A^2\,c+4\,A^2\,b\,{\mathrm {e}}^{2\,x}+4\,A^2\,c\,{\mathrm {e}}^{2\,x}\right )}{b^4-2\,b^2\,c^2+c^4}-\frac {B\,b^2\,c\,\ln \left (4\,A^2\,b-4\,A^2\,c+4\,A^2\,b\,{\mathrm {e}}^{2\,x}+4\,A^2\,c\,{\mathrm {e}}^{2\,x}\right )}{b^4-2\,b^2\,c^2+c^4} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((A + B*cosh(x))/(b*cosh(x) + c*sinh(x)),x)

[Out]

(2*atan((A*exp(x)*(b^2 - c^2)^(1/2))/(b*(A^2)^(1/2) - c*(A^2)^(1/2)))*(A^2)^(1/2))/(b^2 - c^2)^(1/2) + (B*x)/(
b - c) + (B*c^3*log(4*A^2*b - 4*A^2*c + 4*A^2*b*exp(2*x) + 4*A^2*c*exp(2*x)))/(b^4 + c^4 - 2*b^2*c^2) - (B*b^2
*c*log(4*A^2*b - 4*A^2*c + 4*A^2*b*exp(2*x) + 4*A^2*c*exp(2*x)))/(b^4 + c^4 - 2*b^2*c^2)

________________________________________________________________________________________