3.3.58 \(\int \frac {\sec ^2(1+\log (x))-\tan (1+\log (x))}{x^2} \, dx\) [258]

Optimal. Leaf size=9 \[ \frac {\tan (1+\log (x))}{x} \]

[Out]

tan(1+ln(x))/x

________________________________________________________________________________________

Rubi [C] Result contains higher order function than in optimal. Order 5 vs. order 3 in optimal.
time = 0.05, antiderivative size = 81, normalized size of antiderivative = 9.00, number of steps used = 7, number of rules used = 5, integrand size = 19, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.263, Rules used = {14, 4601, 371, 4591, 470} \begin {gather*} \frac {2 i \operatorname {Hypergeometric2F1}\left (\frac {i}{2},1,1+\frac {i}{2},-e^{2 i} x^{2 i}\right )}{x}-\left (\frac {4}{5}+\frac {8 i}{5}\right ) e^{2 i} x^{-1+2 i} \operatorname {Hypergeometric2F1}\left (1+\frac {i}{2},2,2+\frac {i}{2},-e^{2 i} x^{2 i}\right )-\frac {i}{x} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(Sec[1 + Log[x]]^2 - Tan[1 + Log[x]])/x^2,x]

[Out]

(-I)/x + ((2*I)*Hypergeometric2F1[I/2, 1, 1 + I/2, -(E^(2*I)*x^(2*I))])/x - ((4/5 + (8*I)/5)*E^(2*I)*Hypergeom
etric2F1[1 + I/2, 2, 2 + I/2, -(E^(2*I)*x^(2*I))])/x^(1 - 2*I)

Rule 14

Int[(u_)*((c_.)*(x_))^(m_.), x_Symbol] :> Int[ExpandIntegrand[(c*x)^m*u, x], x] /; FreeQ[{c, m}, x] && SumQ[u]
 &&  !LinearQ[u, x] &&  !MatchQ[u, (a_) + (b_.)*(v_) /; FreeQ[{a, b}, x] && InverseFunctionQ[v]]

Rule 371

Int[((c_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_), x_Symbol] :> Simp[a^p*((c*x)^(m + 1)/(c*(m + 1)))*Hyperg
eometric2F1[-p, (m + 1)/n, (m + 1)/n + 1, (-b)*(x^n/a)], x] /; FreeQ[{a, b, c, m, n, p}, x] &&  !IGtQ[p, 0] &&
 (ILtQ[p, 0] || GtQ[a, 0])

Rule 470

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

Rule 4591

Int[((e_.)*(x_))^(m_.)*Tan[((a_.) + Log[x_]*(b_.))*(d_.)]^(p_.), x_Symbol] :> Int[(e*x)^m*((I - I*E^(2*I*a*d)*
x^(2*I*b*d))/(1 + E^(2*I*a*d)*x^(2*I*b*d)))^p, x] /; FreeQ[{a, b, d, e, m, p}, x]

Rule 4601

Int[((e_.)*(x_))^(m_.)*Sec[((a_.) + Log[x_]*(b_.))*(d_.)]^(p_.), x_Symbol] :> Dist[2^p*E^(I*a*d*p), Int[(e*x)^
m*(x^(I*b*d*p)/(1 + E^(2*I*a*d)*x^(2*I*b*d))^p), x], x] /; FreeQ[{a, b, d, e, m}, x] && IntegerQ[p]

Rubi steps

\begin {gather*} \begin {aligned} \text {Integral} &=\int \left (\frac {\sec ^2(1+\log (x))}{x^2}-\frac {\tan (1+\log (x))}{x^2}\right ) \, dx\\ &=\int \frac {\sec ^2(1+\log (x))}{x^2} \, dx-\int \frac {\tan (1+\log (x))}{x^2} \, dx\\ &=\left (4 e^{2 i}\right ) \int \frac {x^{-2+2 i}}{\left (1+e^{2 i} x^{2 i}\right )^2} \, dx-\int \frac {i-i e^{2 i} x^{2 i}}{\left (1+e^{2 i} x^{2 i}\right ) x^2} \, dx\\ &=-\frac {i}{x}-\left (\frac {4}{5}+\frac {8 i}{5}\right ) e^{2 i} x^{-1+2 i} \operatorname {Hypergeometric2F1}\left (1+\frac {i}{2},2,2+\frac {i}{2},-e^{2 i} x^{2 i}\right )-2 i \int \frac {1}{\left (1+e^{2 i} x^{2 i}\right ) x^2} \, dx\\ &=-\frac {i}{x}+\frac {2 i \operatorname {Hypergeometric2F1}\left (\frac {i}{2},1,1+\frac {i}{2},-e^{2 i} x^{2 i}\right )}{x}-\left (\frac {4}{5}+\frac {8 i}{5}\right ) e^{2 i} x^{-1+2 i} \operatorname {Hypergeometric2F1}\left (1+\frac {i}{2},2,2+\frac {i}{2},-e^{2 i} x^{2 i}\right )\\ \end {aligned} \end {gather*}

________________________________________________________________________________________

Mathematica [B] Leaf count is larger than twice the leaf count of optimal. \(21\) vs. \(2(9)=18\).
time = 0.47, size = 21, normalized size = 2.33 \begin {gather*} \frac {\sec (1) \sec (1+\log (x)) \sin (\log (x))}{x}+\frac {\tan (1)}{x} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[(Sec[1 + Log[x]]^2 - Tan[1 + Log[x]])/x^2,x]

[Out]

(Sec[1]*Sec[1 + Log[x]]*Sin[Log[x]])/x + Tan[1]/x

________________________________________________________________________________________

Maple [C] Result contains complex when optimal does not.
time = 1.36, size = 28, normalized size = 3.11

method result size
risch \(-\frac {i}{x}+\frac {2 i}{x \left (x^{2 i} {\mathrm e}^{2 i}+1\right )}\) \(28\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((sec(1+ln(x))^2-tan(1+ln(x)))/x^2,x,method=_RETURNVERBOSE)

[Out]

-I/x+2*I/x/((x^I)^2*exp(2*I)+1)

________________________________________________________________________________________

Maxima [B] Leaf count of result is larger than twice the leaf count of optimal. 45 vs. \(2 (9) = 18\).
time = 0.44, size = 45, normalized size = 5.00 \begin {gather*} \frac {2 \, \sin \left (2 \, \log \left (x\right ) + 2\right )}{x \cos \left (2 \, \log \left (x\right ) + 2\right )^{2} + x \sin \left (2 \, \log \left (x\right ) + 2\right )^{2} + 2 \, x \cos \left (2 \, \log \left (x\right ) + 2\right ) + x} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((sec(1+log(x))^2-tan(1+log(x)))/x^2,x, algorithm="maxima")

[Out]

2*sin(2*log(x) + 2)/(x*cos(2*log(x) + 2)^2 + x*sin(2*log(x) + 2)^2 + 2*x*cos(2*log(x) + 2) + x)

________________________________________________________________________________________

Fricas [A]
time = 0.61, size = 16, normalized size = 1.78 \begin {gather*} \frac {\sin \left (\log \left (x\right ) + 1\right )}{x \cos \left (\log \left (x\right ) + 1\right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((sec(1+log(x))^2-tan(1+log(x)))/x^2,x, algorithm="fricas")

[Out]

sin(log(x) + 1)/(x*cos(log(x) + 1))

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \frac {- \tan {\left (\log {\left (x \right )} + 1 \right )} + \sec ^{2}{\left (\log {\left (x \right )} + 1 \right )}}{x^{2}}\, dx \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((sec(1+ln(x))**2-tan(1+ln(x)))/x**2,x)

[Out]

Integral((-tan(log(x) + 1) + sec(log(x) + 1)**2)/x**2, x)

________________________________________________________________________________________

Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 5161 vs. \(2 (9) = 18\).
time = 1.68, size = 5161, normalized size = 573.44 \begin {gather*} \text {Too large to display} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((sec(1+log(x))^2-tan(1+log(x)))/x^2,x, algorithm="giac")

[Out]

1/4*(13*tan(1)^4*tan(log(x))^9/((tan(log(x))^2 - 1)*x) + 42*tan(1)^4*tan(log(x))^10/((tan(log(x))^2 - 1)^2*x)
+ 84*tan(1)^4*tan(log(x))^11/((tan(log(x))^2 - 1)^3*x) - 88*tan(1)^4*tan(log(x))^12/((tan(log(x))^2 - 1)^4*x)
- 17*tan(1)^4*tan(log(x))^7/x - 4*tan(1)^3*tan(log(x))^8/x - 62*tan(1)^4*tan(log(x))^8/((tan(log(x))^2 - 1)*x)
 + 22*tan(1)^3*tan(log(x))^9/((tan(log(x))^2 - 1)*x) - 102*tan(1)^4*tan(log(x))^9/((tan(log(x))^2 - 1)^2*x) -
6*tan(1)^3*tan(log(x))^10/((tan(log(x))^2 - 1)^2*x) + 520*tan(1)^4*tan(log(x))^10/((tan(log(x))^2 - 1)^3*x) -
168*tan(1)^3*tan(log(x))^11/((tan(log(x))^2 - 1)^3*x) + 248*tan(1)^4*tan(log(x))^11/((tan(log(x))^2 - 1)^4*x)
- 88*tan(1)^3*tan(log(x))^12/((tan(log(x))^2 - 1)^4*x) + 20*tan(1)^4*tan(log(x))^6/x - 22*tan(1)^3*tan(log(x))
^7/x - 17*tan(1)^4*tan(log(x))^7/((tan(log(x))^2 - 1)*x) - 70*tan(1)^3*tan(log(x))^8/((tan(log(x))^2 - 1)*x) -
 740*tan(1)^4*tan(log(x))^8/((tan(log(x))^2 - 1)^2*x) + 17*tan(1)^2*tan(log(x))^9/((tan(log(x))^2 - 1)*x) + 48
8*tan(1)^3*tan(log(x))^9/((tan(log(x))^2 - 1)^2*x) - 548*tan(1)^4*tan(log(x))^9/((tan(log(x))^2 - 1)^3*x) - 56
*tan(1)^2*tan(log(x))^10/((tan(log(x))^2 - 1)^2*x) + 40*tan(1)^3*tan(log(x))^10/((tan(log(x))^2 - 1)^3*x) + 56
0*tan(1)^4*tan(log(x))^10/((tan(log(x))^2 - 1)^4*x) + 36*tan(1)^2*tan(log(x))^11/((tan(log(x))^2 - 1)^3*x) - 2
56*tan(1)^3*tan(log(x))^11/((tan(log(x))^2 - 1)^4*x) + 32*tan(1)^2*tan(log(x))^12/((tan(log(x))^2 - 1)^4*x) -
22*tan(1)^4*tan(log(x))^5/x + 36*tan(1)^3*tan(log(x))^6/x + 326*tan(1)^4*tan(log(x))^6/((tan(log(x))^2 - 1)*x)
 - 17*tan(1)^2*tan(log(x))^7/x - 388*tan(1)^3*tan(log(x))^7/((tan(log(x))^2 - 1)*x) + 150*tan(1)^4*tan(log(x))
^7/((tan(log(x))^2 - 1)^2*x) - 4*tan(1)*tan(log(x))^8/x + 64*tan(1)^2*tan(log(x))^8/((tan(log(x))^2 - 1)*x) -
276*tan(1)^3*tan(log(x))^8/((tan(log(x))^2 - 1)^2*x) - 1256*tan(1)^4*tan(log(x))^8/((tan(log(x))^2 - 1)^3*x) +
 6*tan(1)*tan(log(x))^9/((tan(log(x))^2 - 1)*x) + 24*tan(1)^2*tan(log(x))^9/((tan(log(x))^2 - 1)^2*x) + 752*ta
n(1)^3*tan(log(x))^9/((tan(log(x))^2 - 1)^3*x) - 328*tan(1)^4*tan(log(x))^9/((tan(log(x))^2 - 1)^4*x) - 30*tan
(1)*tan(log(x))^10/((tan(log(x))^2 - 1)^2*x) - 528*tan(1)^3*tan(log(x))^10/((tan(log(x))^2 - 1)^4*x) + 24*tan(
1)*tan(log(x))^11/((tan(log(x))^2 - 1)^3*x) + 240*tan(1)^2*tan(log(x))^11/((tan(log(x))^2 - 1)^4*x) - 56*tan(1
)*tan(log(x))^12/((tan(log(x))^2 - 1)^4*x) - 40*tan(1)^4*tan(log(x))^4/x + 46*tan(1)^3*tan(log(x))^5/x - 137*t
an(1)^4*tan(log(x))^5/((tan(log(x))^2 - 1)*x) - 8*tan(1)^2*tan(log(x))^6/x + 206*tan(1)^3*tan(log(x))^6/((tan(
log(x))^2 - 1)*x) + 696*tan(1)^4*tan(log(x))^6/((tan(log(x))^2 - 1)^2*x) - 6*tan(1)*tan(log(x))^7/x - 44*tan(1
)^2*tan(log(x))^7/((tan(log(x))^2 - 1)*x) - 456*tan(1)^3*tan(log(x))^7/((tan(log(x))^2 - 1)^2*x) - 68*tan(1)^4
*tan(log(x))^7/((tan(log(x))^2 - 1)^3*x) - 38*tan(1)*tan(log(x))^8/((tan(log(x))^2 - 1)*x) - 416*tan(1)^2*tan(
log(x))^8/((tan(log(x))^2 - 1)^2*x) + 504*tan(1)^3*tan(log(x))^8/((tan(log(x))^2 - 1)^3*x) - 416*tan(1)^4*tan(
log(x))^8/((tan(log(x))^2 - 1)^4*x) + 104*tan(1)*tan(log(x))^9/((tan(log(x))^2 - 1)^2*x) - 432*tan(1)^2*tan(lo
g(x))^9/((tan(log(x))^2 - 1)^3*x) - 2*tan(log(x))^10/((tan(log(x))^2 - 1)^2*x) - 88*tan(1)*tan(log(x))^10/((ta
n(log(x))^2 - 1)^3*x) + 512*tan(1)^2*tan(log(x))^10/((tan(log(x))^2 - 1)^4*x) - 8*tan(log(x))^12/((tan(log(x))
^2 - 1)^4*x) + 7*tan(1)^4*tan(log(x))^3/x + 8*tan(1)^3*tan(log(x))^4/x - 122*tan(1)^4*tan(log(x))^4/((tan(log(
x))^2 - 1)*x) - 33*tan(1)^2*tan(log(x))^5/x - 208*tan(1)^3*tan(log(x))^5/((tan(log(x))^2 - 1)*x) - 162*tan(1)^
4*tan(log(x))^5/((tan(log(x))^2 - 1)^2*x) + 28*tan(1)*tan(log(x))^6/x + 576*tan(1)^2*tan(log(x))^6/((tan(log(x
))^2 - 1)*x) - 120*tan(1)^3*tan(log(x))^6/((tan(log(x))^2 - 1)^2*x) + 280*tan(1)^4*tan(log(x))^6/((tan(log(x))
^2 - 1)^3*x) + 4*tan(log(x))^7/x - 196*tan(1)*tan(log(x))^7/((tan(log(x))^2 - 1)*x) + 408*tan(1)^2*tan(log(x))
^7/((tan(log(x))^2 - 1)^2*x) + 448*tan(1)^3*tan(log(x))^7/((tan(log(x))^2 - 1)^3*x) - 376*tan(1)^4*tan(log(x))
^7/((tan(log(x))^2 - 1)^4*x) - 2*tan(log(x))^8/((tan(log(x))^2 - 1)*x) - 180*tan(1)*tan(log(x))^8/((tan(log(x)
)^2 - 1)^2*x) - 2048*tan(1)^2*tan(log(x))^8/((tan(log(x))^2 - 1)^3*x) + 32*tan(1)^3*tan(log(x))^8/((tan(log(x)
)^2 - 1)^4*x) + 30*tan(log(x))^9/((tan(log(x))^2 - 1)^2*x) + 496*tan(1)*tan(log(x))^9/((tan(log(x))^2 - 1)^3*x
) - 16*tan(1)^2*tan(log(x))^9/((tan(log(x))^2 - 1)^4*x) - 8*tan(log(x))^10/((tan(log(x))^2 - 1)^3*x) - 528*tan
(1)*tan(log(x))^10/((tan(log(x))^2 - 1)^4*x) + 56*tan(log(x))^11/((tan(log(x))^2 - 1)^4*x) + 4*tan(1)^4*tan(lo
g(x))^2/x + 62*tan(1)^3*tan(log(x))^3/x + 21*tan(1)^4*tan(log(x))^3/((tan(log(x))^2 - 1)*x) - 144*tan(1)^2*tan
(log(x))^4/x + 238*tan(1)^3*tan(log(x))^4/((tan(log(x))^2 - 1)*x) - 60*tan(1)^4*tan(log(x))^4/((tan(log(x))^2
- 1)^2*x) + 62*tan(1)*tan(log(x))^5/x - 378*tan(1)^2*tan(log(x))^5/((tan(log(x))^2 - 1)*x) - 840*tan(1)^3*tan(
log(x))^5/((tan(log(x))^2 - 1)^2*x) + 52*tan(1)^4*tan(log(x))^5/((tan(log(x))^2 - 1)^3*x) + 4*tan(log(x))^6/x
+ 238*tan(1)*tan(log(x))^6/((tan(log(x))^2 - 1)...

________________________________________________________________________________________

Mupad [F]
time = 0.00, size = -1, normalized size = -0.11 \begin {gather*} \int -\frac {\mathrm {tan}\left (\ln \left (x\right )+1\right )-\frac {1}{{\cos \left (\ln \left (x\right )+1\right )}^2}}{x^2} \,d x \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(-(tan(log(x) + 1) - 1/cos(log(x) + 1)^2)/x^2,x)

[Out]

int(-(tan(log(x) + 1) - 1/cos(log(x) + 1)^2)/x^2, x)

________________________________________________________________________________________

Chatgpt [F] Failed to verify
time = 1.00, size = 12, normalized size = 1.33 \begin {gather*} -\frac {1}{x}+\frac {1}{1+\ln \left (x \right )} \end {gather*}

Warning: Unable to verify antiderivative.

[In]

int((sec(1+ln(x))^2-tan(1+ln(x)))/x^2,x)

[Out]

-1/x+1/(1+ln(x))

________________________________________________________________________________________