Integrand size = 19, antiderivative size = 115 \[ \int \frac {A+B \cos (x)}{a+b \cos (x)+c \sin (x)} \, dx=\frac {b B x}{b^2+c^2}-\frac {2 \left (a b B-A \left (b^2+c^2\right )\right ) \arctan \left (\frac {c+(a-b) \tan \left (\frac {x}{2}\right )}{\sqrt {a^2-b^2-c^2}}\right )}{\sqrt {a^2-b^2-c^2} \left (b^2+c^2\right )}+\frac {B c \log (a+b \cos (x)+c \sin (x))}{b^2+c^2} \] Output:
b*B*x/(b^2+c^2)-2*(a*b*B-A*(b^2+c^2))*arctan((c+(a-b)*tan(1/2*x))/(a^2-b^2 -c^2)^(1/2))/(a^2-b^2-c^2)^(1/2)/(b^2+c^2)+B*c*ln(a+b*cos(x)+c*sin(x))/(b^ 2+c^2)
Time = 0.25 (sec) , antiderivative size = 95, normalized size of antiderivative = 0.83 \[ \int \frac {A+B \cos (x)}{a+b \cos (x)+c \sin (x)} \, dx=\frac {-\frac {2 \left (-a b B+A \left (b^2+c^2\right )\right ) \text {arctanh}\left (\frac {c+(a-b) \tan \left (\frac {x}{2}\right )}{\sqrt {-a^2+b^2+c^2}}\right )}{\sqrt {-a^2+b^2+c^2}}+B (b x+c \log (a+b \cos (x)+c \sin (x)))}{b^2+c^2} \] Input:
Integrate[(A + B*Cos[x])/(a + b*Cos[x] + c*Sin[x]),x]
Output:
((-2*(-(a*b*B) + A*(b^2 + c^2))*ArcTanh[(c + (a - b)*Tan[x/2])/Sqrt[-a^2 + b^2 + c^2]])/Sqrt[-a^2 + b^2 + c^2] + B*(b*x + c*Log[a + b*Cos[x] + c*Sin [x]]))/(b^2 + c^2)
Time = 0.39 (sec) , antiderivative size = 113, normalized size of antiderivative = 0.98, number of steps used = 7, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.316, Rules used = {3042, 3617, 3042, 3603, 1083, 217}
Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.
\(\displaystyle \int \frac {A+B \cos (x)}{a+b \cos (x)+c \sin (x)} \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \frac {A+B \cos (x)}{a+b \cos (x)+c \sin (x)}dx\) |
\(\Big \downarrow \) 3617 |
\(\displaystyle \left (A-\frac {a b B}{b^2+c^2}\right ) \int \frac {1}{a+b \cos (x)+c \sin (x)}dx+\frac {B c \log (a+b \cos (x)+c \sin (x))}{b^2+c^2}+\frac {b B x}{b^2+c^2}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \left (A-\frac {a b B}{b^2+c^2}\right ) \int \frac {1}{a+b \cos (x)+c \sin (x)}dx+\frac {B c \log (a+b \cos (x)+c \sin (x))}{b^2+c^2}+\frac {b B x}{b^2+c^2}\) |
\(\Big \downarrow \) 3603 |
\(\displaystyle 2 \left (A-\frac {a b B}{b^2+c^2}\right ) \int \frac {1}{(a-b) \tan ^2\left (\frac {x}{2}\right )+2 c \tan \left (\frac {x}{2}\right )+a+b}d\tan \left (\frac {x}{2}\right )+\frac {B c \log (a+b \cos (x)+c \sin (x))}{b^2+c^2}+\frac {b B x}{b^2+c^2}\) |
\(\Big \downarrow \) 1083 |
\(\displaystyle -4 \left (A-\frac {a b B}{b^2+c^2}\right ) \int \frac {1}{-\left (2 c+2 (a-b) \tan \left (\frac {x}{2}\right )\right )^2-4 \left (a^2-b^2-c^2\right )}d\left (2 c+2 (a-b) \tan \left (\frac {x}{2}\right )\right )+\frac {B c \log (a+b \cos (x)+c \sin (x))}{b^2+c^2}+\frac {b B x}{b^2+c^2}\) |
\(\Big \downarrow \) 217 |
\(\displaystyle \frac {2 \left (A-\frac {a b B}{b^2+c^2}\right ) \arctan \left (\frac {2 (a-b) \tan \left (\frac {x}{2}\right )+2 c}{2 \sqrt {a^2-b^2-c^2}}\right )}{\sqrt {a^2-b^2-c^2}}+\frac {B c \log (a+b \cos (x)+c \sin (x))}{b^2+c^2}+\frac {b B x}{b^2+c^2}\) |
Input:
Int[(A + B*Cos[x])/(a + b*Cos[x] + c*Sin[x]),x]
Output:
(b*B*x)/(b^2 + c^2) + (2*(A - (a*b*B)/(b^2 + c^2))*ArcTan[(2*c + 2*(a - b) *Tan[x/2])/(2*Sqrt[a^2 - b^2 - c^2])])/Sqrt[a^2 - b^2 - c^2] + (B*c*Log[a + b*Cos[x] + c*Sin[x]])/(b^2 + c^2)
Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(-(Rt[-a, 2]*Rt[-b, 2])^( -1))*ArcTan[Rt[-b, 2]*(x/Rt[-a, 2])], x] /; FreeQ[{a, b}, x] && PosQ[a/b] & & (LtQ[a, 0] || LtQ[b, 0])
Int[((a_) + (b_.)*(x_) + (c_.)*(x_)^2)^(-1), x_Symbol] :> Simp[-2 Subst[I nt[1/Simp[b^2 - 4*a*c - x^2, x], x], x, b + 2*c*x], x] /; FreeQ[{a, b, c}, x]
Int[(cos[(d_.) + (e_.)*(x_)]*(b_.) + (a_) + (c_.)*sin[(d_.) + (e_.)*(x_)])^ (-1), x_Symbol] :> Module[{f = FreeFactors[Tan[(d + e*x)/2], x]}, Simp[2*(f /e) Subst[Int[1/(a + b + 2*c*f*x + (a - b)*f^2*x^2), x], x, Tan[(d + e*x) /2]/f], x]] /; FreeQ[{a, b, c, d, e}, x] && NeQ[a^2 - b^2 - c^2, 0]
Int[((A_.) + cos[(d_.) + (e_.)*(x_)]*(B_.))/((a_.) + cos[(d_.) + (e_.)*(x_) ]*(b_.) + (c_.)*sin[(d_.) + (e_.)*(x_)]), x_Symbol] :> Simp[b*B*((d + e*x)/ (e*(b^2 + c^2))), x] + (Simp[c*B*(Log[a + b*Cos[d + e*x] + c*Sin[d + e*x]]/ (e*(b^2 + c^2))), x] + Simp[(A*(b^2 + c^2) - a*b*B)/(b^2 + c^2) Int[1/(a + b*Cos[d + e*x] + c*Sin[d + e*x]), x], x]) /; FreeQ[{a, b, c, d, e, A, B}, x] && NeQ[b^2 + c^2, 0] && NeQ[A*(b^2 + c^2) - a*b*B, 0]
Time = 0.30 (sec) , antiderivative size = 185, normalized size of antiderivative = 1.61
method | result | size |
default | \(\frac {2 B \left (-\frac {c \ln \left (1+\tan \left (\frac {x}{2}\right )^{2}\right )}{2}+b \arctan \left (\tan \left (\frac {x}{2}\right )\right )\right )}{b^{2}+c^{2}}+\frac {\frac {2 \left (a B c -b B c \right ) \ln \left (\tan \left (\frac {x}{2}\right )^{2} a -b \tan \left (\frac {x}{2}\right )^{2}+2 c \tan \left (\frac {x}{2}\right )+a +b \right )}{2 a -2 b}+\frac {2 \left (A \,b^{2}+A \,c^{2}-a b B +B \,c^{2}-\frac {\left (a B c -b B c \right ) c}{a -b}\right ) \arctan \left (\frac {2 \left (a -b \right ) \tan \left (\frac {x}{2}\right )+2 c}{2 \sqrt {a^{2}-b^{2}-c^{2}}}\right )}{\sqrt {a^{2}-b^{2}-c^{2}}}}{b^{2}+c^{2}}\) | \(185\) |
risch | \(\text {Expression too large to display}\) | \(4036\) |
Input:
int((A+B*cos(x))/(a+b*cos(x)+c*sin(x)),x,method=_RETURNVERBOSE)
Output:
2*B/(b^2+c^2)*(-1/2*c*ln(1+tan(1/2*x)^2)+b*arctan(tan(1/2*x)))+2/(b^2+c^2) *(1/2*(B*a*c-B*b*c)/(a-b)*ln(tan(1/2*x)^2*a-b*tan(1/2*x)^2+2*c*tan(1/2*x)+ a+b)+(A*b^2+A*c^2-a*b*B+B*c^2-(B*a*c-B*b*c)*c/(a-b))/(a^2-b^2-c^2)^(1/2)*a rctan(1/2*(2*(a-b)*tan(1/2*x)+2*c)/(a^2-b^2-c^2)^(1/2)))
Leaf count of result is larger than twice the leaf count of optimal. 235 vs. \(2 (109) = 218\).
Time = 0.13 (sec) , antiderivative size = 627, normalized size of antiderivative = 5.45 \[ \int \frac {A+B \cos (x)}{a+b \cos (x)+c \sin (x)} \, dx =\text {Too large to display} \] Input:
integrate((A+B*cos(x))/(a+b*cos(x)+c*sin(x)),x, algorithm="fricas")
Output:
[1/2*((B*a*b - A*b^2 - A*c^2)*sqrt(-a^2 + b^2 + c^2)*log(-(a^2*b^2 - 2*b^4 - c^4 - (a^2 + 3*b^2)*c^2 - (2*a^2*b^2 - b^4 - 2*a^2*c^2 + c^4)*cos(x)^2 - 2*(a*b^3 + a*b*c^2)*cos(x) - 2*(a*b^2*c + a*c^3 - (b*c^3 - (2*a^2*b - b^ 3)*c)*cos(x))*sin(x) + 2*(2*a*b*c*cos(x)^2 - a*b*c + (b^2*c + c^3)*cos(x) - (b^3 + b*c^2 + (a*b^2 - a*c^2)*cos(x))*sin(x))*sqrt(-a^2 + b^2 + c^2))/( 2*a*b*cos(x) + (b^2 - c^2)*cos(x)^2 + a^2 + c^2 + 2*(b*c*cos(x) + a*c)*sin (x))) + 2*(B*a^2*b - B*b^3 - B*b*c^2)*x - (B*c^3 - (B*a^2 - B*b^2)*c)*log( 2*a*b*cos(x) + (b^2 - c^2)*cos(x)^2 + a^2 + c^2 + 2*(b*c*cos(x) + a*c)*sin (x)))/(a^2*b^2 - b^4 - c^4 + (a^2 - 2*b^2)*c^2), -1/2*(2*(B*a*b - A*b^2 - A*c^2)*sqrt(a^2 - b^2 - c^2)*arctan(-(a*b*cos(x) + a*c*sin(x) + b^2 + c^2) *sqrt(a^2 - b^2 - c^2)/((c^3 - (a^2 - b^2)*c)*cos(x) + (a^2*b - b^3 - b*c^ 2)*sin(x))) - 2*(B*a^2*b - B*b^3 - B*b*c^2)*x + (B*c^3 - (B*a^2 - B*b^2)*c )*log(2*a*b*cos(x) + (b^2 - c^2)*cos(x)^2 + a^2 + c^2 + 2*(b*c*cos(x) + a* c)*sin(x)))/(a^2*b^2 - b^4 - c^4 + (a^2 - 2*b^2)*c^2)]
Timed out. \[ \int \frac {A+B \cos (x)}{a+b \cos (x)+c \sin (x)} \, dx=\text {Timed out} \] Input:
integrate((A+B*cos(x))/(a+b*cos(x)+c*sin(x)),x)
Output:
Timed out
Exception generated. \[ \int \frac {A+B \cos (x)}{a+b \cos (x)+c \sin (x)} \, dx=\text {Exception raised: ValueError} \] Input:
integrate((A+B*cos(x))/(a+b*cos(x)+c*sin(x)),x, algorithm="maxima")
Output:
Exception raised: ValueError >> Computation failed since Maxima requested additional constraints; using the 'assume' command before evaluation *may* help (example of legal syntax is 'assume(c^2+b^2-a^2>0)', see `assume?` f or more de
Time = 0.29 (sec) , antiderivative size = 178, normalized size of antiderivative = 1.55 \[ \int \frac {A+B \cos (x)}{a+b \cos (x)+c \sin (x)} \, dx=\frac {B b x}{b^{2} + c^{2}} + \frac {B c \log \left (-a \tan \left (\frac {1}{2} \, x\right )^{2} + b \tan \left (\frac {1}{2} \, x\right )^{2} - 2 \, c \tan \left (\frac {1}{2} \, x\right ) - a - b\right )}{b^{2} + c^{2}} - \frac {B c \log \left (\tan \left (\frac {1}{2} \, x\right )^{2} + 1\right )}{b^{2} + c^{2}} + \frac {2 \, {\left (B a b - A b^{2} - A c^{2}\right )} {\left (\pi \left \lfloor \frac {x}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (-2 \, a + 2 \, b\right ) + \arctan \left (-\frac {a \tan \left (\frac {1}{2} \, x\right ) - b \tan \left (\frac {1}{2} \, x\right ) + c}{\sqrt {a^{2} - b^{2} - c^{2}}}\right )\right )}}{\sqrt {a^{2} - b^{2} - c^{2}} {\left (b^{2} + c^{2}\right )}} \] Input:
integrate((A+B*cos(x))/(a+b*cos(x)+c*sin(x)),x, algorithm="giac")
Output:
B*b*x/(b^2 + c^2) + B*c*log(-a*tan(1/2*x)^2 + b*tan(1/2*x)^2 - 2*c*tan(1/2 *x) - a - b)/(b^2 + c^2) - B*c*log(tan(1/2*x)^2 + 1)/(b^2 + c^2) + 2*(B*a* b - A*b^2 - A*c^2)*(pi*floor(1/2*x/pi + 1/2)*sgn(-2*a + 2*b) + arctan(-(a* tan(1/2*x) - b*tan(1/2*x) + c)/sqrt(a^2 - b^2 - c^2)))/(sqrt(a^2 - b^2 - c ^2)*(b^2 + c^2))
Time = 42.80 (sec) , antiderivative size = 1709, normalized size of antiderivative = 14.86 \[ \int \frac {A+B \cos (x)}{a+b \cos (x)+c \sin (x)} \, dx=\text {Too large to display} \] Input:
int((A + B*cos(x))/(a + b*cos(x) + c*sin(x)),x)
Output:
(log(32*B^3*a^2 - 32*A*B^2*a^2 + 32*A*B^2*b^2 - 32*A^2*B*b^2 - 32*B^3*a*b + 32*A^2*B*a*b - ((B*c^3 + A*b^2*(b^2 - a^2 + c^2)^(1/2) - B*a^2*c + A*c^2 *(b^2 - a^2 + c^2)^(1/2) + B*b^2*c - B*a*b*(b^2 - a^2 + c^2)^(1/2))*(64*A^ 2*b^2*c - 32*B^2*a^2*c + 32*B^2*b^2*c + 32*tan(x/2)*(a - b)*(A^2*b^2 + 2*B ^2*a^2 - A^2*c^2 + B^2*b^2 - 3*B^2*c^2 + 4*A*B*c^2 - 2*B^2*a*b - 2*A*B*a*b ) + 64*A*B*a^2*c - 64*A*B*b^2*c - 64*A^2*a*b*c + ((B*c^3 + A*b^2*(b^2 - a^ 2 + c^2)^(1/2) - B*a^2*c + A*c^2*(b^2 - a^2 + c^2)^(1/2) + B*b^2*c - B*a*b *(b^2 - a^2 + c^2)^(1/2))*(32*A*a^2*c^2 - 32*B*b^4 - 32*A*a^2*b^2 - 32*A*b ^4 - 32*B*a^2*b^2 - 32*A*b^2*c^2 + 32*B*a^2*c^2 + 64*B*b^2*c^2 + 64*A*a*b^ 3 + 64*B*a*b^3 - 96*B*a*b*c^2 + 32*c*tan(x/2)*(a - b)*(2*A*b^2 + 2*A*c^2 + 4*B*b^2 + B*c^2 - 2*A*a*b - 4*B*a*b) + (32*(a - b)*(B*c^3 + A*b^2*(b^2 - a^2 + c^2)^(1/2) - B*a^2*c + A*c^2*(b^2 - a^2 + c^2)^(1/2) + B*b^2*c - B*a *b*(b^2 - a^2 + c^2)^(1/2))*(3*c^4*tan(x/2) + a*c^3 + 3*b*c^3 + 3*b^3*c + 2*a^2*b^2*tan(x/2) - 2*a^2*c^2*tan(x/2) + 3*b^2*c^2*tan(x/2) - 2*a*b^3*tan (x/2) + a*b^2*c - 4*a^2*b*c - 2*a*b*c^2*tan(x/2)))/((b^2 + c^2)*(b^2 - a^2 + c^2))))/((b^2 + c^2)*(b^2 - a^2 + c^2))))/((b^2 + c^2)*(b^2 - a^2 + c^2 )) + 32*B*c*tan(x/2)*(A - B)^2*(a - b))*(B*c^3 + b^2*(A*(b^2 - a^2 + c^2)^ (1/2) + B*c) - B*a^2*c + A*c^2*(b^2 - a^2 + c^2)^(1/2) - B*a*b*(b^2 - a^2 + c^2)^(1/2)))/((b^2 + c^2)*(b^2 - a^2 + c^2)) - (B*log(tan(x/2) + 1i))/(b *1i + c) - (B*log(tan(x/2) - 1i)*1i)/(b + c*1i) - (log(32*B^3*a^2 - 32*...
Time = 0.16 (sec) , antiderivative size = 166, normalized size of antiderivative = 1.44 \[ \int \frac {A+B \cos (x)}{a+b \cos (x)+c \sin (x)} \, dx=\frac {2 \sqrt {a^{2}-b^{2}-c^{2}}\, \mathit {atan} \left (\frac {\tan \left (\frac {x}{2}\right ) a -\tan \left (\frac {x}{2}\right ) b +c}{\sqrt {a^{2}-b^{2}-c^{2}}}\right ) a \,c^{2}+\mathrm {log}\left (\cos \left (x \right ) b +\sin \left (x \right ) c +a \right ) a^{2} b c -\mathrm {log}\left (\cos \left (x \right ) b +\sin \left (x \right ) c +a \right ) b^{3} c -\mathrm {log}\left (\cos \left (x \right ) b +\sin \left (x \right ) c +a \right ) b \,c^{3}+a^{2} b^{2} x -b^{4} x -b^{2} c^{2} x}{a^{2} b^{2}+a^{2} c^{2}-b^{4}-2 b^{2} c^{2}-c^{4}} \] Input:
int((A+B*cos(x))/(a+b*cos(x)+c*sin(x)),x)
Output:
(2*sqrt(a**2 - b**2 - c**2)*atan((tan(x/2)*a - tan(x/2)*b + c)/sqrt(a**2 - b**2 - c**2))*a*c**2 + log(cos(x)*b + sin(x)*c + a)*a**2*b*c - log(cos(x) *b + sin(x)*c + a)*b**3*c - log(cos(x)*b + sin(x)*c + a)*b*c**3 + a**2*b** 2*x - b**4*x - b**2*c**2*x)/(a**2*b**2 + a**2*c**2 - b**4 - 2*b**2*c**2 - c**4)