3.543 \(\int \frac{A+C \sin (x)}{a+b \cos (x)+i b \sin (x)} \, dx\)

Optimal. Leaf size=85 \[ \frac{\left (a^2 (-C)+2 i a A b+b^2 C\right ) \log (a+i b \sin (x)+b \cos (x))}{2 a^2 b}+\frac{x (2 a A-i b C)}{2 a^2}+\frac{i C \sin (x)}{2 a}-\frac{C \cos (x)}{2 a} \]

[Out]

((2*a*A - I*b*C)*x)/(2*a^2) - (C*Cos[x])/(2*a) + (((2*I)*a*A*b - a^2*C + b^2*C)*Log[a + b*Cos[x] + I*b*Sin[x]]
)/(2*a^2*b) + ((I/2)*C*Sin[x])/a

________________________________________________________________________________________

Rubi [A]  time = 0.0458097, antiderivative size = 85, normalized size of antiderivative = 1., number of steps used = 1, number of rules used = 1, integrand size = 22, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.045, Rules used = {3131} \[ \frac{\left (a^2 (-C)+2 i a A b+b^2 C\right ) \log (a+i b \sin (x)+b \cos (x))}{2 a^2 b}+\frac{x (2 a A-i b C)}{2 a^2}+\frac{i C \sin (x)}{2 a}-\frac{C \cos (x)}{2 a} \]

Antiderivative was successfully verified.

[In]

Int[(A + C*Sin[x])/(a + b*Cos[x] + I*b*Sin[x]),x]

[Out]

((2*a*A - I*b*C)*x)/(2*a^2) - (C*Cos[x])/(2*a) + (((2*I)*a*A*b - a^2*C + b^2*C)*Log[a + b*Cos[x] + I*b*Sin[x]]
)/(2*a^2*b) + ((I/2)*C*Sin[x])/a

Rule 3131

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

Rubi steps

\begin{align*} \int \frac{A+C \sin (x)}{a+b \cos (x)+i b \sin (x)} \, dx &=\frac{(2 a A-i b C) x}{2 a^2}-\frac{C \cos (x)}{2 a}+\frac{\left (2 i a A b-a^2 C+b^2 C\right ) \log (a+b \cos (x)+i b \sin (x))}{2 a^2 b}+\frac{i C \sin (x)}{2 a}\\ \end{align*}

Mathematica [A]  time = 0.260401, size = 152, normalized size = 1.79 \[ \frac{\left (-2 i a^2 C-4 a A b+2 i b^2 C\right ) \tan ^{-1}\left (\frac{(a+b) \cot \left (\frac{x}{2}\right )}{a-b}\right )+2 i a A b \log \left (a^2+2 a b \cos (x)+b^2\right )-a^2 C \log \left (a^2+2 a b \cos (x)+b^2\right )+b^2 C \log \left (a^2+2 a b \cos (x)+b^2\right )-i a^2 C x+2 a A b x+2 i a b C \sin (x)-2 a b C \cos (x)-i b^2 C x}{4 a^2 b} \]

Antiderivative was successfully verified.

[In]

Integrate[(A + C*Sin[x])/(a + b*Cos[x] + I*b*Sin[x]),x]

[Out]

(2*a*A*b*x - I*a^2*C*x - I*b^2*C*x + (-4*a*A*b - (2*I)*a^2*C + (2*I)*b^2*C)*ArcTan[((a + b)*Cot[x/2])/(a - b)]
 - 2*a*b*C*Cos[x] + (2*I)*a*A*b*Log[a^2 + b^2 + 2*a*b*Cos[x]] - a^2*C*Log[a^2 + b^2 + 2*a*b*Cos[x]] + b^2*C*Lo
g[a^2 + b^2 + 2*a*b*Cos[x]] + (2*I)*a*b*C*Sin[x])/(4*a^2*b)

________________________________________________________________________________________

Maple [B]  time = 0.082, size = 151, normalized size = 1.8 \begin{align*} -{\frac{C}{2\,b}\ln \left ( ia+ib+a\tan \left ({\frac{x}{2}} \right ) -b\tan \left ({\frac{x}{2}} \right ) \right ) }+{\frac{bC}{2\,{a}^{2}}\ln \left ( ia+ib+a\tan \left ({\frac{x}{2}} \right ) -b\tan \left ({\frac{x}{2}} \right ) \right ) }+{\frac{iA}{a}\ln \left ( ia+ib+a\tan \left ({\frac{x}{2}} \right ) -b\tan \left ({\frac{x}{2}} \right ) \right ) }+{\frac{C}{2\,b}\ln \left ( \tan \left ({\frac{x}{2}} \right ) +i \right ) }+{\frac{iC}{a} \left ( \tan \left ({\frac{x}{2}} \right ) -i \right ) ^{-1}}-{\frac{iA}{a}\ln \left ( \tan \left ({\frac{x}{2}} \right ) -i \right ) }-{\frac{bC}{2\,{a}^{2}}\ln \left ( \tan \left ({\frac{x}{2}} \right ) -i \right ) } \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((A+C*sin(x))/(a+b*cos(x)+I*b*sin(x)),x)

[Out]

-1/2/b*ln(I*a+I*b+a*tan(1/2*x)-b*tan(1/2*x))*C+1/2/a^2*b*ln(I*a+I*b+a*tan(1/2*x)-b*tan(1/2*x))*C+I/a*ln(I*a+I*
b+a*tan(1/2*x)-b*tan(1/2*x))*A+1/2*C/b*ln(tan(1/2*x)+I)+I*C/a/(tan(1/2*x)-I)-I/a*ln(tan(1/2*x)-I)*A-1/2/a^2*ln
(tan(1/2*x)-I)*b*C

________________________________________________________________________________________

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

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((A+C*sin(x))/(a+b*cos(x)+I*b*sin(x)),x, algorithm="maxima")

[Out]

Exception raised: RuntimeError

________________________________________________________________________________________

Fricas [A]  time = 1.92754, size = 167, normalized size = 1.96 \begin{align*} -\frac{{\left (C a b -{\left (2 \, A a b - i \, C b^{2}\right )} x e^{\left (i \, x\right )} +{\left (C a^{2} - 2 i \, A a b - C b^{2}\right )} e^{\left (i \, x\right )} \log \left (\frac{b e^{\left (i \, x\right )} + a}{b}\right )\right )} e^{\left (-i \, x\right )}}{2 \, a^{2} b} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((A+C*sin(x))/(a+b*cos(x)+I*b*sin(x)),x, algorithm="fricas")

[Out]

-1/2*(C*a*b - (2*A*a*b - I*C*b^2)*x*e^(I*x) + (C*a^2 - 2*I*A*a*b - C*b^2)*e^(I*x)*log((b*e^(I*x) + a)/b))*e^(-
I*x)/(a^2*b)

________________________________________________________________________________________

Sympy [A]  time = 1.75927, size = 54, normalized size = 0.64 \begin{align*} \left (\frac{i A}{a} - \frac{C}{2 b} + \frac{C b}{2 a^{2}}\right ) \log{\left (\frac{a}{b} + e^{i x} \right )} + \frac{2 A a x - C a e^{- i x} - i C b x}{2 a^{2}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((A+C*sin(x))/(a+b*cos(x)+I*b*sin(x)),x)

[Out]

(I*A/a - C/(2*b) + C*b/(2*a**2))*log(a/b + exp(I*x)) + (2*A*a*x - C*a*exp(-I*x) - I*C*b*x)/(2*a**2)

________________________________________________________________________________________

Giac [B]  time = 1.17244, size = 212, normalized size = 2.49 \begin{align*} \frac{2 \,{\left (i \, C a^{3} + 2 \, A a^{2} b - i \, C a^{2} b - 2 \, A a b^{2} - i \, C a b^{2} + i \, C b^{3}\right )} \log \left (-a \tan \left (\frac{1}{2} \, x\right ) + b \tan \left (\frac{1}{2} \, x\right ) - i \, a - i \, b\right )}{-4 i \, a^{3} b + 4 i \, a^{2} b^{2}} + \frac{C \log \left (\tan \left (\frac{1}{2} \, x\right ) + i\right )}{2 \, b} - \frac{{\left (2 i \, A a + C b\right )} \log \left (\tan \left (\frac{1}{2} \, x\right ) - i\right )}{2 \, a^{2}} - \frac{-2 i \, A a \tan \left (\frac{1}{2} \, x\right ) - C b \tan \left (\frac{1}{2} \, x\right ) - 2 \, A a - 2 i \, C a + i \, C b}{2 \, a^{2}{\left (\tan \left (\frac{1}{2} \, x\right ) - i\right )}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((A+C*sin(x))/(a+b*cos(x)+I*b*sin(x)),x, algorithm="giac")

[Out]

2*(I*C*a^3 + 2*A*a^2*b - I*C*a^2*b - 2*A*a*b^2 - I*C*a*b^2 + I*C*b^3)*log(-a*tan(1/2*x) + b*tan(1/2*x) - I*a -
 I*b)/(-4*I*a^3*b + 4*I*a^2*b^2) + 1/2*C*log(tan(1/2*x) + I)/b - 1/2*(2*I*A*a + C*b)*log(tan(1/2*x) - I)/a^2 -
 1/2*(-2*I*A*a*tan(1/2*x) - C*b*tan(1/2*x) - 2*A*a - 2*I*C*a + I*C*b)/(a^2*(tan(1/2*x) - I))