3.1.70 \(\int \frac {(-A^2-B^2) \cos ^2(z)}{B (1-\frac {(A^2+B^2) \sin ^2(z)}{B^2})} \, dz\) [70]

Optimal. Leaf size=16 \[ -B z-A \tanh ^{-1}\left (\frac {A \tan (z)}{B}\right ) \]

[Out]

-B*z-A*arctanh(A*tan(z)/B)

________________________________________________________________________________________

Rubi [A]
time = 0.06, antiderivative size = 16, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 5, integrand size = 39, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.128, Rules used = {12, 3270, 400, 209, 212} \begin {gather*} -A \tanh ^{-1}\left (\frac {A \tan (z)}{B}\right )-B z \end {gather*}

Antiderivative was successfully verified.

[In]

Int[((-A^2 - B^2)*Cos[z]^2)/(B*(1 - ((A^2 + B^2)*Sin[z]^2)/B^2)),z]

[Out]

-(B*z) - A*ArcTanh[(A*Tan[z])/B]

Rule 12

Int[(a_)*(u_), x_Symbol] :> Dist[a, Int[u, x], x] /; FreeQ[a, x] &&  !MatchQ[u, (b_)*(v_) /; FreeQ[b, x]]

Rule 209

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

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 400

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

Rule 3270

Int[cos[(e_.) + (f_.)*(x_)]^(m_)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)]^2)^(p_.), x_Symbol] :> With[{ff = FreeF
actors[Tan[e + f*x], x]}, Dist[ff/f, Subst[Int[(a + (a + b)*ff^2*x^2)^p/(1 + ff^2*x^2)^(m/2 + p + 1), x], x, T
an[e + f*x]/ff], x]] /; FreeQ[{a, b, e, f}, x] && IntegerQ[m/2] && IntegerQ[p]

Rubi steps

\begin {align*} \int \frac {\left (-A^2-B^2\right ) \cos ^2(z)}{B \left (1-\frac {\left (A^2+B^2\right ) \sin ^2(z)}{B^2}\right )} \, dz &=-\frac {\left (A^2+B^2\right ) \int \frac {\cos ^2(z)}{1-\frac {\left (A^2+B^2\right ) \sin ^2(z)}{B^2}} \, dz}{B}\\ &=-\frac {\left (A^2+B^2\right ) \text {Subst}\left (\int \frac {1}{\left (1+z^2\right ) \left (1+\left (1-\frac {A^2+B^2}{B^2}\right ) z^2\right )} \, dz,z,\tan (z)\right )}{B}\\ &=-\frac {A^2 \text {Subst}\left (\int \frac {1}{1+\left (1-\frac {A^2+B^2}{B^2}\right ) z^2} \, dz,z,\tan (z)\right )}{B}-B \text {Subst}\left (\int \frac {1}{1+z^2} \, dz,z,\tan (z)\right )\\ &=-B z-A \tanh ^{-1}\left (\frac {A \tan (z)}{B}\right )\\ \end {align*}

________________________________________________________________________________________

Mathematica [B] Leaf count is larger than twice the leaf count of optimal. \(35\) vs. \(2(16)=32\).
time = 0.07, size = 35, normalized size = 2.19 \begin {gather*} -\frac {B \left (A^2+B^2\right ) \left (B z+A \tanh ^{-1}\left (\frac {A \tan (z)}{B}\right )\right )}{A^2 B+B^3} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[((-A^2 - B^2)*Cos[z]^2)/(B*(1 - ((A^2 + B^2)*Sin[z]^2)/B^2)),z]

[Out]

-((B*(A^2 + B^2)*(B*z + A*ArcTanh[(A*Tan[z])/B]))/(A^2*B + B^3))

________________________________________________________________________________________

Maple [B] Leaf count of result is larger than twice the leaf count of optimal. \(73\) vs. \(2(16)=32\).
time = 0.12, size = 74, normalized size = 4.62

method result size
default \(\left (-A^{2}-B^{2}\right ) B \left (\frac {A \ln \left (A \tan \left (z \right )+B \right )}{2 B \left (A^{2}+B^{2}\right )}-\frac {A \ln \left (A \tan \left (z \right )-B \right )}{2 B \left (A^{2}+B^{2}\right )}+\frac {\arctan \left (\tan \left (z \right )\right )}{A^{2}+B^{2}}\right )\) \(74\)
norman \(\frac {-B z -2 B z \left (\tan ^{2}\left (\frac {z}{2}\right )\right )-B z \left (\tan ^{4}\left (\frac {z}{2}\right )\right )}{\left (1+\tan ^{2}\left (\frac {z}{2}\right )\right )^{2}}-\frac {A \ln \left (-B \left (\tan ^{2}\left (\frac {z}{2}\right )\right )+2 A \tan \left (\frac {z}{2}\right )+B \right )}{2}+\frac {A \ln \left (B \left (\tan ^{2}\left (\frac {z}{2}\right )\right )+2 A \tan \left (\frac {z}{2}\right )-B \right )}{2}\) \(83\)
risch \(-\frac {B z \,A^{2}}{A^{2}+B^{2}}-\frac {B^{3} z}{A^{2}+B^{2}}+\frac {A^{3} \ln \left ({\mathrm e}^{2 i z}-\frac {i B +A}{-i B +A}\right )}{2 A^{2}+2 B^{2}}+\frac {A \ln \left ({\mathrm e}^{2 i z}-\frac {i B +A}{-i B +A}\right ) B^{2}}{2 A^{2}+2 B^{2}}-\frac {A^{3} \ln \left ({\mathrm e}^{2 i z}-\frac {-i B +A}{i B +A}\right )}{2 \left (A^{2}+B^{2}\right )}-\frac {A \ln \left ({\mathrm e}^{2 i z}-\frac {-i B +A}{i B +A}\right ) B^{2}}{2 \left (A^{2}+B^{2}\right )}\) \(183\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((-A^2-B^2)*cos(z)^2/B/(1-(A^2+B^2)*sin(z)^2/B^2),z,method=_RETURNVERBOSE)

[Out]

(-A^2-B^2)*B*(1/2*A/B/(A^2+B^2)*ln(A*tan(z)+B)-1/2*A/B/(A^2+B^2)*ln(A*tan(z)-B)+1/(A^2+B^2)*arctan(tan(z)))

________________________________________________________________________________________

Maxima [B] Leaf count of result is larger than twice the leaf count of optimal. 69 vs. \(2 (16) = 32\).
time = 2.29, size = 69, normalized size = 4.31 \begin {gather*} -\frac {{\left (A^{2} + B^{2}\right )} {\left (\frac {2 \, B^{2} z}{A^{2} + B^{2}} + \frac {A B \log \left (A \tan \left (z\right ) + B\right )}{A^{2} + B^{2}} - \frac {A B \log \left (A \tan \left (z\right ) - B\right )}{A^{2} + B^{2}}\right )}}{2 \, B} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((-A^2-B^2)*cos(z)^2/B/(1-(A^2+B^2)*sin(z)^2/B^2),z, algorithm="maxima")

[Out]

-1/2*(A^2 + B^2)*(2*B^2*z/(A^2 + B^2) + A*B*log(A*tan(z) + B)/(A^2 + B^2) - A*B*log(A*tan(z) - B)/(A^2 + B^2))
/B

________________________________________________________________________________________

Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 67 vs. \(2 (16) = 32\).
time = 1.85, size = 67, normalized size = 4.19 \begin {gather*} -B z - \frac {1}{4} \, A \log \left (2 \, A B \cos \left (z\right ) \sin \left (z\right ) - {\left (A^{2} - B^{2}\right )} \cos \left (z\right )^{2} + A^{2}\right ) + \frac {1}{4} \, A \log \left (-2 \, A B \cos \left (z\right ) \sin \left (z\right ) - {\left (A^{2} - B^{2}\right )} \cos \left (z\right )^{2} + A^{2}\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((-A^2-B^2)*cos(z)^2/B/(1-(A^2+B^2)*sin(z)^2/B^2),z, algorithm="fricas")

[Out]

-B*z - 1/4*A*log(2*A*B*cos(z)*sin(z) - (A^2 - B^2)*cos(z)^2 + A^2) + 1/4*A*log(-2*A*B*cos(z)*sin(z) - (A^2 - B
^2)*cos(z)^2 + A^2)

________________________________________________________________________________________

Sympy [A]
time = 112.06, size = 202, normalized size = 12.62 \begin {gather*} \frac {\left (- A^{2} - B^{2}\right ) \left (\begin {cases} z & \text {for}\: A = 0 \wedge B = 0 \\\frac {z \sin ^{2}{\left (z \right )}}{2} + \frac {z \cos ^{2}{\left (z \right )}}{2} + \frac {\sin {\left (z \right )} \cos {\left (z \right )}}{2} & \text {for}\: A = - i B \vee A = i B \\\frac {A B \log {\left (- \frac {A}{B} + \tan {\left (\frac {z}{2} \right )} - \frac {\sqrt {A^{2} + B^{2}}}{B} \right )}}{2 A^{2} + 2 B^{2}} + \frac {A B \log {\left (- \frac {A}{B} + \tan {\left (\frac {z}{2} \right )} + \frac {\sqrt {A^{2} + B^{2}}}{B} \right )}}{2 A^{2} + 2 B^{2}} - \frac {A B \log {\left (\frac {A}{B} + \tan {\left (\frac {z}{2} \right )} - \frac {\sqrt {A^{2} + B^{2}}}{B} \right )}}{2 A^{2} + 2 B^{2}} - \frac {A B \log {\left (\frac {A}{B} + \tan {\left (\frac {z}{2} \right )} + \frac {\sqrt {A^{2} + B^{2}}}{B} \right )}}{2 A^{2} + 2 B^{2}} + \frac {2 B^{2} z}{2 A^{2} + 2 B^{2}} & \text {otherwise} \end {cases}\right )}{B} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((-A**2-B**2)*cos(z)**2/B/(1-(A**2+B**2)*sin(z)**2/B**2),z)

[Out]

(-A**2 - B**2)*Piecewise((z, Eq(A, 0) & Eq(B, 0)), (z*sin(z)**2/2 + z*cos(z)**2/2 + sin(z)*cos(z)/2, Eq(A, I*B
) | Eq(A, -I*B)), (A*B*log(-A/B + tan(z/2) - sqrt(A**2 + B**2)/B)/(2*A**2 + 2*B**2) + A*B*log(-A/B + tan(z/2)
+ sqrt(A**2 + B**2)/B)/(2*A**2 + 2*B**2) - A*B*log(A/B + tan(z/2) - sqrt(A**2 + B**2)/B)/(2*A**2 + 2*B**2) - A
*B*log(A/B + tan(z/2) + sqrt(A**2 + B**2)/B)/(2*A**2 + 2*B**2) + 2*B**2*z/(2*A**2 + 2*B**2), True))/B

________________________________________________________________________________________

Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 83 vs. \(2 (16) = 32\).
time = 0.49, size = 83, normalized size = 5.19 \begin {gather*} -\frac {{\left (\frac {A^{3} B \log \left ({\left | A \tan \left (z\right ) + B \right |}\right )}{A^{4} + A^{2} B^{2}} - \frac {A^{3} B \log \left ({\left | A \tan \left (z\right ) - B \right |}\right )}{A^{4} + A^{2} B^{2}} + \frac {2 \, B^{2} z}{A^{2} + B^{2}}\right )} {\left (A^{2} + B^{2}\right )}}{2 \, B} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((-A^2-B^2)*cos(z)^2/B/(1-(A^2+B^2)*sin(z)^2/B^2),z, algorithm="giac")

[Out]

-1/2*(A^3*B*log(abs(A*tan(z) + B))/(A^4 + A^2*B^2) - A^3*B*log(abs(A*tan(z) - B))/(A^4 + A^2*B^2) + 2*B^2*z/(A
^2 + B^2))*(A^2 + B^2)/B

________________________________________________________________________________________

Mupad [B]
time = 0.50, size = 360, normalized size = 22.50 \begin {gather*} -A\,\mathrm {atanh}\left (\frac {2\,A^{13}\,\mathrm {tan}\left (z\right )}{2\,A^{12}\,B+6\,A^{10}\,B^3+6\,A^8\,B^5+2\,A^6\,B^7}+\frac {2\,A^7\,B^6\,\mathrm {tan}\left (z\right )}{2\,A^{12}\,B+6\,A^{10}\,B^3+6\,A^8\,B^5+2\,A^6\,B^7}+\frac {6\,A^9\,B^4\,\mathrm {tan}\left (z\right )}{2\,A^{12}\,B+6\,A^{10}\,B^3+6\,A^8\,B^5+2\,A^6\,B^7}+\frac {6\,A^{11}\,B^2\,\mathrm {tan}\left (z\right )}{2\,A^{12}\,B+6\,A^{10}\,B^3+6\,A^8\,B^5+2\,A^6\,B^7}\right )-B\,\mathrm {atan}\left (\frac {2\,A^4\,B^9\,\mathrm {tan}\left (z\right )}{2\,A^{10}\,B^3+6\,A^8\,B^5+6\,A^6\,B^7+2\,A^4\,B^9}+\frac {6\,A^6\,B^7\,\mathrm {tan}\left (z\right )}{2\,A^{10}\,B^3+6\,A^8\,B^5+6\,A^6\,B^7+2\,A^4\,B^9}+\frac {6\,A^8\,B^5\,\mathrm {tan}\left (z\right )}{2\,A^{10}\,B^3+6\,A^8\,B^5+6\,A^6\,B^7+2\,A^4\,B^9}+\frac {2\,A^{10}\,B^3\,\mathrm {tan}\left (z\right )}{2\,A^{10}\,B^3+6\,A^8\,B^5+6\,A^6\,B^7+2\,A^4\,B^9}\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((cos(z)^2*(A^2 + B^2))/(B*((sin(z)^2*(A^2 + B^2))/B^2 - 1)),z)

[Out]

- A*atanh((2*A^13*tan(z))/(2*A^12*B + 2*A^6*B^7 + 6*A^8*B^5 + 6*A^10*B^3) + (2*A^7*B^6*tan(z))/(2*A^12*B + 2*A
^6*B^7 + 6*A^8*B^5 + 6*A^10*B^3) + (6*A^9*B^4*tan(z))/(2*A^12*B + 2*A^6*B^7 + 6*A^8*B^5 + 6*A^10*B^3) + (6*A^1
1*B^2*tan(z))/(2*A^12*B + 2*A^6*B^7 + 6*A^8*B^5 + 6*A^10*B^3)) - B*atan((2*A^4*B^9*tan(z))/(2*A^4*B^9 + 6*A^6*
B^7 + 6*A^8*B^5 + 2*A^10*B^3) + (6*A^6*B^7*tan(z))/(2*A^4*B^9 + 6*A^6*B^7 + 6*A^8*B^5 + 2*A^10*B^3) + (6*A^8*B
^5*tan(z))/(2*A^4*B^9 + 6*A^6*B^7 + 6*A^8*B^5 + 2*A^10*B^3) + (2*A^10*B^3*tan(z))/(2*A^4*B^9 + 6*A^6*B^7 + 6*A
^8*B^5 + 2*A^10*B^3))

________________________________________________________________________________________