\(\int \sec ^2(x) (1+\sin (x)) \, dx\) [913]

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

Optimal result

Integrand size = 9, antiderivative size = 5 \[ \int \sec ^2(x) (1+\sin (x)) \, dx=\sec (x)+\tan (x) \]

[Out]

sec(x)+tan(x)

Rubi [A] (verified)

Time = 0.03 (sec) , antiderivative size = 5, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.333, Rules used = {2748, 3852, 8} \[ \int \sec ^2(x) (1+\sin (x)) \, dx=\tan (x)+\sec (x) \]

[In]

Int[Sec[x]^2*(1 + Sin[x]),x]

[Out]

Sec[x] + Tan[x]

Rule 8

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

Rule 2748

Int[(cos[(e_.) + (f_.)*(x_)]*(g_.))^(p_)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(-b)*((g*Co
s[e + f*x])^(p + 1)/(f*g*(p + 1))), x] + Dist[a, Int[(g*Cos[e + f*x])^p, x], x] /; FreeQ[{a, b, e, f, g, p}, x
] && (IntegerQ[2*p] || NeQ[a^2 - b^2, 0])

Rule 3852

Int[csc[(c_.) + (d_.)*(x_)]^(n_), x_Symbol] :> Dist[-d^(-1), Subst[Int[ExpandIntegrand[(1 + x^2)^(n/2 - 1), x]
, x], x, Cot[c + d*x]], x] /; FreeQ[{c, d}, x] && IGtQ[n/2, 0]

Rubi steps \begin{align*} \text {integral}& = \sec (x)+\int \sec ^2(x) \, dx \\ & = \sec (x)-\text {Subst}(\int 1 \, dx,x,-\tan (x)) \\ & = \sec (x)+\tan (x) \\ \end{align*}

Mathematica [A] (verified)

Time = 0.00 (sec) , antiderivative size = 5, normalized size of antiderivative = 1.00 \[ \int \sec ^2(x) (1+\sin (x)) \, dx=\sec (x)+\tan (x) \]

[In]

Integrate[Sec[x]^2*(1 + Sin[x]),x]

[Out]

Sec[x] + Tan[x]

Maple [A] (verified)

Time = 1.30 (sec) , antiderivative size = 8, normalized size of antiderivative = 1.60

method result size
default \(\tan \left (x \right )+\frac {1}{\cos \left (x \right )}\) \(8\)
parallelrisch \(-\frac {2}{\tan \left (\frac {x}{2}\right )-1}\) \(11\)
risch \(\frac {2}{{\mathrm e}^{i x}-i}\) \(13\)
norman \(\frac {-2 \tan \left (\frac {x}{2}\right )^{2}-2 \tan \left (\frac {x}{2}\right )^{3}-2 \tan \left (\frac {x}{2}\right )-2}{\left (1+\tan \left (\frac {x}{2}\right )^{2}\right ) \left (\tan \left (\frac {x}{2}\right )^{2}-1\right )}\) \(46\)

[In]

int(sec(x)^2*(1+sin(x)),x,method=_RETURNVERBOSE)

[Out]

tan(x)+1/cos(x)

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 17 vs. \(2 (5) = 10\).

Time = 0.24 (sec) , antiderivative size = 17, normalized size of antiderivative = 3.40 \[ \int \sec ^2(x) (1+\sin (x)) \, dx=\frac {\cos \left (x\right ) + \sin \left (x\right ) + 1}{\cos \left (x\right ) - \sin \left (x\right ) + 1} \]

[In]

integrate(sec(x)^2*(1+sin(x)),x, algorithm="fricas")

[Out]

(cos(x) + sin(x) + 1)/(cos(x) - sin(x) + 1)

Sympy [A] (verification not implemented)

Time = 1.14 (sec) , antiderivative size = 7, normalized size of antiderivative = 1.40 \[ \int \sec ^2(x) (1+\sin (x)) \, dx=\tan {\left (x \right )} + \frac {1}{\cos {\left (x \right )}} \]

[In]

integrate(sec(x)**2*(1+sin(x)),x)

[Out]

tan(x) + 1/cos(x)

Maxima [A] (verification not implemented)

none

Time = 0.20 (sec) , antiderivative size = 7, normalized size of antiderivative = 1.40 \[ \int \sec ^2(x) (1+\sin (x)) \, dx=\frac {1}{\cos \left (x\right )} + \tan \left (x\right ) \]

[In]

integrate(sec(x)^2*(1+sin(x)),x, algorithm="maxima")

[Out]

1/cos(x) + tan(x)

Giac [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 10, normalized size of antiderivative = 2.00 \[ \int \sec ^2(x) (1+\sin (x)) \, dx=-\frac {2}{\tan \left (\frac {1}{2} \, x\right ) - 1} \]

[In]

integrate(sec(x)^2*(1+sin(x)),x, algorithm="giac")

[Out]

-2/(tan(1/2*x) - 1)

Mupad [B] (verification not implemented)

Time = 26.48 (sec) , antiderivative size = 10, normalized size of antiderivative = 2.00 \[ \int \sec ^2(x) (1+\sin (x)) \, dx=-\frac {2}{\mathrm {tan}\left (\frac {x}{2}\right )-1} \]

[In]

int((sin(x) + 1)/cos(x)^2,x)

[Out]

-2/(tan(x/2) - 1)