3.1.79 \(\int a^x \cos (x) \, dx\) [79]

Optimal. Leaf size=31 \[ \frac {a^x \cos (x) \log (a)}{1+\log ^2(a)}+\frac {a^x \sin (x)}{1+\log ^2(a)} \]

[Out]

a^x*cos(x)*ln(a)/(1+ln(a)^2)+a^x*sin(x)/(1+ln(a)^2)

________________________________________________________________________________________

Rubi [A]
time = 0.01, antiderivative size = 31, normalized size of antiderivative = 1.00, number of steps used = 1, number of rules used = 1, integrand size = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.167, Rules used = {4518} \begin {gather*} \frac {a^x \sin (x)}{\log ^2(a)+1}+\frac {a^x \log (a) \cos (x)}{\log ^2(a)+1} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[a^x*Cos[x],x]

[Out]

(a^x*Cos[x]*Log[a])/(1 + Log[a]^2) + (a^x*Sin[x])/(1 + Log[a]^2)

Rule 4518

Int[Cos[(d_.) + (e_.)*(x_)]*(F_)^((c_.)*((a_.) + (b_.)*(x_))), x_Symbol] :> Simp[b*c*Log[F]*F^(c*(a + b*x))*(C
os[d + e*x]/(e^2 + b^2*c^2*Log[F]^2)), x] + Simp[e*F^(c*(a + b*x))*(Sin[d + e*x]/(e^2 + b^2*c^2*Log[F]^2)), x]
 /; FreeQ[{F, a, b, c, d, e}, x] && NeQ[e^2 + b^2*c^2*Log[F]^2, 0]

Rubi steps

\begin {align*} \int a^x \cos (x) \, dx &=\frac {a^x \cos (x) \log (a)}{1+\log ^2(a)}+\frac {a^x \sin (x)}{1+\log ^2(a)}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.02, size = 20, normalized size = 0.65 \begin {gather*} \frac {a^x (\cos (x) \log (a)+\sin (x))}{1+\log ^2(a)} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[a^x*Cos[x],x]

[Out]

(a^x*(Cos[x]*Log[a] + Sin[x]))/(1 + Log[a]^2)

________________________________________________________________________________________

Maple [A]
time = 0.03, size = 32, normalized size = 1.03

method result size
risch \(\frac {a^{x} \cos \left (x \right ) \ln \left (a \right )}{1+\ln \left (a \right )^{2}}+\frac {a^{x} \sin \left (x \right )}{1+\ln \left (a \right )^{2}}\) \(32\)
norman \(\frac {\frac {\ln \left (a \right ) {\mathrm e}^{x \ln \left (a \right )}}{1+\ln \left (a \right )^{2}}+\frac {2 \,{\mathrm e}^{x \ln \left (a \right )} \tan \left (\frac {x}{2}\right )}{1+\ln \left (a \right )^{2}}-\frac {\ln \left (a \right ) {\mathrm e}^{x \ln \left (a \right )} \left (\tan ^{2}\left (\frac {x}{2}\right )\right )}{1+\ln \left (a \right )^{2}}}{1+\tan ^{2}\left (\frac {x}{2}\right )}\) \(71\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(a^x*cos(x),x,method=_RETURNVERBOSE)

[Out]

a^x*cos(x)*ln(a)/(1+ln(a)^2)+a^x*sin(x)/(1+ln(a)^2)

________________________________________________________________________________________

Maxima [A]
time = 0.96, size = 24, normalized size = 0.77 \begin {gather*} \frac {a^{x} \cos \left (x\right ) \log \left (a\right ) + a^{x} \sin \left (x\right )}{\log \left (a\right )^{2} + 1} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(a^x*cos(x),x, algorithm="maxima")

[Out]

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

________________________________________________________________________________________

Fricas [A]
time = 1.00, size = 20, normalized size = 0.65 \begin {gather*} \frac {{\left (\cos \left (x\right ) \log \left (a\right ) + \sin \left (x\right )\right )} a^{x}}{\log \left (a\right )^{2} + 1} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(a^x*cos(x),x, algorithm="fricas")

[Out]

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

________________________________________________________________________________________

Sympy [C] Result contains complex when optimal does not.
time = 0.27, size = 104, normalized size = 3.35 \begin {gather*} \begin {cases} \frac {i x e^{- i x} \sin {\left (x \right )}}{2} + \frac {x e^{- i x} \cos {\left (x \right )}}{2} + \frac {e^{- i x} \sin {\left (x \right )}}{2} & \text {for}\: a = e^{- i} \\- \frac {i x e^{i x} \sin {\left (x \right )}}{2} + \frac {x e^{i x} \cos {\left (x \right )}}{2} + \frac {e^{i x} \sin {\left (x \right )}}{2} & \text {for}\: a = e^{i} \\\frac {a^{x} \log {\left (a \right )} \cos {\left (x \right )}}{\log {\left (a \right )}^{2} + 1} + \frac {a^{x} \sin {\left (x \right )}}{\log {\left (a \right )}^{2} + 1} & \text {otherwise} \end {cases} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(a**x*cos(x),x)

[Out]

Piecewise((I*x*exp(-I*x)*sin(x)/2 + x*exp(-I*x)*cos(x)/2 + exp(-I*x)*sin(x)/2, Eq(a, exp(-I))), (-I*x*exp(I*x)
*sin(x)/2 + x*exp(I*x)*cos(x)/2 + exp(I*x)*sin(x)/2, Eq(a, exp(I))), (a**x*log(a)*cos(x)/(log(a)**2 + 1) + a**
x*sin(x)/(log(a)**2 + 1), True))

________________________________________________________________________________________

Giac [C] Result contains complex when optimal does not.
time = 0.75, size = 329, normalized size = 10.61 \begin {gather*} {\left | a \right |}^{x} {\left (\frac {2 \, \cos \left (\frac {1}{2} \, \pi x \mathrm {sgn}\left (a\right ) - \frac {1}{2} \, \pi x + x\right ) \log \left ({\left | a \right |}\right )}{{\left (\pi - \pi \mathrm {sgn}\left (a\right ) - 2\right )}^{2} + 4 \, \log \left ({\left | a \right |}\right )^{2}} - \frac {{\left (\pi - \pi \mathrm {sgn}\left (a\right ) - 2\right )} \sin \left (\frac {1}{2} \, \pi x \mathrm {sgn}\left (a\right ) - \frac {1}{2} \, \pi x + x\right )}{{\left (\pi - \pi \mathrm {sgn}\left (a\right ) - 2\right )}^{2} + 4 \, \log \left ({\left | a \right |}\right )^{2}}\right )} + {\left | a \right |}^{x} {\left (\frac {2 \, \cos \left (\frac {1}{2} \, \pi x \mathrm {sgn}\left (a\right ) - \frac {1}{2} \, \pi x - x\right ) \log \left ({\left | a \right |}\right )}{{\left (\pi - \pi \mathrm {sgn}\left (a\right ) + 2\right )}^{2} + 4 \, \log \left ({\left | a \right |}\right )^{2}} - \frac {{\left (\pi - \pi \mathrm {sgn}\left (a\right ) + 2\right )} \sin \left (\frac {1}{2} \, \pi x \mathrm {sgn}\left (a\right ) - \frac {1}{2} \, \pi x - x\right )}{{\left (\pi - \pi \mathrm {sgn}\left (a\right ) + 2\right )}^{2} + 4 \, \log \left ({\left | a \right |}\right )^{2}}\right )} + i \, {\left | a \right |}^{x} {\left (\frac {i \, e^{\left (\frac {1}{2} i \, \pi x \mathrm {sgn}\left (a\right ) - \frac {1}{2} i \, \pi x + i \, x\right )}}{-2 i \, \pi + 2 i \, \pi \mathrm {sgn}\left (a\right ) + 4 \, \log \left ({\left | a \right |}\right ) + 4 i} - \frac {i \, e^{\left (-\frac {1}{2} i \, \pi x \mathrm {sgn}\left (a\right ) + \frac {1}{2} i \, \pi x - i \, x\right )}}{2 i \, \pi - 2 i \, \pi \mathrm {sgn}\left (a\right ) + 4 \, \log \left ({\left | a \right |}\right ) - 4 i}\right )} + i \, {\left | a \right |}^{x} {\left (\frac {i \, e^{\left (\frac {1}{2} i \, \pi x \mathrm {sgn}\left (a\right ) - \frac {1}{2} i \, \pi x - i \, x\right )}}{-2 i \, \pi + 2 i \, \pi \mathrm {sgn}\left (a\right ) + 4 \, \log \left ({\left | a \right |}\right ) - 4 i} - \frac {i \, e^{\left (-\frac {1}{2} i \, \pi x \mathrm {sgn}\left (a\right ) + \frac {1}{2} i \, \pi x + i \, x\right )}}{2 i \, \pi - 2 i \, \pi \mathrm {sgn}\left (a\right ) + 4 \, \log \left ({\left | a \right |}\right ) + 4 i}\right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(a^x*cos(x),x, algorithm="giac")

[Out]

abs(a)^x*(2*cos(1/2*pi*x*sgn(a) - 1/2*pi*x + x)*log(abs(a))/((pi - pi*sgn(a) - 2)^2 + 4*log(abs(a))^2) - (pi -
 pi*sgn(a) - 2)*sin(1/2*pi*x*sgn(a) - 1/2*pi*x + x)/((pi - pi*sgn(a) - 2)^2 + 4*log(abs(a))^2)) + abs(a)^x*(2*
cos(1/2*pi*x*sgn(a) - 1/2*pi*x - x)*log(abs(a))/((pi - pi*sgn(a) + 2)^2 + 4*log(abs(a))^2) - (pi - pi*sgn(a) +
 2)*sin(1/2*pi*x*sgn(a) - 1/2*pi*x - x)/((pi - pi*sgn(a) + 2)^2 + 4*log(abs(a))^2)) + I*abs(a)^x*(I*e^(1/2*I*p
i*x*sgn(a) - 1/2*I*pi*x + I*x)/(-2*I*pi + 2*I*pi*sgn(a) + 4*log(abs(a)) + 4*I) - I*e^(-1/2*I*pi*x*sgn(a) + 1/2
*I*pi*x - I*x)/(2*I*pi - 2*I*pi*sgn(a) + 4*log(abs(a)) - 4*I)) + I*abs(a)^x*(I*e^(1/2*I*pi*x*sgn(a) - 1/2*I*pi
*x - I*x)/(-2*I*pi + 2*I*pi*sgn(a) + 4*log(abs(a)) - 4*I) - I*e^(-1/2*I*pi*x*sgn(a) + 1/2*I*pi*x + I*x)/(2*I*p
i - 2*I*pi*sgn(a) + 4*log(abs(a)) + 4*I))

________________________________________________________________________________________

Mupad [B]
time = 0.03, size = 20, normalized size = 0.65 \begin {gather*} \frac {a^x\,\left (\sin \left (x\right )+\ln \left (a\right )\,\cos \left (x\right )\right )}{{\ln \left (a\right )}^2+1} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(a^x*cos(x),x)

[Out]

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

________________________________________________________________________________________